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