Refactor GameRepository and GameManager architecture, introduce Player model, and update dependency registration in Program.cs.
This commit is contained in:
@@ -13,7 +13,7 @@ public class Game(Coordinates gFs, SixDigitInt gameCode)
|
||||
{
|
||||
public string Id { get; init; } = Guid.NewGuid().ToString();
|
||||
public SixDigitInt GameCode { get; } = gameCode;
|
||||
public string?[] PlayerConnectionIds { get; set; } = new string?[2];
|
||||
public Player?[] PlayerConnectionIds { get; set; } = new Player?[2];
|
||||
public GameState State { get; private set; } = GameState.Lobby;
|
||||
public GameField Field { get; } = new(gFs);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
namespace API.Models.Game;
|
||||
|
||||
public class Coordinates
|
||||
public readonly struct Coordinates(int x, int y)
|
||||
{
|
||||
public int X;
|
||||
public int Y;
|
||||
public readonly int X = x;
|
||||
public readonly int Y = y;
|
||||
}
|
||||
|
||||
public enum PlaceResult
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace API.Models.Game;
|
||||
|
||||
public class Player
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string ConnectionId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user