Add game restart and disconnect support

Prevent handling disconnects for games already ended; add a disconnect() method on the SignalR connection and a LocalGame.disconnectAll() helper. Update GameEndedMenu to emit a restart event and adjust displayed messages/labels. Wire a restart() handler in LocalMode that disconnects all players then restarts the game.
This commit is contained in:
Jonas
2026-03-08 12:47:21 +01:00
parent 919bb71f19
commit bb3c482728
5 changed files with 27 additions and 8 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ public class GameManager(IGameRepository gameRepository, IHubContext<GameHubSock
public Task DisconnectedPlayer(string playerConnectionId)
{
var game = gameRepository.GetOneByConnectionId(playerConnectionId);
if (game == null)
if (game == null || game.State == GameState.Ended)
return Task.CompletedTask;
var player = game.GetPlayerByConnectionId(playerConnectionId);