mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 09:32:55 +08:00
Fix MultiSpectatorScreen not continuing to results
This commit is contained in:
parent
483977d5c8
commit
f285060148
@ -215,8 +215,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
protected override void StartGameplay(int userId, SpectatorGameplayState spectatorGameplayState)
|
||||
=> instances.Single(i => i.UserId == userId).LoadScore(spectatorGameplayState.Score);
|
||||
|
||||
protected override void EndGameplay(int userId)
|
||||
protected override void EndGameplay(int userId, SpectatorState state)
|
||||
{
|
||||
if (state.State == SpectatingUserState.Completed || state.State == SpectatingUserState.Failed)
|
||||
return;
|
||||
|
||||
RemoveUser(userId);
|
||||
|
||||
var instance = instances.Single(i => i.UserId == userId);
|
||||
|
@ -180,7 +180,7 @@ namespace osu.Game.Screens.Play
|
||||
scheduleStart(spectatorGameplayState);
|
||||
}
|
||||
|
||||
protected override void EndGameplay(int userId)
|
||||
protected override void EndGameplay(int userId, SpectatorState state)
|
||||
{
|
||||
scheduledStart?.Cancel();
|
||||
immediateSpectatorGameplayState = null;
|
||||
|
@ -118,8 +118,8 @@ namespace osu.Game.Screens.Spectate
|
||||
break;
|
||||
|
||||
case NotifyDictionaryChangedAction.Remove:
|
||||
foreach ((int userId, _) in e.OldItems.AsNonNull())
|
||||
onUserStateRemoved(userId);
|
||||
foreach ((int userId, SpectatorState state) in e.OldItems.AsNonNull())
|
||||
onUserStateRemoved(userId, state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ namespace osu.Game.Screens.Spectate
|
||||
}
|
||||
}
|
||||
|
||||
private void onUserStateRemoved(int userId)
|
||||
private void onUserStateRemoved(int userId, SpectatorState state)
|
||||
{
|
||||
if (!userMap.ContainsKey(userId))
|
||||
return;
|
||||
@ -158,7 +158,7 @@ namespace osu.Game.Screens.Spectate
|
||||
gameplayState.Score.Replay.HasReceivedAllFrames = true;
|
||||
|
||||
gameplayStates.Remove(userId);
|
||||
Schedule(() => EndGameplay(userId));
|
||||
Schedule(() => EndGameplay(userId, state));
|
||||
}
|
||||
|
||||
private void updateGameplayState(int userId)
|
||||
@ -212,7 +212,8 @@ namespace osu.Game.Screens.Spectate
|
||||
/// Ends gameplay for a user.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user to end gameplay for.</param>
|
||||
protected abstract void EndGameplay(int userId);
|
||||
/// <param name="state">The final user state.</param>
|
||||
protected abstract void EndGameplay(int userId, SpectatorState state);
|
||||
|
||||
/// <summary>
|
||||
/// Stops spectating a user.
|
||||
@ -220,7 +221,10 @@ namespace osu.Game.Screens.Spectate
|
||||
/// <param name="userId">The user to stop spectating.</param>
|
||||
protected void RemoveUser(int userId)
|
||||
{
|
||||
onUserStateRemoved(userId);
|
||||
if (!userStates.TryGetValue(userId, out var state))
|
||||
return;
|
||||
|
||||
onUserStateRemoved(userId, state);
|
||||
|
||||
users.Remove(userId);
|
||||
userMap.Remove(userId);
|
||||
|
Loading…
Reference in New Issue
Block a user