{/* タイマーUIの表示 */}
+ {startCountdownText && (
+
{startCountdownText}
+ )}
+
{/* PixiJS Canvas 配置領域 */}
{/* 入力UI レイヤー */}
-
+
);
};
diff --git a/apps/client/src/scenes/game/application/GameTimer.ts b/apps/client/src/scenes/game/application/GameTimer.ts
index 7a63c81..b31d726 100644
--- a/apps/client/src/scenes/game/application/GameTimer.ts
+++ b/apps/client/src/scenes/game/application/GameTimer.ts
@@ -21,11 +21,37 @@
this.gameStartTime = startTime;
}
+ public getStartTime(): number | null {
+ return this.gameStartTime;
+ }
+
+ public isStarted(): boolean {
+ if (!this.gameStartTime) {
+ return false;
+ }
+
+ return this.nowMsProvider() >= this.gameStartTime;
+ }
+
+ public getPreStartRemainingSec(): number {
+ if (!this.gameStartTime) {
+ return 0;
+ }
+
+ const remainingMs = this.gameStartTime - this.nowMsProvider();
+ if (remainingMs <= 0) {
+ return 0;
+ }
+
+ return Math.ceil(remainingMs / 1000);
+ }
+
public getRemainingTime(): number {
if (!this.gameStartTime) return config.GAME_CONFIG.GAME_DURATION_SEC;
const elapsedMs = this.nowMsProvider() - this.gameStartTime;
- const remainingSec = config.GAME_CONFIG.GAME_DURATION_SEC - elapsedMs / 1000;
+ const remainingSec =
+ config.GAME_CONFIG.GAME_DURATION_SEC - elapsedMs / 1000;
return Math.max(0, remainingSec);
}
diff --git a/apps/client/src/scenes/game/hooks/useGameSceneController.ts b/apps/client/src/scenes/game/hooks/useGameSceneController.ts
index bc060f1..f2ddb49 100644
--- a/apps/client/src/scenes/game/hooks/useGameSceneController.ts
+++ b/apps/client/src/scenes/game/hooks/useGameSceneController.ts
@@ -14,7 +14,8 @@
return `${mins}:${secs.toString().padStart(2, "0")}`;
};
-const getInitialTimeDisplay = () => formatRemainingTime(config.GAME_CONFIG.GAME_DURATION_SEC);
+const getInitialTimeDisplay = () =>
+ formatRemainingTime(config.GAME_CONFIG.GAME_DURATION_SEC);
/** ゲーム画面の状態と入力ハンドラを提供するフック */
export const useGameSceneController = (myId: string | null) => {
@@ -22,6 +23,9 @@
const gameManagerRef = useRef