📂
Bannerlord Modding CN
  • 骑马与砍杀2 领主 Mod 制作文档
  • C# API Documentation
    • Core
      • MBObjectManager
      • GameModel
      • InformationManager
      • BasicCharacterObject
      • Game
      • ItemObject
    • Campaign System
      • GameMenu
      • Settlement
      • CampaignGameStarter
      • actions
        • ChangeOwnerOfSettlementAction
      • TournamentGame
      • Hero : MBObjectBase, ITrackableCampaignObject, ITrackableBase
      • CampaignBehaviorBase
    • Mount And Blade
      • MissionBehaviour
        • MissionView
        • MissionLogic
      • MBInitialScreenBase
      • Mission
      • MBSubModuleBase
      • agent
      • Team
    • Input System
      • Input
    • Engine
      • GlobalLayer
      • ScriptComponentBehaviour
      • Scene
      • GameEntity
    • Library
      • ModuleInfo
    • Platform Service
    • Save System
    • Localization
      • MBTextManager
      • TextObject
    • Network
    • Two Dimension
  • XML Documentation
    • NPCCharacters
      • NPCCharacter(NPC角色)
        • upgrade_targets
          • upgrade_target
        • equipmentSet
          • equipment
        • Face
          • BodyProperties
          • hair_tags
            • hair_tag
          • BodyPropertiesMax
          • beard_tags
            • beard_tag
          • face_key_template
        • equipment
        • skills
          • skill
        • Traits
          • Trait
    • 物品(大类) Items
      • 物品 Item
        • 物品组件 ItemComponent
          • 马匹 Horse
            • Materials
              • Material
                • MeshMultipliers
                  • MeshMultiplier
          • 防具 Armor
          • Weapon
            • WeaponFlags
          • 食物 Food
        • 旗帜 Flags
      • CraftedItem
        • Pieces
          • Piece
    • Items (XML)
    • Scenes
      • Scene
        • GameType
        • TerrainType
          • TerrainType
    • SPCultures (XML)
    • SPCultures
      • Culture
        • female_names
          • name
        • male_names
          • name
        • clan_names
          • name
    • Atmosphere (XML)
    • SubModule (XML)
    • Scenes (XML)
    • NPCCharacters (XML)
  • Gauntlet
    • Brush
    • GauntletLayer
    • GauntletMovie
    • SceneLayer
    • Movie (XML)
    • Widget
    • GauntletView
    • ScreenBase
    • ViewModel
    • ScreenManager
  • Introduction
    • 高级用法
    • 开始第一步
    • 文件夹结构
    • Defining custom data
  • Tutorials
    • 将你的mod打包上传至Vortex
    • Making Banners
    • 不需要C#的UI系统Mod入门 #
    • 基本 C# Mod
    • new_settlements
  • ru
    • _intro
      • Начало
      • Структура папок
Powered by GitBook
On this page
  • General Info
  • Setting gloabal text variables
  • TextContext

Was this helpful?

  1. C# API Documentation
  2. Localization

MBTextManager

PreviousLocalizationNextTextObject

Last updated 4 years ago

Was this helpful?

General Info

The MBTextManager is a public static class, that is used to make in-game texts localizable. It contains games text processong logics and could be used to set global text variables. You can find more information on text variables .

Setting gloabal text variables

You can set text variable to MBTextManager using method SetTextVariable:

MBTextManager.SetTextVariable(tag, textObject);

It has several overloaded versions with different value argument types.

Any variable set to the MBTextManager will be used by game text processor for any TextObject as if it was defined for that TextObject itself:

StringHelpers.SetCharacterProperties("CURRENT_LIEGE", forLord.MapFaction.Leader.CharacterObject, null, null, false);
StringHelpers.SetCharacterProperties("NEW_LIEGE", newLiege.CharacterObject, null, null, false);

...

persuasionTask2.SpokenLine =
      new TextObject("{=CymOFgzv}I gave an oath to {CURRENT_LIEGE.LINK} - but {?LORD.GENDER}her{?}his{\\?} disregard for the common people of this realm does give me pause.");

In this example method StringHelpers.SetCharacterProperties is used to store certain character properties to the MBTextManager variable array, making them global. They are then used to form new TextObject for a persuasion dialog line.

Please note that TextObject instance must not have any defined attributes (its own text variables) in order to have access to global variables.

TextContext

Any variable set to MBTextManager is stored in the private readonly field named TextContext. It serves as an advanced ditionary of text variables and functions (need more info on that matter), and is only cleared on Campaign.OnDestroy(). Keep in mind that text variables could be freely rewrited at any time with new values.

here