Custom names and time in chat
This commit is contained in:
@@ -2,17 +2,17 @@
|
||||
|
||||
public class GameState
|
||||
{
|
||||
public string PlayerName { get; set; }
|
||||
public PlayerDTO Me { get; set; }
|
||||
public string CurrentState { get; set; }
|
||||
public List<string> Hand { get; set; } = new();
|
||||
public string CurrentCard { get; set; }
|
||||
public string CurrentPlayer { get; set; }
|
||||
public List<string> Players { get; set; } = new();
|
||||
public PlayerDTO CurrentPlayer { get; set; }
|
||||
public List<PlayerDTO> Players { get; set; } = new();
|
||||
|
||||
public GameState(Game game, string playerId)
|
||||
{
|
||||
var p = game.GetPlayer(playerId);
|
||||
PlayerName = p.Connection.ConnectionId;
|
||||
Me = new PlayerDTO(game.GetPlayer(playerId));
|
||||
CurrentState = p.State.ToString();
|
||||
foreach (var card in p.Hand)
|
||||
{
|
||||
@@ -21,10 +21,22 @@ public class GameState
|
||||
|
||||
foreach (var player in game.Players)
|
||||
{
|
||||
Players.Add(player.Connection.ConnectionId);
|
||||
Players.Add(new PlayerDTO(player));
|
||||
}
|
||||
|
||||
CurrentCard = game.CurrentCard.ToString();
|
||||
CurrentPlayer = game.CurrentPlayer.Connection.ConnectionId;
|
||||
CurrentPlayer = new PlayerDTO(game.CurrentPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerDTO
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
|
||||
public PlayerDTO(Player player)
|
||||
{
|
||||
Name = player.Connection.Name;
|
||||
Id = player.Connection.ConnectionId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user