checkpoint

This commit is contained in:
2024-11-16 12:37:56 -06:00
parent 13e79eb490
commit 460dfd608e
10 changed files with 139 additions and 49 deletions

View File

@@ -1,32 +1,41 @@
@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" 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;
@@ -34,15 +43,11 @@
</div>
@code {
[Parameter]
public Contracts.Types.Piece? Piece { get; set; }
[Parameter][EditorRequired] public WhichPiece? Piece { get; set; }
[Parameter] public bool IsPromoted { get; set; } = false;
[Parameter] public bool RenderUpsideDown { get; set; }
[Parameter]
public WhichPlayer Perspective { get; set; }
private bool IsPromoted => Piece != null && Piece.IsPromoted;
private string HtmlTitle => Piece?.WhichPiece switch
private string HtmlTitle => this.Piece switch
{
WhichPiece.Bishop => "Bishop",
WhichPiece.GoldGeneral => "Gold General",