added dictionary

This commit is contained in:
Ben Kyd
2021-04-12 21:12:52 +01:00
parent 89d546343f
commit 7554e93ec8
5 changed files with 279531 additions and 5 deletions

View File

@@ -0,0 +1,8 @@
let ActiveGames = [];

View File

@@ -62,8 +62,16 @@ async function Router(socket)
socket.on('lobby-user-ready', args => LobbyUserReady(socket, args));
socket.on('lobby-user-unready', args => LobbyUserUnReady(socket, args));
// game functions
// socket will emit game begin with play order and starting tiles
// once all clients have connected with identify
socket.on('lobby-game-begin', args => LobbyGameBegin(socket, args));
socket.on('disconnect', args => HandleDisconnect(socket, ...args));
}
@@ -118,6 +126,15 @@ function ClientIdentify(socket, args)
}
Game.Lobbies.UserConnectGame(user.uid);
// If this user was the last player in the lobby to connect
// start the game
if (Game.Lobbies.IsLobbyReadyForGame(lobby.uid))
{
}
}
@@ -266,7 +283,7 @@ function LobbyJoin(socket, args)
if (args.joinAsSpectator)
{
// TODO
// TODO: this lol
} else
{
const status = Game.Lobbies.UserJoinLobby(lobby.uid, useruid, LobbyUpdateCallback);