Support player names and online join flow

Move SignalR group join into GameManager and add support for player names and improved online join flow.

- Moved Groups.AddToGroupAsync call out of GameHubSocket into GameManager (hubContext.Groups.AddToGroupAsync) so group membership is handled when adding players to a game.
- GUI: added player name input to GameJoinMenu and updated JoinGameObject to include playerName and use string gameCode.
- OnlineMode & LocalMode: constructors updated to instantiate games without passing settings; removed WaitingForOpponent state and cleaned up event bindings.
- OnlineGame: rewrote to handle onGameCreated/onGameJoined/onGameStarted/onFieldUpdated/onGameEnded/onError, added joinGame validation (expects 6-digit code), join flow (connect + join), state updates, drop forwarding to player.drop(gameId, index) and place description updates.
- LocalGame: constructor signature simplified to no-arg.

These changes centralize group management, add player identification, validate join codes, and improve game state/event handling for online play.
This commit is contained in:
2026-03-08 21:45:05 +01:00
committed by Jonas
parent acae815a2a
commit 4826760d73
8 changed files with 100 additions and 17 deletions
-2
View File
@@ -42,8 +42,6 @@ public class GameHubSocket(IGameManager gameManager) : Hub
return;
}
await Groups.AddToGroupAsync(Context.ConnectionId, result);
await Clients.Caller.SendAsync("GameJoined", new
{
GameId = result,