Group pieces in the hand.

This commit is contained in:
2024-11-26 15:26:47 -06:00
parent 1ed1ad09af
commit 83dd4cc4a3
4 changed files with 62 additions and 21 deletions

View File

@@ -1,7 +1,7 @@
@using Shogi.Contracts.Types
<div class="game-piece" title="@HtmlTitle" data-upsidedown="@(Piece?.Owner != Perspective)" data-owner="@Piece?.Owner.ToString()">
@switch (Piece?.WhichPiece)
<div class="game-piece" title="@HtmlTitle">
@switch (Piece)
{
case WhichPiece.Bishop:
<Bishop IsPromoted="@IsPromoted" />
@@ -31,18 +31,18 @@
@*render nothing*@
break;
}
@if (Count > 0)
{
<span class="counter">@Count</span>
}
</div>
@code {
[Parameter]
public Contracts.Types.Piece? Piece { get; set; }
[Parameter] public WhichPiece? Piece { get; set; }
[Parameter] public bool IsPromoted { get; set; }
[Parameter] public int Count { get; set; }
[Parameter]
public WhichPlayer Perspective { get; set; }
private bool IsPromoted => Piece != null && Piece.IsPromoted;
private string HtmlTitle => Piece?.WhichPiece switch
private string HtmlTitle => Piece switch
{
WhichPiece.Bishop => "Bishop",
WhichPiece.GoldGeneral => "Gold General",