1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 12:32:58 +08:00

Fix spectator not completing

This commit is contained in:
Dan Balasescu 2022-02-03 12:44:33 +09:00
parent 81a22dbd29
commit 62537eb4aa

View File

@ -112,6 +112,7 @@ namespace osu.Game.Screens.Spectate
switch (e.Action)
{
case NotifyDictionaryChangedAction.Add:
case NotifyDictionaryChangedAction.Replace:
foreach ((int userId, var state) in e.NewItems.AsNonNull())
onUserStateChanged(userId, state);
break;
@ -120,11 +121,6 @@ namespace osu.Game.Screens.Spectate
foreach ((int userId, _) in e.OldItems.AsNonNull())
onUserStateRemoved(userId);
break;
case NotifyDictionaryChangedAction.Replace:
foreach ((int userId, var state) in e.NewItems.AsNonNull())
onUserStateChanged(userId, state);
break;
}
}
@ -136,11 +132,18 @@ namespace osu.Game.Screens.Spectate
if (!userMap.ContainsKey(userId))
return;
// Do nothing for failed/completed states.
if (newState.State == SpectatingUserState.Playing)
switch (newState.State)
{
Schedule(() => OnUserStateChanged(userId, newState));
updateGameplayState(userId);
case SpectatingUserState.Completed:
// Make sure that gameplay completes to the end.
if (gameplayStates.TryGetValue(userId, out var gameplayState))
gameplayState.Score.Replay.HasReceivedAllFrames = true;
break;
case SpectatingUserState.Playing:
Schedule(() => OnUserStateChanged(userId, newState));
updateGameplayState(userId);
break;
}
}