36 lines
934 B
C#
36 lines
934 B
C#
namespace Gameboard.ShogiUI.Sockets.Models
|
|
{
|
|
/// <summary>
|
|
/// A representation of a Session without the board and game-rules.
|
|
/// </summary>
|
|
public class SessionMetadata
|
|
{
|
|
public string Name { get; }
|
|
public string Player1 { get; }
|
|
public string? Player2 { get; private set; }
|
|
public bool IsPrivate { get; }
|
|
|
|
public SessionMetadata(string name, bool isPrivate, string player1, string? player2 = null)
|
|
{
|
|
Name = name;
|
|
IsPrivate = isPrivate;
|
|
Player1 = player1;
|
|
Player2 = player2;
|
|
}
|
|
public SessionMetadata(Session sessionModel)
|
|
{
|
|
Name = sessionModel.Name;
|
|
IsPrivate = sessionModel.IsPrivate;
|
|
Player1 = sessionModel.Player1;
|
|
Player2 = sessionModel.Player2;
|
|
}
|
|
|
|
public void SetPlayer2(string playerName)
|
|
{
|
|
Player2 = playerName;
|
|
}
|
|
|
|
public ServiceModels.Types.Game ToServiceModel() => new(Name, Player1, Player2);
|
|
}
|
|
}
|