select cards
This commit is contained in:
15
server.ts
15
server.ts
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user