Before changing Piece[,] to Dictionary<string,Piece>

This commit is contained in:
2021-07-26 06:28:56 -05:00
parent f8f779e84c
commit 178cb00253
73 changed files with 1537 additions and 1418 deletions

View File

@@ -8,5 +8,7 @@ namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types
public Piece[,] Board { get; set; } = new Piece[0, 0];
public IReadOnlyCollection<Piece> Player1Hand { get; set; } = Array.Empty<Piece>();
public IReadOnlyCollection<Piece> Player2Hand { get; set; } = Array.Empty<Piece>();
public WhichPlayer? PlayerInCheck { get; set; }
public WhichPlayer WhoseTurn { get; set; }
}
}

View File

@@ -1,14 +1,33 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
namespace Gameboard.ShogiUI.Sockets.ServiceModels.Socket.Types
{
public class Game
{
public string Player1 { get; set; } = string.Empty;
public string? Player2 { get; set; } = string.Empty;
public string GameName { get; set; } = string.Empty;
/// <summary>
/// Players[0] is the session owner, Players[1] is the other guy
/// Players[0] is the session owner, Players[1] is the other person.
/// </summary>
public IReadOnlyList<string> Players { get; set; } = Array.Empty<string>();
public IReadOnlyList<string> Players
{
get
{
var list = new List<string>(2) { Player1 };
if (!string.IsNullOrEmpty(Player2)) list.Add(Player2);
return list;
}
}
public Game()
{
}
public Game(string gameName, string player1, string? player2 = null)
{
GameName = gameName;
Player1 = player1;
Player2 = player2;
}
}
}