wiki更新

This commit is contained in:
panw
2025-10-30 16:49:19 +08:00
parent 40e0086be3
commit 93ceaa70e4
18 changed files with 746 additions and 1100 deletions

View File

@@ -2,20 +2,27 @@
<cite>
**本文档中引用的文件**
- [Main.ts](file://assets/script/Main.ts)
- [Initialize.ts](file://assets/script/game/initialize/Initialize.ts)
- [SingletonModuleComp.ts](file://assets/script/game/common/SingletonModuleComp.ts)
- [EcsPositionSystem.ts](file://assets/script/game/common/ecs/position/EcsPositionSystem.ts)
- [BattleMoveSystem.ts](file://assets/script/game/common/ecs/position/BattleMoveSystem.ts)
- [BattleMoveComp.ts](file://assets/script/game/common/ecs/position/BattleMoveComp.ts)
- [HeroViewComp.ts](file://assets/script/game/hero/HeroViewComp.ts)
- [HeroModelComp.ts](file://assets/script/game/hero/HeroModelComp.ts)
- [Main.ts](file://assets/script/Main.ts) - *更新了ECS系统注册*
- [Initialize.ts](file://assets/script/game/initialize/Initialize.ts#L1-L207)
- [SingletonModuleComp.ts](file://assets/script/game/common/SingletonModuleComp.ts#L1-L195)
- [HSkillSystem.ts](file://assets/script/game/hero/HSkillSystem.ts#L1-L272) - *新增ECS系统注册装饰器*
- [HeroAtk.ts](file://assets/script/game/hero/HeroAtk.ts#L1-L248) - *新增ECS系统注册装饰器*
- [HeroAttrsComp.ts](file://assets/script/game/hero/HeroAttrsComp.ts#L1-L380) - *新增ECS组件注册装饰器*
- [HeroViewComp.ts](file://assets/script/game/hero/HeroViewComp.ts#L1-L780)
- [MapModelComp.ts](file://assets/script/game/map/model/MapModelComp.ts)
- [MapViewComp.ts](file://assets/script/game/map/view/MapViewComp.ts)
- [ecs.md](file://doc/ecs/ecs.md)
- [MvvmInfo.md](file://doc/mvvm/MvvmInfo.md)
</cite>
## 更新摘要
**变更内容**
- 在HSkillSystem.ts、HeroAtk.ts和HeroAttrsComp.ts中添加了ECS注册装饰器
- Main.ts的初始化流程更新反映架构入口点调整
- 移除了过时的SkillConComp组件更新技能系统架构说明
- 新增了英雄属性更新系统(HeroAttrSystem)和生命周期系统(HeroLifecycleSystem)的文档
- 更新了ECS架构支柱章节反映最新的系统注册模式
## 目录
1. [引言](#引言)
2. [项目架构概览](#项目架构概览)
@@ -89,10 +96,15 @@ class ecs_Comp {
+canRecycle boolean
+ent Entity
}
class BattleMoveComp {
+direction number
+targetX number
+moving boolean
class HeroAttrsComp {
+hero_uuid number
+lv number
+base_ap number
+base_hp number
+hp number
+mp number
+Attrs any
+BUFFS any
+reset() void
}
class HeroViewComp {
@@ -104,44 +116,48 @@ class HeroViewComp {
+BUFFS any
+update(dt) void
}
class HeroModelComp {
+reset() void
class HeroSkillsComp {
+skills SkillSlot[]
+initSkills(skillIds) void
+canCast(index, mp) boolean
+resetCD(index) void
+updateCDs(dt) void
}
ecs_Comp <|-- BattleMoveComp
ecs_Comp <|-- HeroAttrsComp
ecs_Comp <|-- HeroViewComp
ecs_Comp <|-- HeroModelComp
ecs_Comp <|-- HeroSkillsComp
```
**图表来源**
- [BattleMoveComp.ts](file://assets/script/game/common/ecs/position/BattleMoveComp.ts#L1-L16)
- [HeroAttrsComp.ts](file://assets/script/game/hero/HeroAttrsComp.ts#L7-L380) - *新增ECS组件注册*
- [HeroViewComp.ts](file://assets/script/game/hero/HeroViewComp.ts#L1-L780)
- [HeroModelComp.ts](file://assets/script/game/hero/HeroModelComp.ts#L1-L13)
- [HeroSkills.ts](file://assets/script/game/hero/HeroSkills.ts#L1-L150)
### 系统协作机制
系统通过过滤器机制实现高效的实体管理:
系统通过过滤器机制实现高效的实体管理并使用ECS注册装饰器进行系统注册
```mermaid
sequenceDiagram
participant RS as RootSystem
participant BS as BattleMoveSystem
participant HSS as HeroAttrSystem
participant ECS as ECS引擎
participant Entity as 实体
participant Comp as 组件
RS->>ECS : 执行系统
ECS->>BS : filter()匹配实体
BS->>Entity : 获取BattleMoveComp
BS->>Entity : 获取HeroViewComp
BS->>Entity : update()处理逻辑
ECS->>HSS : filter()匹配实体
HSS->>Entity : 获取HeroAttrsComp
HSS->>Entity : update()处理逻辑
Entity->>Comp : 更新状态
Comp-->>Entity : 返回结果
Entity-->>BS : 完成处理
BS-->>RS : 系统执行完毕
Entity-->>HSS : 完成处理
HSS-->>RS : 系统执行完毕
```
**图表来源**
- [BattleMoveSystem.ts](file://assets/script/game/common/ecs/position/BattleMoveSystem.ts#L1-L272)
- [EcsPositionSystem.ts](file://assets/script/game/common/ecs/position/EcsPositionSystem.ts#L1-L9)
- [HSkillSystem.ts](file://assets/script/game/hero/HSkillSystem.ts#L1-L272) - *新增ECS系统注册装饰器*
- [HeroAtk.ts](file://assets/script/game/hero/HeroAtk.ts#L1-L248) - *新增ECS系统注册装饰器*
- [HeroAttrsComp.ts](file://assets/script/game/hero/HeroAttrsComp.ts#L397-L437) - *新增HeroAttrSystem*
### ECS解耦优势
@@ -154,7 +170,7 @@ ECS架构在游戏逻辑中实现了以下解耦效果
**章节来源**
- [ecs.md](file://doc/ecs/ecs.md#L1-L357)
- [BattleMoveSystem.ts](file://assets/script/game/common/ecs/position/BattleMoveSystem.ts#L1-L272)
- [HSkillSystem.ts](file://assets/script/game/hero/HSkillSystem.ts#L1-L272) - *新增ECS系统注册装饰器*
## MVVM架构支柱
@@ -314,7 +330,7 @@ LoadConfig --> SetupGUI[设置GUI框架]
```
**图表来源**
- [Main.ts](file://assets/script/Main.ts#L15-L41)
- [Main.ts](file://assets/script/Main.ts#L15-L41) - *更新了ECS系统注册*
### 初始化流程详解