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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user