checkpoint
This commit is contained in:
@@ -10,13 +10,14 @@ namespace Gameboard.ShogiUI.Sockets.Models
|
||||
// TODO: Separate subscriptions to the Session from the Session.
|
||||
[JsonIgnore] public ConcurrentDictionary<string, WebSocket> Subscriptions { get; }
|
||||
public string Name { get; }
|
||||
public string Player1 { get; }
|
||||
public string? Player2 { get; private set; }
|
||||
public User Player1 { get; }
|
||||
public User? Player2 { get; private set; }
|
||||
public bool IsPrivate { get; }
|
||||
|
||||
// TODO: Don't retain the entire rules system within the Session model. It just needs the board state after rules are applied.
|
||||
public Shogi Shogi { get; }
|
||||
|
||||
public Session(string name, bool isPrivate, Shogi shogi, string player1, string? player2 = null)
|
||||
public Session(string name, bool isPrivate, Shogi shogi, User player1, User? player2 = null)
|
||||
{
|
||||
Subscriptions = new ConcurrentDictionary<string, WebSocket>();
|
||||
|
||||
@@ -27,11 +28,11 @@ namespace Gameboard.ShogiUI.Sockets.Models
|
||||
Shogi = shogi;
|
||||
}
|
||||
|
||||
public void SetPlayer2(string userName)
|
||||
public void SetPlayer2(User user)
|
||||
{
|
||||
Player2 = userName;
|
||||
Player2 = user;
|
||||
}
|
||||
|
||||
public Game ToServiceModel() => new() { GameName = Name, Player1 = Player1, Player2 = Player2 };
|
||||
public Game ToServiceModel() => new() { GameName = Name, Player1 = Player1.DisplayName, Player2 = Player2?.DisplayName };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user