You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cardGame/public/js/game/socket.js

28 lines
723 B
JavaScript

// Any socket request/responses for the actual game (when in a match)
function requestPassTurn(){
console.log('>> passTurn');
socket.emit('passTurn', gameData.roomId, gameData.playerId);
}
socket.on('responsePassTurn', function (data) {
console.log('<< passTurn');
// Set turn data for clients (bolds their name)
updateTurn(data.turn, data.playerTurn);
drawGameBoard();
});
// Functions like this would be elsewhere, do client-side
// validation THEN request stuff from the server?
// This is here for now, as it's used by the button
function passTurn(){
requestPassTurn();
}
// Draw Card
socket.on('responseDrawCard', function (data) {
console.log('<< drawCard');
updateCardCount(data);
drawGameBoard();
});