Replace custom socket implementation with SignalR.
Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework Also some UI redesign to accommodate different login experience.
This commit is contained in:
57
Shogi.UI/Pages/Play/GamePiece.razor
Normal file
57
Shogi.UI/Pages/Play/GamePiece.razor
Normal file
@@ -0,0 +1,57 @@
|
||||
@using Shogi.Contracts.Types
|
||||
|
||||
<div class="game-piece" title="@HtmlTitle" data-upsidedown="@(Piece?.Owner != Perspective)" data-owner="@Piece?.Owner.ToString()">
|
||||
@switch (Piece?.WhichPiece)
|
||||
{
|
||||
case WhichPiece.Bishop:
|
||||
<Bishop IsPromoted="@IsPromoted" />
|
||||
break;
|
||||
case WhichPiece.GoldGeneral:
|
||||
<GoldGeneral />
|
||||
break;
|
||||
case WhichPiece.King:
|
||||
<ChallengingKing />
|
||||
break;
|
||||
case WhichPiece.Knight:
|
||||
<Knight IsPromoted="@IsPromoted" />
|
||||
break;
|
||||
case WhichPiece.Lance:
|
||||
<Lance IsPromoted="@IsPromoted" />
|
||||
break;
|
||||
case WhichPiece.Pawn:
|
||||
<Pawn IsPromoted="@IsPromoted" />
|
||||
break;
|
||||
case WhichPiece.Rook:
|
||||
<Rook IsPromoted="@IsPromoted" />
|
||||
break;
|
||||
case WhichPiece.SilverGeneral:
|
||||
<SilverGeneral IsPromoted="@IsPromoted" />
|
||||
break;
|
||||
default:
|
||||
@*render nothing*@
|
||||
break;
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public Contracts.Types.Piece? Piece { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public WhichPlayer Perspective { get; set; }
|
||||
|
||||
private bool IsPromoted => Piece != null && Piece.IsPromoted;
|
||||
|
||||
private string HtmlTitle => Piece?.WhichPiece switch
|
||||
{
|
||||
WhichPiece.Bishop => "Bishop",
|
||||
WhichPiece.GoldGeneral => "Gold General",
|
||||
WhichPiece.King => "King",
|
||||
WhichPiece.Knight => "Knight",
|
||||
WhichPiece.Lance => "Lance",
|
||||
WhichPiece.Pawn => "Pawn",
|
||||
WhichPiece.Rook => "Rook",
|
||||
WhichPiece.SilverGeneral => "Silver General",
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user