yep
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
}
|
||||
else if (isSpectating)
|
||||
{
|
||||
<SpectatorGameBoard Session="session" OnRefetchSession="RefetchSession" />
|
||||
<SpectatorGameBoard Session="session" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -32,16 +32,25 @@ else
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
ShogiSocket.OnPlayerMoved += OnPlayerMoved_RefetchSession;
|
||||
ShogiSocket.OnSessionJoined +=
|
||||
ShogiSocket.OnPlayerMoved += OnPlayerMoved_FetchSession;
|
||||
ShogiSocket.OnSessionJoined += OnSessionJoined_FetchSession;
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await RefetchSession();
|
||||
await FetchSession();
|
||||
}
|
||||
|
||||
async Task RefetchSession()
|
||||
Task OnSessionJoined_FetchSession(SessionJoinedByPlayerSocketMessage args)
|
||||
{
|
||||
if (args.SessionName == SessionName)
|
||||
{
|
||||
return FetchSession();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
async Task FetchSession()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(SessionName))
|
||||
{
|
||||
@@ -59,11 +68,11 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
Task OnPlayerMoved_RefetchSession(PlayerHasMovedMessage args)
|
||||
Task OnPlayerMoved_FetchSession(PlayerHasMovedMessage args)
|
||||
{
|
||||
if (args.SessionName == SessionName)
|
||||
{
|
||||
return RefetchSession();
|
||||
return FetchSession();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user