UI adjustments

This commit is contained in:
Andrio Celos
2022-10-11 00:43:14 +11:00
parent 42074825b6
commit bd3604c83c
3 changed files with 45 additions and 22 deletions

View File

@@ -33,6 +33,7 @@ function onGameStateChange(game: any, playerData: any) {
switch (game.state) {
case GameState.WaitingForPlayers:
showSection('lobby');
document.getElementById('lobbyStageSection')!.hidden = !playerData || game.players[playerData.playerIndex]?.isReady;
break;
case GameState.Preparing:
showSection('deck');
@@ -154,6 +155,10 @@ function setupWebSocket(gameID: string, myPlayerIndex: number | null) {
currentGame.players[payload.data.playerIndex].isReady = true;
updatePlayerListItem(payload.data.playerIndex);
if (payload.data.playerIndex == currentGame.me?.playerIndex) {
document.getElementById('lobbyStageSection')!.hidden = true;
}
if (playContainers[payload.data.playerIndex].getElementsByTagName('div').length == 0) {
showReady(payload.data.playerIndex);
}