redraw cards

This commit is contained in:
Gavin McDonald
2025-06-12 11:53:35 -04:00
parent 5c18b8afbf
commit e75d9b41bc
6 changed files with 79 additions and 9 deletions

View File

@@ -79,6 +79,21 @@ app.prepare().then(() => {
}
});
socket.on('redraw', ({ gameID, cardIndex }: ClientUpdate) => {
try {
//console.log(Date.now(), 'Redraw', { gameID, cardIndex });
const gameUpdate = gameStore.redraw(gameID, cardIndex);
broadcast('game-update', gameUpdate);
} catch (e) {
const error = e instanceof Error ? e.message : e;
console.error(Date.now(), 'Error[redraw]', error);
socket.emit('redraw-error', error);
}
});
socket.on('settings', ({ gameID, gameData }: { gameID: string; gameData: GameUpdate }) => {
try {
const gameUpdate = gameStore.updateSettings(gameID, gameData.settings);