This commit is contained in:
2024-10-31 18:40:12 -05:00
parent a507212551
commit 09587b2f4d
6 changed files with 44 additions and 22 deletions

View File

@@ -2,14 +2,6 @@
@using System.Text.Json;
<article class="game-board">
@if (IsSpectating)
{
<aside class="icons">
<div title="You are spectating.">
<span>Camera icon</span>
</div>
</aside>
}
<!-- Game board -->
<section class="board" data-perspective="@Perspective">
@for (var rank = 1; rank < 10; rank++)
@@ -74,13 +66,13 @@
</div>
<div class="place-self-center">
<PlayerName Name="@opponentName" IsTurn="!IsMyTurn" InCheck="IsOpponentInCheck" />
<PlayerName Name="@opponentName" IsTurn="!IsMyTurn" InCheck="IsOpponentInCheck" IsVictor="IsOpponentVictor" />
<hr />
<PlayerName Name="@userName" IsTurn="IsMyTurn" InCheck="IsPlayerInCheck" />
<PlayerName Name="@userName" IsTurn="IsMyTurn" InCheck="IsPlayerInCheck" IsVictor="IsPlayerVictor" />
</div>
<div class="player-area">
@if (string.IsNullOrEmpty(Session.Player2) && !string.IsNullOrEmpty(Session.Player1))
@if (Perspective == WhichPlayer.Player2 && string.IsNullOrEmpty(Session.Player2))
{
<div class="place-self-center">
<button @onclick="OnClickJoinGameInternal">Join Game</button>
@@ -172,6 +164,11 @@
private bool IsOpponentInCheck => Session?.BoardState.PlayerInCheck != null && Session.BoardState.PlayerInCheck != Perspective;
private bool IsPlayerVictor => Session?.BoardState.Victor == Perspective;
private bool IsOpponentVictor => Session?.BoardState.Victor != null && Session.BoardState.Victor != Perspective;
private Func<Task> OnClickTileInternal(string position) => () =>
{
if (IsMyTurn)