MapData + Event 解耦已完成一轮收口
- `MapData` 已收口为纯初始化快照,不再承载 coin 写接口委托 - 已新增 `MapEntityLoadContext` - 用于把 `MapData` 快照与 coin 命令通道拆开传给地图加载 - `CombatLoadingState` 现在会组装: - `MapData` - `MapEntityLoadContext` - `CombatLoadSession` / `EntityExtension.ShowMap(...)` 已切到 `MapEntityLoadContext` - `MapEntity` 当前通过: - `MapEntityLoadContext` 获取初始快照与 coin 命令通道 - `CombatCoinChangedEventArgs` 同步后续 coin 变化 - 已新增 `MapCombatRuntimeBridge` - 收口地图侧 coin 当前值、命令调用与事件订阅 - `MapEntity` 不再自己维护 `_currentCoin` 和 coin 事件订阅样板
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ namespace GeometryTD.CustomComponent
|
||||
Context.SettlementFlowService.OpenCombatFinishForm(
|
||||
Context.SettlementContext,
|
||||
Context.CombatFinishFormUseCase);
|
||||
Flow.Scheduler.ChangeState(new CombatWaitingForReturnState(Context, Flow));
|
||||
Flow.ChangeState(new CombatWaitingForReturnState(Context, Flow));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ namespace GeometryTD.CustomComponent
|
||||
}
|
||||
|
||||
MapEntityLoadContext mapLoadContext = BuildMapLoadContext();
|
||||
if (!Context.LoadSession.StartLoading(Context.CurrentLevel, mapLoadContext, Flow.Scheduler, out string errorMessage))
|
||||
if (!Context.LoadSession.StartLoading(Context.CurrentLevel, mapLoadContext, Flow.Host, out string errorMessage))
|
||||
{
|
||||
Flow.EnterFailureFallback($"Combat loading failed. {errorMessage}");
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace GeometryTD.CustomComponent
|
||||
participantTowerSnapshot: GameEntry.PlayerInventory != null
|
||||
? GameEntry.PlayerInventory.GetParticipantTowerSnapshot()
|
||||
: null);
|
||||
return new MapEntityLoadContext(mapData, Flow.Scheduler.TryConsumeCoin, Flow.Scheduler.AddCoin);
|
||||
return new MapEntityLoadContext(mapData, Flow.TryConsumeCoin, Flow.AddCoin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ namespace GeometryTD.CustomComponent
|
||||
Flow.OnFullBaseHpRewardSelected,
|
||||
Flow.OnFullBaseHpRewardGiveUp))
|
||||
{
|
||||
Flow.Scheduler.ChangeState(new CombatFinishFormState(Context, Flow));
|
||||
Flow.ChangeState(new CombatFinishFormState(Context, Flow));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ namespace GeometryTD.CustomComponent
|
||||
|
||||
if (Flow.ShouldEnterSettlementFromActiveState(out string reason, out bool isVictory))
|
||||
{
|
||||
Flow.Scheduler.ChangeState(new CombatSettlementState(Context, Flow, reason, isVictory));
|
||||
Flow.ChangeState(new CombatSettlementState(Context, Flow, reason, isVictory));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -26,13 +26,13 @@ namespace GeometryTD.CustomComponent
|
||||
Context.CurrentLevel,
|
||||
Context.EnemyManager.DefeatedEnemyCount,
|
||||
Context.CombatInRunResourceManager);
|
||||
if (Context.SettlementContext.ShouldOpenRewardSelection)
|
||||
if (Context.SettlementContext.Flow.ShouldOpenRewardSelection)
|
||||
{
|
||||
Flow.Scheduler.ChangeState(new CombatRewardSelectionState(Context, Flow));
|
||||
Flow.ChangeState(new CombatRewardSelectionState(Context, Flow));
|
||||
return;
|
||||
}
|
||||
|
||||
Flow.Scheduler.ChangeState(new CombatFinishFormState(Context, Flow));
|
||||
Flow.ChangeState(new CombatFinishFormState(Context, Flow));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ namespace GeometryTD.CustomComponent
|
||||
|
||||
if (Flow.ShouldEnterSettlementFromActiveState(out string reason, out bool isVictory))
|
||||
{
|
||||
Flow.Scheduler.ChangeState(new CombatSettlementState(Context, Flow, reason, isVictory));
|
||||
Flow.ChangeState(new CombatSettlementState(Context, Flow, reason, isVictory));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,4 +43,4 @@ namespace GeometryTD.CustomComponent
|
||||
Flow.CompleteCurrentPhase();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user