refactor 6:

- CombatInfoFormUseCase.cs 改成回调驱动:
    - 不再直接读 GameEntry.CombatNode
    - 由 CombatLoadSession.cs 在打开 CombatInfoForm 前注入 modelProvider 和 TryEndCombat 回调
- CombatSelectFormUseCase.cs 的默认 coin provider 改成返回 0,不再偷偷 fallback 到 GameEntry.CombatNode
- CombatFinishFormUseCase.cs 去掉了未准备 summary 时对 GameEntry.CombatNode 的兜底读取
- MapData.cs 进一步补充了战斗初始快照:
    - InventorySnapshot
    - ParticipantTowerSnapshot
- CombatLoadingState.cs 现在会把这些背包/参战塔快照也一起打进 MapData
- MapEntity.cs 配置建塔面板时不再直接读 PlayerInventory,改为用 MapData 里的快照
This commit is contained in:
2026-03-07 15:22:24 +08:00
parent ca7b2f2dca
commit ab7c7172b8
7 changed files with 105 additions and 47 deletions
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using GeometryTD.Definition;
using GeometryTD.Entity.EntityData;
using GeometryTD.UI;
using UnityEngine;
namespace GeometryTD.CustomComponent
@@ -22,7 +23,7 @@ namespace GeometryTD.CustomComponent
}
MapData mapData = BuildMapData();
if (!Scheduler._loadSession.StartLoading(Scheduler._currentLevel, mapData, out string errorMessage))
if (!Scheduler._loadSession.StartLoading(Scheduler._currentLevel, mapData, Scheduler, out string errorMessage))
{
Scheduler.EnterFailureFallback($"Combat loading failed. {errorMessage}");
}
@@ -60,6 +61,12 @@ namespace GeometryTD.CustomComponent
position: Vector3.zero,
initialCoin: Scheduler._combatInRunResourceManager.CurrentCoin,
buildTowerStatsSnapshot: buildTowerStatsSnapshot,
inventorySnapshot: GameEntry.PlayerInventory != null
? GameEntry.PlayerInventory.GetInventorySnapshot()
: null,
participantTowerSnapshot: GameEntry.PlayerInventory != null
? GameEntry.PlayerInventory.GetParticipantTowerSnapshot()
: null,
tryConsumeCoin: Scheduler.TryConsumeCoin,
addCoin: Scheduler.AddCoin);
}