Turn and Check markers.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user