tracking of players accross session using id in storage, create game button for the host that is disabled until lobby is full. synchronized lobby state.

This commit is contained in:
Alec Maier
2019-08-30 20:37:11 -04:00
parent 385c5d4e79
commit f873540171
6 changed files with 92 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ io.on('connection', function(socket) {
onSucess();
});
socket.on('joinGame', function(playerInfo) {
activeGames[Object.keys(activeGames).find((key) => key === playerInfo.code)].players[socket.id] = playerInfo.name;
activeGames[Object.keys(activeGames).find((key) => key === playerInfo.code)].players[socket.id] = {name: playerInfo.name, id: playerInfo.id};
});
socket.on('requestState', function(data) {
if(Object.keys(socket.rooms).includes(data.code) === false) {