yep
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
var position = $"{file}{rank}";
|
||||
var piece = Session?.BoardState.Board[position];
|
||||
var isSelected = piece != null && SelectedPosition == position;
|
||||
<div class="tile" @onclick="OnClickTileInternal(piece, position)"
|
||||
<div class="tile" @onclick="OnClickTileInternal(position)"
|
||||
data-position="@(position)"
|
||||
data-selected="@(isSelected)"
|
||||
style="grid-area: @position">
|
||||
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
|
||||
<div class="player-area">
|
||||
@if (this.OnClickJoinGame != null && string.IsNullOrEmpty(Session.Player2) && !string.IsNullOrEmpty(Session.Player1))
|
||||
@if (string.IsNullOrEmpty(Session.Player2) && !string.IsNullOrEmpty(Session.Player1))
|
||||
{
|
||||
<div class="place-self-center">
|
||||
<button @onclick="OnClickJoinGameInternal">Join Game</button>
|
||||
@@ -121,9 +121,9 @@
|
||||
[Parameter] public string? SelectedPosition { get; set; }
|
||||
[Parameter] public WhichPiece? SelectedPieceFromHand { get; set; }
|
||||
// TODO: Exchange these OnClick actions for events like "SelectionChangedEvent" and "MoveFromBoardEvent" and "MoveFromHandEvent".
|
||||
[Parameter] public Func<Piece?, string, Task>? OnClickTile { get; set; }
|
||||
[Parameter] public Func<Piece, Task>? OnClickHand { get; set; }
|
||||
[Parameter] public Func<Task>? OnClickJoinGame { get; set; }
|
||||
[Parameter] public EventCallback<string> OnClickTile { get; set; }
|
||||
[Parameter] public EventCallback<Piece> OnClickHand { get; set; }
|
||||
[Parameter] public EventCallback OnClickJoinGame { get; set; }
|
||||
[Parameter] public bool IsMyTurn { get; set; }
|
||||
[Parameter] public bool UseSideboard { get; set; } = true;
|
||||
|
||||
@@ -167,7 +167,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
private Action OnClickTileInternal(Piece? piece, string position) => () => OnClickTile?.Invoke(piece, position);
|
||||
private Action OnClickHandInternal(Piece piece) => () => OnClickHand?.Invoke(piece);
|
||||
private void OnClickJoinGameInternal() => OnClickJoinGame?.Invoke();
|
||||
private Func<Task> OnClickTileInternal(string position) => () => OnClickTile.InvokeAsync(position);
|
||||
|
||||
private Func<Task> OnClickHandInternal(Piece piece) => () => OnClickHand.InvokeAsync(piece);
|
||||
|
||||
private Task OnClickJoinGameInternal() => OnClickJoinGame.InvokeAsync();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user