Return game ID+code; update hub and Player model

Change GameManager/CreateGame to return (gameId, gameCode) and Make JoinGame return the game Id (or null) instead of a bool. Update IGameManager signature accordingly. Refactor Hub methods to construct Player objects, accept Coordinates for game creation, use the manager results to add connections to groups and send GameCreated with GameId and GameCode, and handle join failures with an error message. Simplify Player class to use a primary-constructor style with property initialization; add necessary using directives.
This commit is contained in:
Jonas
2026-03-01 20:43:18 +01:00
parent ce52d1462f
commit 85521f3b23
4 changed files with 41 additions and 16 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
namespace API.Models.Game;
public class Player
public class Player(string name, string connectionId)
{
public string Name { get; set; }
public string ConnectionId { get; set; }
public string Name { get; set; } = name;
public string ConnectionId { get; set; } = connectionId;
}