mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-10-03 15:55:04 -05:00
Enhance lobby UI
This commit is contained in:
@@ -43,14 +43,15 @@ function clearReady() {
|
||||
}
|
||||
|
||||
function updatePlayerListItem(playerIndex: number) {
|
||||
const player = currentGame != null ? currentGame.players[playerIndex] : null;
|
||||
const listItem = playerListItems[playerIndex];
|
||||
if (player != null) {
|
||||
if (!currentGame?.players || playerIndex >= currentGame.players.length) {
|
||||
listItem.className = 'empty';
|
||||
listItem.innerText = 'Waiting...';
|
||||
} else {
|
||||
const player = currentGame.players[playerIndex];
|
||||
listItem.innerText = player.name;
|
||||
if (player.isReady)
|
||||
listItem.innerText += ' (Ready)';
|
||||
} else
|
||||
listItem.innerText = "Waiting...";
|
||||
listItem.className = player.isReady ? 'filled ready' : 'filled';
|
||||
}
|
||||
}
|
||||
|
||||
function updateDeckCount() {
|
||||
|
||||
@@ -109,9 +109,9 @@ function setupWebSocket(gameID: string, myPlayerIndex: number | null) {
|
||||
playerListItems.splice(0);
|
||||
for (let i = 0; i < currentGame.maxPlayers; i++) {
|
||||
var el = document.createElement('li');
|
||||
el.innerText = i < currentGame.players.length ? currentGame.players[i].name : 'Waiting...';
|
||||
playerListItems.push(el);
|
||||
playerList.appendChild(el);
|
||||
updatePlayerListItem(i);
|
||||
}
|
||||
|
||||
for (let i = 0; i < playerBars.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user