实现单局 Run 模型的基础落地
- 核心改动在 RunModel.cs、RunStateFactory.cs 和 RunStateAdvanceService.cs。现在项目里有了 RunNodeType / RunNodeStatus / RunNodeSeed / RunNodeState / RunState,并支持用预置节点序列创建 Run,以及在节点完成后推进、更新局内库存快照、标记通关或失败。 - 库存边界也补上了。PlayerInventoryComponent.cs 新增了 ReplaceInventorySnapshot(...),底层通过 PlayerInventoryStateStore.cs 重建工作副本,避免后续把 Run 真值硬塞回 PlayerInventory 内部状态。 - 节点事件载体已经扩展为可承载 Run 上下文,同时保留原来的无参 Create() 以兼容现有调用点。相关改动在 NodeEnterEventArgs.cs 和 NodeCompleteEventArgs.cs。 - 我还补了纯模型编辑器测试,覆盖 Run 创建、节点推进、失败标记和事件快照克隆,文件在 RunStateTests.cs。
This commit is contained in:
@@ -45,6 +45,12 @@ namespace GeometryTD.CustomComponent
|
||||
return _queryModel.GetSnapshot();
|
||||
}
|
||||
|
||||
public void ReplaceInventorySnapshot(BackpackInventoryData inventorySnapshot)
|
||||
{
|
||||
EnsureServices();
|
||||
_commandModel.ReplaceInventorySnapshot(inventorySnapshot, MaxParticipantTowerCount);
|
||||
}
|
||||
|
||||
public IReadOnlyList<TowerItemData> GetParticipantTowerSnapshot()
|
||||
{
|
||||
EnsureInitialized();
|
||||
|
||||
@@ -89,6 +89,11 @@ namespace GeometryTD.CustomComponent
|
||||
_state.IsInitialized = true;
|
||||
}
|
||||
|
||||
public void ReplaceInventorySnapshot(BackpackInventoryData sourceInventory, int maxParticipantTowerCount)
|
||||
{
|
||||
Initialize(sourceInventory, maxParticipantTowerCount);
|
||||
}
|
||||
|
||||
public PlayerInventoryMergeSummary MergeInventory(BackpackInventoryData gainedInventory)
|
||||
{
|
||||
PlayerInventoryMergeSummary summary = default;
|
||||
|
||||
Reference in New Issue
Block a user