# GeometryTD 三层拆分迁移 TODO 最后更新:2026-04-30 > **2026-04-30 第一波完成**:Definition/Enum + Event > **2026-04-30 第二波完成**:Vector3/Mathf 替换,AttackPayload/HitContext 迁移 ## 概述 | 指标 | 数量 | 状态 | |------|------|------| | 总文件数 | 457 | - | | L0 (Domain) 可直接迁移 | ~180 | **第一波已完成 62 个文件,第二波完成 5 个文件** | | L1 (Infrastructure) 需重构 | ~80 | - | | L2 (Presentation) Unity 依赖 | ~197 | - | ## 项目骨架 ``` src/ ├── GeometryTD.Domain/ # L0 - 纯净 C# ├── GeometryTD.Infrastructure/ # L1 - Unity 胶水层 ├── GeometryTD.Presentation/ # L2 - Unity 表现层 └── Geometry-Tower-Defense-Base.sln ``` --- ## 阶段一:L0 直接迁移(无需修改) 以下文件可直接复制到 `GeometryTD.Domain/`,无任何修改。 ### Definition/Enum(27 个文件) - [x] `Definition/Enum/AttackMethodType.cs` - [x] `Definition/Enum/AttackPropertyType.cs` - [x] `Definition/Enum/CampType.cs` - [x] `Definition/Enum/CombatSelectActionType.cs` ⚠️ **已修改** - 从 `UI/Combat/Context/` 迁移 - [x] `Definition/Enum/EntryType.cs` - [x] `Definition/Enum/EventEffectType.cs` - [x] `Definition/Enum/EventRequirementType.cs` - [x] `Definition/Enum/InventoryTagSourceType.cs` - [x] `Definition/Enum/LevelThemeType.cs` - [x] `Definition/Enum/LevelVictoryType.cs` - [x] `Definition/Enum/PhaseEndType.cs` - [x] `Definition/Enum/ProcedureMainCombatEntryBlockReason.cs` - [x] `Definition/Enum/ProcedureMainFlowPhase.cs` - [x] `Definition/Enum/ProcedureMainRunAdvanceResult.cs` - [x] `Definition/Enum/ProcedureMainRunCompletionResult.cs` - [x] `Definition/Enum/RarityType.cs` - [x] `Definition/Enum/RelationType.cs` - [x] `Definition/Enum/RepoItemClickActionType.cs` - [x] `Definition/Enum/RunNodeCompletionStatus.cs` ⚠️ **已修改** - 从 `Procedure/ProcedureMain/RunModel.cs` 迁移枚举 - [x] `Definition/Enum/RunNodeStatus.cs` ⚠️ **已修改** - 从 `Procedure/ProcedureMain/RunModel.cs` 迁移枚举 - [x] `Definition/Enum/RunNodeType.cs` ⚠️ **已修改** - 从 `Procedure/ProcedureMain/RunModel.cs` 迁移枚举 - [x] `Definition/Enum/SceneType.cs` - [x] `Definition/Enum/TagCategory.cs` - [x] `Definition/Enum/TagTriggerPhase.cs` - [x] `Definition/Enum/TagType.cs` - [x] `Definition/Enum/TowerCompSlotType.cs` - [x] `Definition/Enum/UIFormType.cs` > ⚠️ 注:原 TODO 统计 25 个 Enum 文件,实际源文件 23 个。第一波新增 4 个枚举从其他层迁移:CombatSelectActionType(UI层)、RunNodeType/RunNodeStatus/RunNodeCompletionStatus(Procedure层) ### Definition/DataStruct(8 个文件) - [x] `Definition/DataStruct/AttackPayload.cs` ⚠️ **已迁移** - Vector3 → System.Numerics.Vector3 - [x] `Definition/DataStruct/HitContext.cs` ⚠️ **已迁移** - Vector3 → System.Numerics.Vector3,TargetStatusRuntime 已恢复 - [ ] `Definition/DataStruct/BackpackInventoryData.cs` - [ ] `Definition/DataStruct/BuildInfo.cs` - [ ] `Definition/DataStruct/EventItem.cs` - [ ] `Definition/DataStruct/EventOption.cs` - [ ] `Definition/DataStruct/ImpactData.cs` - [ ] `Definition/DataStruct/TowerCompItemData.cs` - [ ] `Definition/DataStruct/TowerStatsData.cs` - [ ] `Definition/DataStruct/VersionInfo.cs` ### Definition/ 其他 - [ ] `Definition/CombatParticipantTowerValidation.cs` - [ ] `Definition/CombatParticipantTowerValidationText.cs` - [ ] `Definition/InventoryRarityRuleService.cs` - [ ] `Definition/ParticipantTowerAssignResult.cs` ### Event(35 个文件) - [x] `Event/Combat/CombatBaseHpChangedEventArgs.cs` - [x] `Event/Combat/CombatCoinChangedEventArgs.cs` - [x] `Event/Combat/CombatDebugFailEventArgs.cs` - [x] `Event/Combat/CombatEndEventArgs.cs` - [x] `Event/Combat/CombatEnemyHpRateChangedEventArgs.cs` - [x] `Event/Combat/CombatFinishReturnEventArgs.cs` - [x] `Event/Combat/CombatPauseEventArgs.cs` - [x] `Event/Combat/CombatProcessEventArgs.cs` - [x] `Event/Combat/CombatSelectItemClickEventArgs.cs` ⚠️ **已修改** - 依赖迁移的枚举 - [x] `Event/EventForm/EventOptionItemSelectedEventArgs.cs` - [x] `Event/Game/NodeCompleteEventArgs.cs` ⚠️ **已修改** - 依赖迁移的枚举和数据结构 - [x] `Event/Game/NodeEnterEventArgs.cs` ⚠️ **已修改** - 依赖迁移的枚举 - [x] `Event/Game/NodeMapNodeClickEventArgs.cs` - [x] `Event/Game/NodeMapNodeEnterRequestedEventArgs.cs` ⚠️ **已修改** - 依赖迁移的枚举 - [x] `Event/Game/TestMenuNodeClickEventArgs.cs` - [x] `Event/General/RewardSelectGiveUpEventArgs.cs` - [x] `Event/General/RewardSelectItemSelectedEventArgs.cs` - [x] `Event/General/RewardSelectRefreshEventArgs.cs` - [x] `Event/MainForm/RepoButtonClickedEventArgs.cs` - [x] `Event/MainForm/ReturnButtonClickedEventArgs.cs` - [x] `Event/Menu/MenuExitRequestedEventArgs.cs` - [x] `Event/Menu/MenuSettingsRequestedEventArgs.cs` - [x] `Event/Menu/MenuStartRequestedEventArgs.cs` - [x] `Event/RepoForm/CombineSlotClickedEventArgs.cs` - [x] `Event/RepoForm/RepoCombineRequestedEventArgs.cs` - [x] `Event/RepoForm/RepoFormReturnEventArgs.cs` - [x] `Event/RepoForm/RepoItemClickedEventArgs.cs` ⚠️ **已修改** - `UnityEngine.Vector2` → `System.Numerics.Vector2` - [x] `Event/RepoForm/RepoItemDragEndedEventArgs.cs` - [x] `Event/RepoForm/RepoParticipantAssignRequestedEventArgs.cs` - [x] `Event/RepoForm/RepoSellCancelRequestedEventArgs.cs` - [x] `Event/RepoForm/RepoSellConfirmRequestedEventArgs.cs` - [x] `Event/RepoForm/RepoSellModeToggleRequestedEventArgs.cs` - [x] `Event/Shop/ShopExitRequestedEventArgs.cs` - [x] `Event/Shop/ShopInventoryRequestedEventArgs.cs` - [x] `Event/Shop/ShopPurchaseRequestedEventArgs.cs` > ⚠️ 注:以下 5 个 Event 文件在初始迁移后因跨层依赖被移除,后经修复(枚举迁移、Vector2替换)后重新加入:CombatSelectItemClickEventArgs、NodeCompleteEventArgs、NodeEnterEventArgs、NodeMapNodeEnterRequestedEventArgs、RepoItemClickedEventArgs ### UI/Base(3 个文件) - [ ] `UI/Base/IUIFormController.cs` - [ ] `UI/Base/IUIUseCase.cs` - [ ] `UI/Base/UIContext.cs` ### Definition/Tag(37 个文件) - [x] `Definition/Tag/Aggregation/TagRuntimeData.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Aggregation/TagRuntimeUtility.cs` ⚠️ **已新建** - CloneTagRuntimes 方法 - [ ] `Definition/Tag/Aggregation/TowerTagAggregationService.cs` - [x] `Definition/Tag/Combat/EnemyStatusTagRegistry.cs` ⚠️ **已迁移** - 简化版(含 FireTagEffect、IceTagEffect 注册) - [ ] `Definition/Tag/Combat/Handlers/AttackShapeTagEffectHandler.cs` - [ ] `Definition/Tag/Combat/Handlers/NumericTagEffectHandler.cs` - [x] `Definition/Tag/Combat/States/EnemyStatusTagStateBase.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Combat/States/FireTagState.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Combat/States/IceTagState.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Combat/StatusEffects/EnemyStatusTagEffectBase.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Combat/StatusEffects/FireTagEffect.cs` ⚠️ **已迁移** - Mathf → System.Math - [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` - [ ] `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 依赖 - [x] `Definition/Tag/Metadata/Config/ExecutionTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/FireTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/FreezeMaskTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/IceTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/IgniteBurstTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/InfernoTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/OverpenetrateTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/PierceTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/ShatterTagConfig.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/Config/TagConfigBase.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/TagDefinition.cs` ⚠️ **已迁移** - 无 Unity 依赖 - [x] `Definition/Tag/Metadata/TagDefinitionRegistry.cs` ⚠️ **已迁移** - 简化版(移除 DR* 依赖) ### Definition/Event(6 个文件) - [ ] `Definition/Event/EventEffect/AddGoldEffect.cs` - [ ] `Definition/Event/EventEffect/AddRandomCompsEffect.cs` - [ ] `Definition/Event/EventEffect/DamageRandomTowerEnduranceEffect.cs` - [ ] `Definition/Event/EventEffect/EventEffectBase.cs` - [ ] `Definition/Event/EventEffect/RemoveRandomCompEffect.cs` - [ ] `Definition/Event/EventOptionExecutor.cs` - [ ] `Definition/Event/EventRequirement/CompCountAtLeastRequirement.cs` - [ ] `Definition/Event/EventRequirement/EventRequirementBase.cs` - [ ] `Definition/Event/EventRequirement/GoldAtLeastRequirement.cs` - [ ] `Definition/Event/EventRequirement/HasRelicRequirement.cs` - [ ] `Definition/Event/EventRequirement/TowerCountAtLeastRequirement.cs` ### Factory(6 个文件) - [ ] `Factory/EventEffectFactory.cs` - [ ] `Factory/EventRequirementFactory.cs` - [ ] `Factory/OutGameDropItemBuilder.cs` - [ ] `Factory/PhaseEndConditionFactory.cs` - [ ] `Factory/RunStateFactory.cs` ### Network(12 个文件) - [ ] `Network/CSPacketBase.cs` - [ ] `Network/CSPacketHeader.cs` - [ ] `Network/Packet/CSHeartBeat.cs` - [ ] `Network/Packet/SCHeartBeat.cs` - [ ] `Network/PacketBase.cs` - [ ] `Network/PacketHandler/SCHeartBeatHandler.cs` - [ ] `Network/PacketHandlerBase.cs` - [ ] `Network/PacketHeaderBase.cs` - [ ] `Network/PacketType.cs` - [ ] `Network/SCPacketBase.cs` - [ ] `Network/SCPacketHeader.cs` ### UI/Context / RawData(大量文件) - [ ] `UI/DialogParams.cs` - [ ] `UI/Game/Context/CombineAreaContext.cs` - [ ] `UI/Game/Context/CompAreaContext.cs` - [ ] `UI/Game/Context/EventFormContext.cs` - [ ] `UI/Game/Context/EventOptionItemContext.cs` - [ ] `UI/Game/Context/MainFormContext.cs` - [ ] `UI/Game/Context/NodeItemContext.cs` - [ ] `UI/Game/Context/NodeMapFormContext.cs` - [ ] `UI/Game/Context/ParticipantAreaContext.cs` - [ ] `UI/Game/Context/RepoFormContext.cs` - [ ] `UI/Game/Context/RepoFormState.cs` - [ ] `UI/Game/Context/RepoItemClickActionType.cs` - [ ] `UI/Game/Context/RepoItemContext.cs` - [ ] `UI/Game/Context/SellAreaContext.cs` - [ ] `UI/Game/Context/TowerRepoItemContext.cs` - [ ] `UI/Game/RawData/EventFormRawData.cs` - [ ] `UI/Game/RawData/NodeMapFormRawData.cs` - [ ] `UI/Game/RawData/RepoFormRawData.cs` - [ ] `UI/Game/RepoParticipantAssignDialogUtility.cs` - [ ] `UI/Game/View/IRepoDragItemView.cs` - [ ] `UI/General/Context/DialogFormContext.cs` - [ ] `UI/General/Context/RewardItemContext.cs` - [ ] `UI/General/Context/RewardSelectFormContext.cs` - [ ] `UI/General/Context/TagItemContext.cs` - [ ] `UI/General/RawData/DialogFormRawData.cs` - [ ] `UI/General/RawData/ItemDescFormRawData.cs` - [ ] `UI/General/RawData/RewardSelectFormRawData.cs` - [ ] `UI/General/RawData/RewardSelectItemRawData.cs` - [ ] `UI/General/RawData/RewardSelectItemRawDataBuilder.cs` - [ ] `UI/Menu/Context/MenuFormContext.cs` - [ ] `UI/Menu/Context/TestMenuFormContext.cs` - [ ] `UI/Menu/RawData/MenuFormRawData.cs` - [ ] `UI/Shop/Context/GoodsItemContext.cs` - [ ] `UI/Shop/Context/ShopFormContext.cs` - [ ] `UI/Shop/RawData/GoodsItemRawData.cs` - [ ] `UI/Shop/RawData/ShopFormRawData.cs` - [ ] `UI/Templates/GameScene/Context/DisplayItemContext.cs` - [ ] `UI/Templates/GameScene/Context/DisplayListAreaContext.cs` - [ ] `UI/Templates/GameScene/Context/GoodsItemContext.cs` - [ ] `UI/Templates/GameScene/Context/HudFormContext.cs` - [ ] `UI/Templates/GameScene/Context/LevelUpFormContext.cs` - [ ] `UI/Templates/GameScene/Context/LevelUpRewardItemContext.cs` - [ ] `UI/Templates/GameScene/Context/ShopFormContext.cs` - [ ] `UI/Templates/GameScene/RawData/LevelUpFormRawData.cs` - [ ] `UI/Templates/GameScene/RawData/ShopFormRawData.cs` - [ ] `UI/Templates/MenuScene/Context/RoleItemContext.cs` - [ ] `UI/Templates/MenuScene/Context/RolePropertyAreaContext.cs` - [ ] `UI/Templates/MenuScene/Context/SelectRoleFormContext.cs` - [ ] `UI/Templates/MenuScene/Context/StartMenuFormContext.cs` - [ ] `UI/Templates/MenuScene/RawData/SelectRoleFormRawData.cs` - [ ] `UI/Templates/MenuScene/RawData/StartMenuFormRawData.cs` - [ ] `UI/Combat/Context/CombatFinishFormContext.cs` - [ ] `UI/Combat/Context/CombatInfoFormContext.cs` - [ ] `UI/Combat/Context/CombatSelectActionType.cs` - [ ] `UI/Combat/RawData/CombatFinishFormRawData.cs` - [ ] `UI/Combat/RawData/CombatInfoFormRawData.cs` - [ ] `UI/Combat/RawData/CombatSelectClickObjectType.cs` - [ ] `UI/Combat/RawData/CombatSelectDisplayMode.cs` ### CustomComponent 纯 C# 文件 - [ ] `Components/IDamageReceiver.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/CombatSettlementContext.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/EnemyDrop/EnemyDropContext.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/EnemyDrop/EnemyDropResult.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/ICombatSchedulerPort.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/PhaseEndConditions/IPhaseEndCondition.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/PhaseEndConditions/NonePhaseEndCondition.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/PhaseEndConditions/PhaseEndConditionContext.cs` - [ ] `CustomComponent/CombatNode/CombatScheduler/PhaseEndConditions/TimeElapsedPhaseEndCondition.cs` - [ ] `CustomComponent/CombatNode/CombatSettlementCalculator.cs` - [ ] `CustomComponent/CombatNode/CombatSettlementCommitter.cs` - [ ] `CustomComponent/CombatNode/EnemyManager/EnemyLifecycleTracker.cs` - [ ] `CustomComponent/InventoryGeneration/DropPoolRoller.cs` - [ ] `CustomComponent/InventoryGeneration/InventoryGenerationRandomContext.cs` - [ ] `CustomComponent/InventoryGeneration/RewardCandidateBuilder.cs` - [ ] `CustomComponent/PlayerInventory/PlayerInventoryStateStore.cs` - [ ] `CustomComponent/PlayerInventory/PlayerInventoryTowerRosterService.cs` - [ ] `CustomComponent/PlayerInventory/PlayerInventoryTradeService.cs` ### Scene/Pathfinding - [ ] `Scene/Pathfinding/IMapPathfinder.cs` ### Procedure 纯 C# - [ ] `Procedure/ProcedureMain/FixedRunNodeSequenceBuilder.cs` - [ ] `Procedure/ProcedureMain/ProcedureMainCombatEntryValidationResult.cs` - [ ] `Procedure/ProcedureMain/ProcedureMainCombatEntryValidationService.cs` - [ ] `Procedure/ProcedureMain/ProcedureMainNodeEventGuardService.cs` - [ ] `Procedure/ProcedureMain/ProcedureMainParticipantTowerCleanupService.cs` - [ ] `Procedure/ProcedureMain/ProcedureMainRunCompletionService.cs` - [ ] `Procedure/ProcedureMain/ProcedureMainRunFlowService.cs` - [ ] `Procedure/ProcedureMain/RunStateAdvanceService.cs` ### Entity - [ ] `Entity/EntityLogic/EnemyTagStatusRuntime.cs` ### Utility - [ ] `Utility/EnumUtility.cs` - [ ] `Utility/InventoryCloneUtility.cs` - [ ] `Utility/InventoryParticipantUtility.cs` - [ ] `Utility/InventorySeedUtility.cs` - [ ] `Utility/ItemDescUtility.cs` - [ ] `Utility/ShopPriceRuleService.cs` - [ ] `Utility/WebUtility.cs` --- ## 阶段二:L1 重构迁移(需修改后迁移) ### 策略 1:Vector3 替换 将 `UnityEngine.Vector3` 替换为 `System.Numerics.Vector3` | 文件 | 修改内容 | |------|----------| | `Definition/DataStruct/AttackPayload.cs` | `Vector3 OriginPosition` → `System.Numerics.Vector3` | | `Definition/DataStruct/HitContext.cs` | `Vector3` → `System.Numerics.Vector3` | | `Entity/EntityLogic/CombatSelectInputService.cs` | `Vector2` → `System.Numerics.Vector2` | ### 策略 2:GameEntry 静态调用替换为注入服务 | 文件 | 修改内容 | |------|----------| | `Definition/Tag/Metadata/TagDefinitionRegistry.cs` | `GameEntry.DataTable` → 注入 `IDataTableService` | | `Definition/Tag/Presentation/TagDisplayUtility.cs` | `GameEntry.DataTable` → 注入 `IDataTableService` | | `Utility/AssetUtility.cs` | `GameEntry.*` → 注入服务 | | `Utility/JsonNetUtility.cs` | `GameFramework.Utility.Json` → 注入 | ### 策略 3:DataTable 保持 L1 所有 DR* 类继承 `UnityGameFramework.Runtime.DataRowBase`,留在 L1: - [ ] `DataTable/DREnemy.cs` - [ ] `DataTable/DRLevel.cs` - [ ] `DataTable/DRLevelPhase.cs` - [ ] `DataTable/DRLevelSpawnEntry.cs` - [ ] `DataTable/DREvent.cs` - [ ] `DataTable/DREntity.cs` - [ ] `DataTable/DRBaseComp.cs` - [ ] `DataTable/DRBearingComp.cs` - [ ] `DataTable/DRMusic.cs` - [ ] `DataTable/DRMuzzleComp.cs` - [ ] `DataTable/DROutGameDropPool.cs` - [ ] `DataTable/DRRarityTagBudget.cs` - [ ] `DataTable/DRScene.cs` - [ ] `DataTable/DRShopPrice.cs` - [ ] `DataTable/DRSound.cs` - [ ] `DataTable/DRTag.cs` - [ ] `DataTable/DRTagConfig.cs` - [ ] `DataTable/DRUIForm.cs` - [ ] `DataTable/DRUISound.cs` - [ ] `DataTable/DataTableExtension.cs`(含 Vector3/Color 解析) - [ ] `DataTable/BinaryReaderExtension.cs` ### 策略 4:Tilemap 接口抽象 | 文件 | 修改内容 | |------|----------| | `Scene/Map/MapTopologyService.cs` | `Tilemap` → `ITilemap` 接口 | | `Scene/Map/TowerPlacementService.cs` | `Tilemap` → `ITilemap` 接口 | | `Scene/Map/TowerSelectionPresenter.cs` | `Vector3` → `System.Numerics.Vector3` | | `Scene/Map/MapCombatRuntimeBridge.cs` | Unity 类型 → 接口 | | `Scene/Pathfinding/GridMapPathfinder.cs` | `Vector3Int` → 自定义 struct | ### 策略 5:Constant.Layer 修复 - [ ] `Definition/Constant/Constant.Layer.cs` — `LayerMask.NameToLayer` → int 常量 ### 策略 6:Color 替换 - [ ] `Entity/EntityLogic/CombatSelectUseCaseConfigurator.cs` — `UnityEngine.Color` → 纯 C# struct - [ ] `Procedure/ProcedureMain/RunState.cs` — `UnityEngine.Color` → 纯 C# struct - [ ] `Utility/IconColorGenerator.cs` — `UnityEngine.Color` → 纯 C# struct - [ ] `Utility/TowerIconComposeUtility.cs` — `UnityEngine.Color/Sprite` → 接口 ### 策略 7:TagEffectResolver - [ ] `Definition/Tag/Combat/TagEffectResolver.cs` — `Mathf` → `System.Math` --- ## 阶段三:L2 保持 Unity 以下文件属于 L2,直接保留在 Unity 项目中,无需修改: ### Base(3 个文件) - [ ] `Base/GameEntry.cs` - [ ] `Base/GameEntry.Builtin.cs` - [ ] `Base/GameEntry.Custom.cs` ### Components(8 个文件) - [ ] `Components/BasicBaseComp.cs` - [ ] `Components/BasicBearingComp.cs` - [ ] `Components/InputComponent.cs` - [ ] `Components/MovementComponent.cs` - [ ] `Components/ShooterBullet.cs` - [ ] `Components/ShooterMuzzleComp.cs` - [ ] `Components/TowerController.cs` ### CustomComponent/*Component(10 个文件) - [ ] `CustomComponent/BuiltinDataComponent.cs` - [ ] `CustomComponent/CombatNode/CombatNodeComponent.cs` - [ ] `CustomComponent/EventNodeComponent.cs` - [ ] `CustomComponent/HPBar/HPBarComponent.cs` - [ ] `CustomComponent/InventoryGeneration/InventoryGenerationComponent.cs` - [ ] `CustomComponent/PlayerInventory/PlayerInventoryComponent.cs` - [ ] `CustomComponent/ResolutionAdapterComponent.cs` - [ ] `CustomComponent/ShopNodeComponent.cs` - [ ] `CustomComponent/SpriteCacheComponent.cs` - [ ] `CustomComponent/TagRegistry/TagRegistryComponent.cs` - [ ] `CustomComponent/UIRouterComponent.cs` ### Entity/EntityLogic(7 个文件) - [ ] `Entity/EntityLogic/EntityBase.cs` - [ ] `Entity/EntityLogic/EnemyEntity.cs` - [ ] `Entity/EntityLogic/TowerEntity.cs` - [ ] `Entity/EntityLogic/BulletEntity.cs` - [ ] `Entity/EntityLogic/Player.cs` - [ ] `Entity/EntityLogic/MapEntity.cs` - [ ] `Entity/EntityLogic/CombatSelectUseCaseConfigurator.cs` ### UI/View(大量文件) 所有继承 `UGuiForm` 的 View 类: - [ ] `UI/Combat/View/CombatFinishForm.cs` - [ ] `UI/Combat/View/CombatInfoForm.cs` - [ ] `UI/Combat/View/CombatSelectBuildArea.cs` - [ ] `UI/Combat/View/CombatSelectForm.cs` - [ ] `UI/Combat/View/CombatSelectFuncArea.cs` - [ ] `UI/Combat/View/TowerSelectItem.cs` - [ ] `UI/Game/View/CombineArea.cs` - [ ] `UI/Game/View/CombineSlotItem.cs` - [ ] `UI/Game/View/CompArea.cs` - [ ] `UI/Game/View/EventForm.cs` - [ ] `UI/Game/View/EventOptionItem.cs` - [ ] `UI/Game/View/MainForm.cs` - [ ] `UI/Game/View/NodeItem.cs` - [ ] `UI/Game/View/NodeMapForm.cs` - [ ] `UI/Game/View/ParticipantArea.cs` - [ ] `UI/Game/View/RepoForm.cs` - [ ] `UI/Game/View/RepoItem.cs` - [ ] `UI/Game/View/SellArea.cs` - [ ] `UI/Game/View/TowerRepoItem.cs` - [ ] `UI/General/View/DialogForm.cs` - [ ] `UI/General/View/IconArea.cs` - [ ] `UI/General/View/ItemDescForm.cs` - [ ] `UI/General/View/RewardItem.cs` - [ ] `UI/General/View/RewardSelectForm.cs` - [ ] `UI/General/View/TagItem.cs` - [ ] `UI/General/View/TowerIconArea.cs` - [ ] `UI/Menu/View/MenuForm.cs` - [ ] `UI/Menu/View/TestMenuForm.cs` - [ ] `UI/Shop/View/GoodsItem.cs` - [ ] `UI/Shop/View/ShopForm.cs` - [ ] `UI/Templates/GameScene/View/DisplayItem.cs` - [ ] `UI/Templates/GameScene/View/DisplayItemInfoForm.cs` - [ ] `UI/Templates/GameScene/View/DisplayItemObject.cs` - [ ] `UI/Templates/GameScene/View/DisplayListArea.cs` - [ ] `UI/Templates/GameScene/View/HudForm.cs` - [ ] `UI/Templates/GameScene/View/LevelUpForm.cs` - [ ] `UI/Templates/GameScene/View/LevelUpRewardItem.cs` - [ ] `UI/Templates/GameScene/View/ShopForm.cs` - [ ] `UI/Templates/MenuScene/View/RoleItem.cs` - [ ] `UI/Templates/MenuScene/View/RolePropertyArea.cs` - [ ] `UI/Templates/MenuScene/View/SelectRoleForm.cs` - [ ] `UI/Templates/MenuScene/View/SettingForm.cs` - [ ] `UI/Templates/MenuScene/View/StartMenuForm.cs` - [ ] `UI/HPBarItem.cs` - [ ] `UI/CommonButton.cs` - [ ] `UI/UpdateResourceForm.cs` ### UI/Controller(多个文件) - [ ] `UI/Combat/Controller/CombatFinishFormController.cs` - [ ] `UI/Combat/Controller/CombatInfoFormController.cs` - [ ] `UI/Combat/Controller/CombatSelectFormController.cs` - [ ] `UI/Game/Controller/EventFormController.cs` - [ ] `UI/Game/Controller/MainFormController.cs` - [ ] `UI/Game/Controller/NodeMapFormController.cs` - [ ] `UI/Game/Controller/RepoFormController.cs` - [ ] `UI/General/Controller/DialogFormController.cs` - [ ] `UI/General/Controller/ItemDescFormController.cs` - [ ] `UI/General/Controller/RewardSelectFormController.cs` - [ ] `UI/Menu/Controller/MenuFormController.cs` - [ ] `UI/Menu/Controller/TestMenuFormController.cs` - [ ] `UI/Shop/Controller/ShopFormController.cs` - [ ] `UI/Templates/GameScene/Controller/DisplayItemInfoFormController.cs` - [ ] `UI/Templates/GameScene/Controller/HudFormController.cs` - [ ] `UI/Templates/GameScene/Controller/LevelUpFormController.cs` - [ ] `UI/Templates/GameScene/Controller/ShopFormController.cs` - [ ] `UI/Templates/MenuScene/Controller/SelectRoleFormController.cs` - [ ] `UI/Templates/MenuScene/Controller/StartMenuFormController.cs` ### Procedure(13 个文件) - [ ] `Procedure/Base/ProcedureBase.cs` - [ ] `Procedure/Base/ProcedureChangeScene.cs` - [ ] `Procedure/Base/ProcedureCheckResources.cs` - [ ] `Procedure/Base/ProcedureCheckVersion.cs` - [ ] `Procedure/Base/ProcedureInitResources.cs` - [ ] `Procedure/Base/ProcedureLaunch.cs` - [ ] `Procedure/Base/ProcedurePreload.cs` - [ ] `Procedure/Base/ProcedureSplash.cs` - [ ] `Procedure/Base/ProcedureUpdateResources.cs` - [ ] `Procedure/Base/ProcedureUpdateVersion.cs` - [ ] `Procedure/Base/ProcedureVerifyResources.cs` - [ ] `Procedure/ProcedureMain/ProcedureMain.cs` - [ ] `Procedure/ProcedureMenu.cs` - [ ] `Procedure/ProcedureTest.cs` ### Scene(5 个文件) - [ ] `Scene/HideByBoundary.cs` - [ ] `Scene/Map/House.cs` - [ ] `Scene/Map/MapDataRefs.cs` - [ ] `Scene/Map/Spawner.cs` ### PoolObjectBase(3 个文件) - [ ] `PoolObjectBase/HPBarItemObject.cs` - [ ] `PoolObjectBase/RepoItemObject.cs` - [ ] `PoolObjectBase/TowerRepoItemObject.cs` ### Network - [ ] `Network/NetworkChannelHelper.cs` ### Editor(3 个文件) - [ ] `Editor/GameFrameworkConfigs.cs` - [ ] `Editor/GeometryTDBuildEventHandler.cs` - [ ] `Editor/SceneSwitchLeft.cs` --- ## 关键依赖链 ``` L0 迁移阻塞链: ├── TagDefinitionRegistry (L1 重构) ──→ DR* (L1) ──→ DataTableExtension (L1) ├── AttackPayload (L1 重构) ──→ TagEffectResolver (L1 重构) └── MapTopologyService (L1 重构) ──→ EntityData (L2) ``` ### 重构优先级 1. **第一波**:Definition/Enum + Event ✅ 已完成 2. **第二波**:Vector3 → System.Numerics.Vector3,Mathf → System.Math ✅ **已完成部分** 3. **第三波**:Tag 系统迁移到 L1(TagDefinitionRegistry、TagEffectResolver 等) 4. **第四波**:GameEntry 静态调用 → 接口注入 5. **第五波**:Tilemap 接口抽象 6. **第六波**:剩余 L1 文件迁移 --- ## 第一波修改记录(2026-04-30) ### 进度统计 | 类别 | 源文件数 | 已迁移 | 完成率 | |------|----------|--------|--------| | Definition/Enum | 23 | 27* | 100%+ | | Event | 35 | 35 | 100% | | **小计** | **58** | **62** | **~34% of L0** | > *注:Enum 源文件23个,第一波新增4个枚举从其他层迁移,故总计27个。L0总约180个文件。 ### 新增文件 | 文件 | 说明 | |------|------| | `Definition/Enum/CombatSelectActionType.cs` | 从 `UI/Combat/Context/` 迁移 | | `Definition/Enum/RunNodeType.cs` | 从 `Procedure/ProcedureMain/RunModel.cs` 迁移枚举 | | `Definition/Enum/RunNodeStatus.cs` | 从 `Procedure/ProcedureMain/RunModel.cs` 迁移枚举 | | `Definition/Enum/RunNodeCompletionStatus.cs` | 从 `Procedure/ProcedureMain/RunModel.cs` 迁移枚举 | | `Definition/DataStruct/RunItemState.cs` | 新建,简化版 | | `Definition/DataStruct/RunNodeCompletionSnapshot.cs` | 新建,简化版(移除了对 Unity 类型的依赖)| ### 修改文件 | 文件 | 修改内容 | |------|----------| | `Event/RepoForm/RepoItemClickedEventArgs.cs` | `UnityEngine.Vector2` → `System.Numerics.Vector2` | | `Event/Combat/CombatSelectItemClickEventArgs.cs` | `using GeometryTD.UI` → 迁移的枚举 | | `Event/Game/NodeCompleteEventArgs.cs` | 依赖迁移的枚举和数据结构 | | `Event/Game/NodeEnterEventArgs.cs` | `using GeometryTD.Procedure` → 迁移的枚举 | | `Event/Game/NodeMapNodeEnterRequestedEventArgs.cs` | `using GeometryTD.Procedure` → 迁移的枚举 | ### 命名空间统一 所有新增/修改的 Enum 文件使用 `GeometryTD.Definition` 命名空间(与原有文件保持一致) --- ## 第二波修改记录(2026-04-30) ### 进度统计 | 类别 | 源文件数 | 已迁移 | 说明 | |------|----------|--------|------| | Definition/DataStruct | 2 | 2 | AttackPayload, HitContext(Vector3 替换) | | Definition/Tag | 17 | 17 | Tag系统(TagDefinition、TagConfig系列、TagEffect系列等) | | Entity/EntityLogic | 1 | 1 | EnemyTagStatusRuntime(Mathf → System.Math) | | **小计** | **20** | **20** | - | ### 新增/迁移文件(Mathf 替换) | 文件 | 修改内容 | |------|----------| | `Entity/EntityLogic/EnemyTagStatusRuntime.cs` | Mathf → System.Math | | `Definition/Tag/Combat/StatusEffects/FireTagEffect.cs` | 新建,Mathf → System.Math | | `Definition/Tag/Combat/StatusEffects/IceTagEffect.cs` | 新建,Mathf → System.Math | | `Definition/Tag/Metadata/TagDefinitionRegistry.cs` | 简化版,移除 DR* 依赖 | ### L0 构建状态 ✅ `dotnet build GeometryTD.Domain` **成功**,0 警告 0 错误 ### 阻塞说明 1. `TagDefinitionRegistry` 简化版已可用,`DRTag`/`DRTagConfig` 依赖已移除 2. `TagGenerationRuleRegistry` 等仍有 `Debug.Assert` 待替换 --- ## 验收标准 - [x] L0 独立构建成功(`dotnet build GeometryTD.Domain`)✅ **2026-04-30** - [ ] L1 引用 L0 无循环依赖 - [ ] L2 引用 L1 无循环依赖 - [ ] 三层整体构建成功(`dotnet build Geometry-Tower-Defense-Base.sln`) - [ ] 原有游戏流程(战斗/商店/组装)在 Unity 中正常运行