forked from Bannerlord-Modding/Documentation
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,021 additions
and
1,038 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
# BasicCharacterObject | ||
|
||
BasicCharacterObjects contain the deserialized information from the `npccharacters` XML file. This includes the BodyProperties, Equipment, Level, Skills, and Culture for each defined character. | ||
`BasicCharacterObjects` 包含了 `npccharacters` XML 文件中的反序列化信息。每个被定义的角色有 `BodyProperties`, `Equipment`, `Level`, `Skills`, 和 `Culture` 信息。 | ||
|
||
BasicCharacterObjects are used as the building blocks for [Agents](../mountandblade/agent.md). | ||
`BasicCharacterObjects` 一般用来构建 [Agents](../mountandblade/agent.md) 的区块。 | ||
|
||
You can use the [MBObjectManager](mbobjectmanager.md) to get a loaded BasicCharacterObject by using the following: | ||
你可以用 [MBObjectManager](mbobjectmanager.md) 来获取一个加载后的 `BasicCharacterObject` ,代码如下: | ||
|
||
```csharp | ||
MBObjectManager.Instance.GetObject<BasicCharacterObject>("example_troop_id"); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# GameEntity | ||
|
||
GameEntities are objects (entities) in the game. Examples include characters, buildings, trees, and horses to name a few. Every prop in the game is a GameEntity. | ||
游戏实体 `GameEntity` 指的是游戏里的对象\(或称之为实体\)。举几个例子:角色,建筑,树木,马匹……等等等等。凡是游戏里出现的每个物件都是一个游戏实体。 | ||
|
||
GameEntities contain Meshes, Skeletons, PhysicsBodies, and ScriptComponents along with a variety of other things for each object in the game. | ||
每一个游戏实体,包含了:网格\(`Mesh`\),骨架\(`Skeleton`\),刚体\(`PhysicsBody`\),脚本组件\(`ScriptComponent`\)以及各种游戏里的对象附带的其他内容。 | ||
|
||
You can add a GameEntity to a scene by editing the [Scene](../../_xmldocs/scene.md)'s `scene.xscene` file or spawn (instantiate) one directly using the following static method from the GameEntity class: | ||
要向场景里添加一个游戏实体,除了通过编辑场景\([Scene](../../_xmldocs/scene.md)\)文件`scene.xscene`外,也可以直接通过`GameEntity`类的静态方法`Instantiate`“刷出”\(实例化出\)一个,比如: | ||
|
||
```csharp | ||
GameEntity.Instantiate(Scene scene, string prefabName, MatrixFrame frame) | ||
``` | ||
|
||
Example Usage (spawning at main [Agent](../mountandblade/agent.md)): | ||
另一个例子,往`main [Agent]`(../mountandblade/agent.md)里生成一个物体。\(注:`Agent`负责处理活物\) | ||
|
||
```csharp | ||
GameEntity.Instantiate(Mission.Current.Scene, "ship_a", Agent.Main.Frame) | ||
``` | ||
|
||
## Multiplayer GameEntities | ||
## 多人模式中的游戏实体 | ||
|
||
Some GameEntities will not be synced between Clients, unless a SynchedMissionObject ScriptComponent is added. | ||
某些游戏实体无法在玩家的客户端之间同步,因此你需要自己往脚本组件\(`ScriptComponent`\)里添加 `SynchedMissionObject`。 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# Input | ||
|
||
This static type provides you with input functionality, the base input system has no events to bind to and supports polling only. It's largely self explanatory with a few possible gotchas. | ||
`Input`这个静态类型用来提供输入功能。基本的输入系统并不是基于事件绑定的,而是采用轮询的方式。这部分内容比较直观,一般来说看函数名就知道用法,但也会有几个坑。 | ||
|
||
## Key Polling | ||
## 按键轮询 | ||
|
||
`GetKeyDown(KeyCode)` | `GetKeyPressed(KeyCode)` | `GetKeyReleased(KeyCode)` - These are likely to be the most commonly used methods, `GetKeyDown` will return true on any number of frames so long as a key is down, this can cause undesired behaviour. If you only want to read an input once, use `GetKeyPressed` or `GetKeyReleased`. | ||
`GetKeyDown(KeyCode)` | `GetKeyPressed(KeyCode)` | `GetKeyReleased(KeyCode)` - 这几个貌似是最常用的方法了。 关于 `GetKeyDown` 请注意:只要键盘按键处于按下状态,程序就会在每一帧持续不断地返回`true`,显然这会导致运行一些不必要的方法\(造成资源浪费\)。假如你只想触发一次按键操作,可以用`GetKeyPressed` 或者 `GetKeyReleased`。 | ||
|
||
You can also use the extension methods `IsDown`/`IsPressed`/`IsReleased` like so `KeyCode.A.IsPressed()` | ||
还有几个扩展方法也可以达到按键的效果:`IsDown`/`IsPressed`/`IsReleased`。用法如: `KeyCode.A.IsPressed()`。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# Agent | ||
|
||
You can think of an agent as any **living** entity in the game. | ||
你可以把媒介(`agent`)想象成游戏里任何**能走动**的实体。 | ||
|
||
This might be the player, an NPC character, or even a horse. | ||
比方说可以是玩家,NPC,甚至是一匹马。 | ||
|
||
## Tips | ||
|
||
* You can get the player agent through the `Agent.Main` property (assuming they are alive). | ||
## 小贴士 | ||
|
||
* 你可以通过`Agent`下的`Agent.Main` 属性调用玩家媒介\(前提是玩家还活着\)。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,44 @@ | ||
# MBSubModuleBase | ||
|
||
You can inherit from the MBSubModuleBase class to handle the loading of your module, it is essentially the entry point to your code. There are several useful overrides, such as `OnSubModuleLoad()` and `OnApplicationTick()` that you can make use of. | ||
你可以通过继承 `MBSubModuleBase 类` 来处理MOD的加载,可以说这是你MOD的入口。这个类中有一些很有用的重载,比如 `OnSubModuleLoad()` 和 `OnApplicationTick()`。 | ||
|
||
**It is important to note that you must reference the class' fully qualified name in the module's `SubModule.xml` for this to work properly.** | ||
**一定注意在 `SubModule.xml` 里写上正确完整的类名,不然运行时会出问题。** | ||
|
||
Example `SubModule.xml` where `ExampleMod.MySubModule` is the fully qualified name for the class inheriting MBSubModuleBase: [SubModule.xml](../../_xmldocs/submodule.md) | ||
这是一个例子([SubModule.xml](../../_xmldocs/submodule.md)):例中的 `ExampleMod.MySubModule` 就是一个正确的类名。 | ||
|
||
## Overrides | ||
## 可重载的函数 | ||
|
||
This is the full list of available overrides, in (generally) the order in which they are called. This is a rough guide and is not a substitute for debugging when you're having order-of-execution issues. | ||
下面列出了所有可以重载的函数,并且一般情况下它们就是以这个顺序被调用。这只是一个大概的指南,当你遇到运行顺序导致的问题时,这不能取代Debug。 | ||
|
||
- `OnSubModuleLoad()` - Called during the first loading screen of the game, always the first override to be called, this is where you should be doing the bulk of your initial setup. | ||
- `OnApplicationTick(float)` - This is called once every frame, you should avoid expensive operations being called directly here and instead do as little work as possible for performance reasons. | ||
- `float` - The time in milliseconds the frame took to complete. | ||
- `OnBeforeInitialModuleScreenSetAsRoot()` - Called just before the main menu first appears, helpful if your mod depends on other things being set up during the initial load. | ||
- `OnGameStart(Game, IGameStarter)` - Called immediately upon loading after selecting a game mode (submodule) from the main menu. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `OnSubModuleLoad()` - 游戏处于加载界面时最先被调用的函数,你应该在这个函数中完成初始化的主要部分 | ||
- `OnApplicationTick(float)` - 这个函数每一帧都会被调用一次,为了性能考虑,在这个函数中要尽量避免加入一些复杂且费时的操作 | ||
- `float` - 完成当前帧耗费的时间(毫秒) | ||
- `OnBeforeInitialModuleScreenSetAsRoot()` - 在主菜单出现前一刻被调用的函数,当你的MOD需要加载一些别的东西的时候挺有用的 | ||
- `OnGameStart(Game, IGameStarter)` - 当用户在主菜单选择一个游戏模式(submodule)后会立刻被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `IGameStarter` - N/A | ||
- `BeginGameStart(Game)` - Called immediately after loading the selected game mode (submodule) has completed. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `OnGameLoaded(Game, object)` - Called only after loading a save. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `BeginGameStart(Game)` - 当所选的游戏模式加载完成后立刻被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `OnGameLoaded(Game, object)` - 当加载了一个存档后被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `object` - N/A | ||
- `OnCampaignStart(Game, object)` - Called once any game mode is started. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `OnCampaignStart(Game, object)` - 当任意游戏模式启动后被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `object` - N/A | ||
- `OnGameInitializationFinished(Game)` - Called once the initialisation for a game mode has finished. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `DoLoading(Game)` - Called seemingly as loading is ending, not entirely sure of this one. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `OnNewGameCreated(Game, object)` - Called when starting a new save in the campaign mode specifically. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `OnGameInitializationFinished(Game)` - 当某个游戏模式初始化完成后被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `DoLoading(Game)` - 当加载结束时被调用,这个不是很确定 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `OnNewGameCreated(Game, object)` - 当战役模式中开始一个新游戏时被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `object` - N/A | ||
- `OnMissionBehaviourInitialize(Mission)` - Called once a mission is started and behaviours are to be initialized. | ||
- `Mission` - [See: Mission](mission.md) | ||
- `OnGameEnd(Game)` - Called on exiting out of a mission/campaign. | ||
- `Game` - [See: Game](../core/game.md) | ||
- `OnSubModuleUnloaded()` - Called when exiting Bannerlord entirely. | ||
|
||
- `OnMissionBehaviourInitialize(Mission)` - 当一个任务(mission)开始后,行为(behaviours)初始化前被调用 | ||
- `Mission` - [详情: Mission](mission.md) | ||
- `OnGameEnd(Game)` - 当退出一个任务或战役时被调用 | ||
- `Game` - [详情: Game](../core/game.md) | ||
- `OnSubModuleUnloaded()` - 当退出游戏时被调用 | ||
|
||
|
||
- `OnMultiplayerGameStart(Game, object)` - Multiplayer related, haven't tested. | ||
- `OnMultiplayerGameStart(Game, object)` - 多人游戏相关,未测试 | ||
- `Game` - [See: Game](../core/game.md) | ||
- `object` - N/A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
# Mission | ||
|
||
You can think of Missions as GameModes(Battles/TeamDeathMatch) etc. Missions are instantiated with a [Scene](../engine/scene.md), [MissionViews](missionbehaviour/missionview.md), and [MissionBehaviours](missionbehaviour/README.md). | ||
所谓任务\(`Mission`\),可以理解成游戏模式`GameMode`(如战场`Battle`,死斗`TeamDeathMatch`之类)。当任务实例化的时候,同时还会生成的实例有:场景[Scene](../engine/scene.md),任务视图[MissionViews](missionbehaviour/missionview.md),还有任务行为[MissionBehaviours](missionbehaviour/README.md)。 | ||
|
||
More information on missions will be available once we gain access to the `CampaignSystem` DLLs. | ||
更多关于任务的相关信息,要等我们\(文档原作者\)获得`CampaignSystem`的DLL的访问权。 | ||
|
||
## Tips | ||
|
||
* You can get the current mission instance (if any) by using `Mission.Current` property. | ||
## 小贴士 | ||
|
||
* 你可以通过 `Mission.Current` 属性获取当前任务下的实例\(假如有任何实例的话\)。 |
Oops, something went wrong.