63 lines
1.3 KiB
Plaintext
63 lines
1.3 KiB
Plaintext
@using Shogi.Contracts.Types
|
|
|
|
<div class="game-piece" title="@HtmlTitle" data-upsidedown="@RenderUpsideDown">
|
|
@switch (Piece)
|
|
{
|
|
|
|
case WhichPiece.Bishop:
|
|
<Bishop IsPromoted="@IsPromoted" />
|
|
break;
|
|
|
|
case WhichPiece.GoldGeneral:
|
|
<GoldGeneral />
|
|
break;
|
|
|
|
case WhichPiece.King:
|
|
<ChallengingKing />
|
|
break;
|
|
|
|
case WhichPiece.Knight:
|
|
<Knight IsPromoted="@IsPromoted" />
|
|
break;
|
|
|
|
case WhichPiece.Lance:
|
|
<Lance IsPromoted="@IsPromoted" />
|
|
break;
|
|
|
|
case WhichPiece.Pawn:
|
|
<Pawn IsPromoted="@IsPromoted" />
|
|
break;
|
|
|
|
case WhichPiece.Rook:
|
|
<Rook IsPromoted="@IsPromoted" />
|
|
break;
|
|
|
|
case WhichPiece.SilverGeneral:
|
|
<SilverGeneral IsPromoted="@IsPromoted" />
|
|
break;
|
|
|
|
default:
|
|
@*render nothing*@
|
|
break;
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter][EditorRequired] public WhichPiece? Piece { get; set; }
|
|
[Parameter] public bool IsPromoted { get; set; } = false;
|
|
[Parameter] public bool RenderUpsideDown { get; set; }
|
|
|
|
private string HtmlTitle => this.Piece switch
|
|
{
|
|
WhichPiece.Bishop => "Bishop",
|
|
WhichPiece.GoldGeneral => "Gold General",
|
|
WhichPiece.King => "King",
|
|
WhichPiece.Knight => "Knight",
|
|
WhichPiece.Lance => "Lance",
|
|
WhichPiece.Pawn => "Pawn",
|
|
WhichPiece.Rook => "Rook",
|
|
WhichPiece.SilverGeneral => "Silver General",
|
|
_ => string.Empty
|
|
};
|
|
}
|