diff --git a/TODO.md b/TODO.md index 55eb5b3..0c504e0 100644 --- a/TODO.md +++ b/TODO.md @@ -4,13 +4,14 @@ > **2026-04-30 第一波完成**:Definition/Enum + Event > **2026-04-30 第二波完成**:Vector3/Mathf 替换,AttackPayload/HitContext 迁移 +> **2026-05-01 第三波完成**:IDataRow 实现、TagRow/RarityTagBudgetRow、TagGenerationRuleRegistry 重构 ## 概述 | 指标 | 数量 | 状态 | |------|------|------| | 总文件数 | 457 | - | -| L0 (Domain) 可直接迁移 | ~180 | **第一波已完成 62 个文件,第二波完成 5 个文件** | +| L0 (Domain) 可直接迁移 | ~180 | **第一波 62 个 + 第二波 5 个 + 第三波 6 个** | | L1 (Infrastructure) 需重构 | ~80 | - | | L2 (Presentation) Unity 依赖 | ~197 | - | @@ -19,8 +20,9 @@ ``` src/ ├── GeometryTD.Domain/ # L0 - 纯净 C# -├── GeometryTD.Infrastructure/ # L1 - Unity 胶水层 -├── GeometryTD.Presentation/ # L2 - Unity 表现层 +│ └── DataTable/ # IDataRow 实现(TagRow, RarityTagBudgetRow) +├── GeometryTD.Infrastructure/ # L1 - Unity 胶水层(待实现) +│ └── DataTable/ # DR* : DataRowBase 包装类 └── Geometry-Tower-Defense-Base.sln ``` @@ -144,12 +146,12 @@ src/ - [x] `Definition/Tag/Combat/StatusEffects/IEnemyStatusTagEffect.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Combat/StatusEffects/IceTagEffect.cs` ⚠️ **已迁移** - Mathf → System.Math - [ ] `Definition/Tag/Combat/TagEffectResolver.cs` -- [ ] `Definition/Tag/Generation/ComponentTagGenerationService.cs` +- [x] `Definition/Tag/Generation/TagGenerationRule.cs` ✅ **已迁移** - 纯 C# +- [x] `Definition/Tag/Generation/RarityTagBudgetRule.cs` ✅ **已迁移** - 纯 C# +- [x] `Definition/Tag/Generation/TagGenerationRuleRegistry.cs` ✅ **已重构** - 使用 IEnumerable +- [x] `Definition/Tag/Generation/RarityTagBudgetRuleRegistry.cs` ✅ **已重构** - 使用 IEnumerable +- [ ] `Definition/Tag/Generation/ComponentTagGenerationService.cs` - 依赖 InventoryTagRandomContext - [ ] `Definition/Tag/Generation/InventoryTagRandomContext.cs` -- [ ] `Definition/Tag/Generation/RarityTagBudgetRule.cs` -- [ ] `Definition/Tag/Generation/RarityTagBudgetRuleRegistry.cs` -- [ ] `Definition/Tag/Generation/TagGenerationRule.cs` -- [ ] `Definition/Tag/Generation/TagGenerationRuleRegistry.cs` - [x] `Definition/Tag/Metadata/Config/AbsoluteZeroTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/BurnSpreadTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/CritTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 @@ -555,16 +557,23 @@ L0 迁移阻塞链: ├── TagDefinitionRegistry (L1 重构) ──→ DR* (L1) ──→ DataTableExtension (L1) ├── AttackPayload (L1 重构) ──→ TagEffectResolver (L1 重构) └── MapTopologyService (L1 重构) ──→ EntityData (L2) + +三层拆分新架构(2026-05-01): +├── L0: IDataRow 实现(TagRow, RarityTagBudgetRow) +│ └── Registry 使用 IEnumerable 而非 DRTag +└── L1: DR* : DataRowBase + L0 实例成员 + └── Bridge: UGF DataTableComponent → L0 IDataRow ``` ### 重构优先级 1. **第一波**:Definition/Enum + Event ✅ 已完成 -2. **第二波**:Vector3 → System.Numerics.Vector3,Mathf → System.Math ✅ **已完成部分** -3. **第三波**:Tag 系统迁移到 L1(TagDefinitionRegistry、TagEffectResolver 等) -4. **第四波**:GameEntry 静态调用 → 接口注入 -5. **第五波**:Tilemap 接口抽象 -6. **第六波**:剩余 L1 文件迁移 +2. **第二波**:Vector3 → System.Numerics.Vector3,Mathf → System.Math ✅ **已完成** +3. **第三波**:IDataRow 实现、TagRow/RarityTagBudgetRow、TagGenerationRuleRegistry ✅ **已完成** +4. **第四波**:L1 DR* 包装类 + Bridge 实现(UGF DataTable → L0 IDataRow) +5. **第五波**:GameEntry 静态调用 → 接口注入 +6. **第六波**:Tilemap 接口抽象 +7. **第七波**:剩余 L1 文件迁移 --- @@ -638,6 +647,42 @@ L0 迁移阻塞链: --- +## 第三波修改记录(2026-05-01) + +### 概述 + +采用新架构:L0 实现 `IDataRow` 接口,L1 提供 `DataRowBase` 包装类。 + +``` +L0: TagRow : IDataRow ← 纯 C# 解析逻辑 +L1: DRTag : DataRowBase ← UGF 兼容层,内部持有 TagRow 实例 + └── DRTag.ParseDataRow() 委托给 TagRow.ParseDataRow() +Bridge: DataTableComponent ← 将 UGF 数据转换为 L0 Row 集合 +``` + +### 新增文件 + +| 文件 | 说明 | +|------|------| +| `DataTable/TagRow.cs` | 实现 `IDataRow`,含 TagId, TagType, MinRarity, Weight, IsImplemented | +| `DataTable/RarityTagBudgetRow.cs` | 实现 `IDataRow`,含 Id, Rarity, MinCount, MaxCount | +| `Definition/Tag/Generation/TagGenerationRule.cs` | 从 src-ref 迁移 | +| `Definition/Tag/Generation/RarityTagBudgetRule.cs` | 从 src-ref 迁移 | +| `Definition/Tag/Generation/TagGenerationRuleRegistry.cs` | 重构为使用 `IEnumerable` | +| `Definition/Tag/Generation/RarityTagBudgetRuleRegistry.cs` | 重构为使用 `IEnumerable` | + +### L0 构建状态 + +✅ `dotnet build GeometryTD.Domain` **成功**,0 警告 0 错误 + +### 待完成(L1 部分) + +- [ ] `DataTable/DRTag : DataRowBase` — 包装 TagRow +- [ ] `DataTable/DRRarityTagBudget : DataRowBase` — 包装 RarityTagBudgetRow +- [ ] `Bridge/DataTableBridge` — UGF DataTableComponent → L0 Row 集合 + +--- + ## 验收标准 - [x] L0 独立构建成功(`dotnet build GeometryTD.Domain`)✅ **2026-04-30**