Turn and Check markers.

This commit is contained in:
2024-10-28 21:01:44 -05:00
parent a7e26f5210
commit cfd62eeca9
5 changed files with 57 additions and 13 deletions

View File

@@ -10,8 +10,7 @@
OnClickHand="OnClickHand"
OnClickTile="OnClickTile"
SelectedPosition="@selectedBoardPosition"
SelectedPieceFromHand="@selectedPieceFromHand"
IsMyTurn="IsMyTurn" />
SelectedPieceFromHand="@selectedPieceFromHand" />
@if (showPromotePrompt)
{
@@ -33,7 +32,6 @@
public WhichPlayer Perspective { get; set; }
[Parameter, EditorRequired]
public Session Session { get; set; } = default!;
private bool IsMyTurn => Session?.BoardState.WhoseTurn == Perspective;
private string? selectedBoardPosition;
private WhichPiece? selectedPieceFromHand;
private bool showPromotePrompt;
@@ -65,7 +63,7 @@
async Task OnClickTile(string position)
{
if (!IsMyTurn || showPromotePrompt) return;
if (showPromotePrompt) return;
var pieceAtPosition = Session.BoardState.Board[position];
if (selectedBoardPosition == position)
@@ -133,7 +131,7 @@
void OnClickHand(Piece piece)
{
if (!IsMyTurn || showPromotePrompt) return;
if (showPromotePrompt) return;
// Prevent selecting from both the hand and the board.
selectedBoardPosition = null;