Better communication

This commit is contained in:
2021-02-19 20:19:11 -06:00
parent d76e4f7a8b
commit 8d79c75616
11 changed files with 156 additions and 64 deletions

View File

@@ -0,0 +1,27 @@
namespace Gameboard.ShogiUI.Sockets.Models
{
public class Move
{
public string PieceFromCaptured { get; set; }
public Coords From { get; set; }
public Coords To { get; set; }
public bool IsPromotion { get; set; }
public Move() { }
public Move(ServiceModels.Socket.Types.Move move)
{
From = Coords.FromBoardNotation(move.From);
To = Coords.FromBoardNotation(move.To);
PieceFromCaptured = move.PieceFromCaptured;
IsPromotion = move.IsPromotion;
}
public ServiceModels.Socket.Types.Move ToServiceModel() => new ServiceModels.Socket.Types.Move
{
From = From.ToBoardNotation(),
IsPromotion = IsPromotion,
PieceFromCaptured = PieceFromCaptured,
To = To.ToBoardNotation()
};
}
}