This commit is contained in:
2025-12-19 02:17:51 +00:00
parent fcfff91d99
commit 41473f3b24
2 changed files with 1 additions and 5 deletions
-1
View File
@@ -90,7 +90,6 @@ export type SnakeCursorManager = CursorManager & {
export type ScoreManager = { export type ScoreManager = {
timeValue: number; timeValue: number;
totalKeystrokes: number; totalKeystrokes: number;
finalScore: number | null;
startTimer: () => void; startTimer: () => void;
stopTimer: () => void; stopTimer: () => void;
resetTimer: () => void; resetTimer: () => void;
+1 -4
View File
@@ -8,18 +8,15 @@ export type UseScoreParams = {
currentScore: number; currentScore: number;
}; };
export function useScore({ gameStatus, keyLog, currentScore }: UseScoreParams) { export function useScore({ gameStatus, keyLog }: UseScoreParams) {
const timer = useTimer(); const timer = useTimer();
const { timeValue, startTimer, stopTimer, resetTimer } = timer; const { timeValue, startTimer, stopTimer, resetTimer } = timer;
useScoreTime({ gameStatus, timer }); useScoreTime({ gameStatus, timer });
const finalScore = gameStatus === 'game-over' || gameStatus === 'game-won' ? currentScore : null;
return { return {
timeValue, timeValue,
totalKeystrokes: keyLog.length, totalKeystrokes: keyLog.length,
finalScore,
startTimer, startTimer,
stopTimer, stopTimer,
resetTimer, resetTimer,