Refactor GameRepository and GameManager architecture, introduce Player model, and update dependency registration in Program.cs.

This commit is contained in:
2026-02-28 23:06:54 +01:00
committed by Jonas
parent b967bd70eb
commit 0e7bfb7241
11 changed files with 96 additions and 27 deletions
+1 -1
View File
@@ -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);
}
+3 -3
View File
@@ -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
+7
View File
@@ -0,0 +1,7 @@
namespace API.Models.Game;
public class Player
{
public string Name { get; set; }
public string ConnectionId { get; set; }
}