diff --git a/apps/client/src/scenes/game/GameManager.ts b/apps/client/src/scenes/game/GameManager.ts index e1e8da3..c027f53 100644 --- a/apps/client/src/scenes/game/GameManager.ts +++ b/apps/client/src/scenes/game/GameManager.ts @@ -9,9 +9,7 @@ import { GameSessionFacade } from "./application/lifecycle/GameSessionFacade"; import { CombatLifecycleFacade } from "./application/combat/CombatLifecycleFacade"; import { DisposableRegistry } from "./application/lifecycle/DisposableRegistry"; -import { - type GameSceneFactoryOptions, -} from "./application/orchestrators/GameSceneOrchestrator"; +import { type GameSceneFactoryOptions } from "./application/orchestrators/GameSceneOrchestrator"; import { GameSceneRuntime } from "./application/runtime/GameSceneRuntime"; import { GameManagerBootstrapper } from "./application/runtime/GameManagerBootstrapper"; import { @@ -91,8 +89,10 @@ this.container = container; // 明示的に代入 this.myId = myId; this.sessionFacade = dependencies.sessionFacade ?? new GameSessionFacade(); - this.lifecycleState = dependencies.lifecycleState ?? new SceneLifecycleState(); - const gameActionSender = dependencies.gameActionSender ?? new SocketGameActionSender(); + this.lifecycleState = + dependencies.lifecycleState ?? new SceneLifecycleState(); + const gameActionSender = + dependencies.gameActionSender ?? new SocketGameActionSender(); const moveSender = dependencies.moveSender ?? new SocketPlayerMoveSender(); const sceneFactories = dependencies.sceneFactories; this.app = new Application(); @@ -123,7 +123,9 @@ moveSender, getElapsedMs: () => this.sessionFacade.getElapsedMs(), eventPorts: { - onGameStarted: this.gameEventFacade.applyGameStarted.bind(this.gameEventFacade), + onGameStarted: this.gameEventFacade.applyGameStarted.bind( + this.gameEventFacade, + ), onGameEnded: this.lockInput.bind(this), onRemoteBombPlaced: (payload) => { this.gameEventFacade.applyRemoteBombPlaced(payload); @@ -157,14 +159,14 @@ this.combatFacade.dispose(); }); this.disposableRegistry.add(() => { - this.runtime.destroy(); - }); - this.disposableRegistry.add(() => { if (this.lifecycleState.shouldDestroyApp()) { this.app.destroy(true, { children: true }); } }); this.disposableRegistry.add(() => { + this.runtime.destroy(); + }); + this.disposableRegistry.add(() => { this.uiStateSyncService.stopTicker(); }); } diff --git a/apps/client/src/scenes/result/ResultScene.tsx b/apps/client/src/scenes/result/ResultScene.tsx index 67873ce..0d4c1fe 100644 --- a/apps/client/src/scenes/result/ResultScene.tsx +++ b/apps/client/src/scenes/result/ResultScene.tsx @@ -13,9 +13,7 @@ onBackToTitle: () => void; }; -type GameResultWithFinalMap = GameResultPayload & { - finalGridColors?: number[]; -}; +type ResultViewMode = "mapPreview" | "ranking"; const formatPaintRate = (value: number): string => `${value.toFixed(1)}%`; @@ -239,10 +237,11 @@ /** 最終結果データを受け取り,順位一覧を表示する */ export const ResultScene = ({ result, onBackToTitle }: Props) => { - const [isRankingVisible, setIsRankingVisible] = useState(false); + const [viewMode, setViewMode] = useState("mapPreview"); + const isRankingVisible = viewMode === "ranking"; useEffect(() => { - setIsRankingVisible(false); + setViewMode("mapPreview"); }, [result]); if (!result) { @@ -256,12 +255,11 @@ result.rankings[0]?.teamId; const winnerColor = config.GAME_CONFIG.TEAM_COLORS[winnerTeamId ?? -1] ?? "#888888"; - const resultWithFinalMap = result as GameResultWithFinalMap; const gridCols = config.GAME_CONFIG.GRID_COLS; const gridRows = config.GAME_CONFIG.GRID_ROWS; const totalCells = gridCols * gridRows; const finalGridColors = Array.from({ length: totalCells }, (_, index) => { - const teamId = resultWithFinalMap.finalGridColors?.[index]; + const teamId = result.finalGridColors?.[index]; return typeof teamId === "number" ? teamId : -1; }); @@ -276,7 +274,7 @@ return; } - setIsRankingVisible(true); + setViewMode("ranking"); }} >