- Add gameOverCondition to GameManager for runtime tracking - Create enrichGameInfo() function to merge runtime condition with static gameInfo - Add formatGameOverCondition() utility to stringify boolean/function conditions - Returns enriched info with: - condition: formatted string representation - type: 'none' | 'static' | 'function' - Platform can call enrichGameInfo(gameManager) to get complete game configuration - Handles all condition types: undefined, boolean, function - Truncates long function strings at 200 chars
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import type { RefObject } from 'react';
|
|
import type { CursorManager, HeroManager, HeroRenderManager } from './useCursor/types';
|
|
import type { GameStatusManager } from './useGameStatus/types';
|
|
import type { ScoreManager } from './useScore/types';
|
|
|
|
export * from './useBoard/types';
|
|
export * from './useCursor/types';
|
|
export * from './useGameStatus/types';
|
|
export * from './useScore/types';
|
|
|
|
export type GameOptions = {
|
|
rows: number;
|
|
cols: number;
|
|
gameOver?: boolean | ((scoreManager: ScoreManager) => boolean);
|
|
};
|
|
|
|
export type KeyLogEntry = { key: string; timestamp: number };
|
|
|
|
export type GameKeyManager = {
|
|
keyLog: KeyLogEntry[];
|
|
clearKeyLog: () => void;
|
|
getKeyLog: () => KeyLogEntry[];
|
|
};
|
|
|
|
export type GameManager = {
|
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
renderBoard: () => void;
|
|
cursor: CursorManager;
|
|
hero: HeroManager;
|
|
renderer: HeroRenderManager;
|
|
scoreManager: ScoreManager;
|
|
gameOverCondition?: boolean | ((scoreManager: ScoreManager) => boolean);
|
|
} & GameStatusManager & GameKeyManager;
|