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:
2026-03-21 04:19:15 +00:00
parent 656d5041b2
commit 4d28189205
2 changed files with 23 additions and 0 deletions
+15
View File
@@ -80,9 +80,24 @@ class UIManager {
handleBackToLobby() {
this.hideGameOver();
this.resetLobbyState();
this.showScreen('room');
}
resetLobbyState() {
// Reset ready button to default state
this.buttons.ready.textContent = 'READY';
this.buttons.ready.disabled = true;
// Clear player and spectator lists
this.displays.playerList.innerHTML = '';
this.displays.spectatorList.innerHTML = '';
// Reset game room name
this.displays.gameRoomName.textContent = 'GLOBAL LOBBY';
this.displays.gameRoomName.classList.remove('spectator-mode');
}
updatePlayerList(players) {
this.displays.playerList.innerHTML = '';
Object.values(players).forEach(player => {