Yep
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<span> </span>
|
||||
}
|
||||
|
||||
@if (IsVictor)
|
||||
{
|
||||
<span class="victory-marker" title="Victory!">Victor</span>
|
||||
<span> </span>
|
||||
}
|
||||
|
||||
@if (string.IsNullOrEmpty(Name))
|
||||
{
|
||||
<span>Empty Seat</span>
|
||||
@@ -25,5 +31,6 @@
|
||||
@code {
|
||||
[Parameter][EditorRequired] public bool IsTurn { get; set; }
|
||||
[Parameter][EditorRequired] public bool InCheck { get; set; }
|
||||
[Parameter][EditorRequired] public bool IsVictor { get; set; }
|
||||
[Parameter][EditorRequired] public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -15,3 +15,12 @@
|
||||
font-weight: bold;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
.victory-marker {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
background-color: darkgreen;
|
||||
color: beige;
|
||||
font-weight: bold;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user