- @switch (Piece?.WhichPiece)
+
+ @switch (Piece)
{
case WhichPiece.Bishop:
@@ -31,18 +31,18 @@
@*render nothing*@
break;
}
+ @if (Count > 0)
+ {
+ @Count
+ }
@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",
diff --git a/Shogi.UI/Pages/Play/GamePiece.razor.css b/Shogi.UI/Pages/Play/GamePiece.razor.css
index 1d814cb..fc28434 100644
--- a/Shogi.UI/Pages/Play/GamePiece.razor.css
+++ b/Shogi.UI/Pages/Play/GamePiece.razor.css
@@ -3,9 +3,23 @@
height: auto;
}
-[data-upsidedown] {
- transform: rotateZ(180deg);
-}
.game-piece {
overflow: hidden; /* Because SVGs have weird sizes. */
+ position: relative;
+}
+
+.game-piece .counter {
+ display: grid;
+ place-content: center;
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding: 2px;
+ z-index: 100;
+ background-color: white;
+ border-radius: 9px;
+ border: 1px solid #444;
+ aspect-ratio: 1 / 1;
+ width: 15px;
+ height: 15px;
}
\ No newline at end of file