35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
namespace Shogi.Api.Repositories.Dto.SessionState;
|
|
|
|
public class Piece
|
|
{
|
|
public bool IsPromoted { get; set; }
|
|
public WhichPiece WhichPiece { get; set; }
|
|
public WhichPlayer Owner { get; set; }
|
|
|
|
public Piece() { }
|
|
|
|
public Piece(Domain.ValueObjects.Piece piece)
|
|
{
|
|
IsPromoted = piece.IsPromoted;
|
|
WhichPiece = piece.WhichPiece switch
|
|
{
|
|
Domain.ValueObjects.WhichPiece.Bishop => WhichPiece.Bishop,
|
|
Domain.ValueObjects.WhichPiece.GoldGeneral => WhichPiece.GoldGeneral,
|
|
Domain.ValueObjects.WhichPiece.King => WhichPiece.King,
|
|
Domain.ValueObjects.WhichPiece.SilverGeneral => WhichPiece.SilverGeneral,
|
|
Domain.ValueObjects.WhichPiece.Rook => WhichPiece.Rook,
|
|
Domain.ValueObjects.WhichPiece.Knight => WhichPiece.Knight,
|
|
Domain.ValueObjects.WhichPiece.Lance => WhichPiece.Lance,
|
|
Domain.ValueObjects.WhichPiece.Pawn => WhichPiece.Pawn,
|
|
_ => throw new NotImplementedException()
|
|
};
|
|
|
|
Owner = piece.Owner switch
|
|
{
|
|
Domain.ValueObjects.WhichPlayer.Player1 => WhichPlayer.Player1,
|
|
Domain.ValueObjects.WhichPlayer.Player2 => WhichPlayer.Player2,
|
|
_ => throw new NotImplementedException()
|
|
};
|
|
}
|
|
}
|