(tic-tac-toe): Starting work to implement "New Game" button

This commit is contained in:
apetitco 2026-01-07 22:28:39 +01:00 committed by Maix0
parent fc9e10f286
commit ca9b2a7320
5 changed files with 31 additions and 3 deletions

View file

@ -28,6 +28,7 @@ export interface ClientToServer {
gameMove: (up: GameMove) => void;
keepalive: () => void;
connectedToGame: (gameId: string) => void;
requestNewGame: () => void;
};
export interface ServerToClient {

View file

@ -48,6 +48,8 @@ export class StateI {
socket.on('enqueue', () => this.enqueueUser(socket));
socket.on('dequeue', () => this.dequeueUser(socket));
socket.on('debugInfo', () => this.debugSocket(socket));
// TODO
socket.on('requestNewGame', () => this.requestNewGame(socket));
socket.on('gameMove', (e) => this.gameMove(socket, e));
socket.on('keepalive', () => this.keepAlive(socket));
@ -202,6 +204,13 @@ export class StateI {
game?.makeMove(socket.authUser.id, update.index);
}
// TODO
private requestNewGame(socket: SSocket) {
void socket;
// TODO
this.fastify.log.info('===== NEW GAME REQUESTED =====');
}
}
// this value will be overriten