Reset lobby UI state when returning from game over
- Add resetLobbyState() to UIManager to clear player lists and reset ready button - Call resetLobbyState() when player-joined event has null player (game over reset) - Reset ready button state in endGame() before showing game over screen Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,10 @@ function setupNetworkListeners() {
|
||||
if (ui.screens.room.classList.contains('active')) {
|
||||
ui.showScreen('lobby');
|
||||
}
|
||||
// Reset lobby state when returning from game over (player is null indicates game over reset)
|
||||
if (!player) {
|
||||
ui.resetLobbyState();
|
||||
}
|
||||
});
|
||||
|
||||
// Player left lobby
|
||||
@@ -225,6 +229,10 @@ function endGame(states) {
|
||||
network.isSpectator = false;
|
||||
ui.hideSpectatorMode();
|
||||
|
||||
// Reset ready button state
|
||||
ui.buttons.ready.textContent = 'READY';
|
||||
ui.buttons.ready.disabled = true;
|
||||
|
||||
ui.showGameOver(winner, scores);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user