Private
Public Access
1
0

Implement HTML-based lobby system with player list management, host controls, and real-time updates. Add JavaScript-WASM communication for lobby state changes and game start triggers.

This commit is contained in:
Sebastian Unterschütz
2026-01-04 01:56:31 +01:00
parent 3232ee7c2f
commit 41d15c60d3
7 changed files with 209 additions and 26 deletions

View File

@@ -355,6 +355,16 @@ func (g *Game) updateLobby() {
g.gameState = game.GameState{Players: make(map[string]game.PlayerState)}
}
// Lobby State Change Detection (für HTML-Updates)
g.stateMutex.Lock()
currentPlayerCount := len(g.gameState.Players)
g.stateMutex.Unlock()
if currentPlayerCount != g.lastPlayerCount {
g.lastPlayerCount = currentPlayerCount
g.sendLobbyUpdateToJS()
}
// Spiel wurde gestartet?
if g.gameState.Status == "COUNTDOWN" || g.gameState.Status == "RUNNING" {
g.appState = StateGame