select cards

This commit is contained in:
Gavin McDonald
2025-06-12 18:05:17 -04:00
parent e75d9b41bc
commit 4583b06eba
11 changed files with 217 additions and 13 deletions

View File

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