mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Remove managed clocks from SpectatorSyncManager
on gameplay completion / abort
This commit is contained in:
parent
e0e790fa94
commit
21d6556865
@ -244,10 +244,19 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
playerArea.LoadScore(spectatorGameplayState.Score);
|
||||
});
|
||||
|
||||
protected override void FailGameplay(int userId)
|
||||
protected override void FailGameplay(int userId) => Schedule(() =>
|
||||
{
|
||||
// We probably want to visualise this in the future.
|
||||
}
|
||||
|
||||
var instance = instances.Single(i => i.UserId == userId);
|
||||
syncManager.RemoveManagedClock(instance.SpectatorPlayerClock);
|
||||
});
|
||||
|
||||
protected override void PassGameplay(int userId) => Schedule(() =>
|
||||
{
|
||||
var instance = instances.Single(i => i.UserId == userId);
|
||||
syncManager.RemoveManagedClock(instance.SpectatorPlayerClock);
|
||||
});
|
||||
|
||||
protected override void QuitGameplay(int userId) => Schedule(() =>
|
||||
{
|
||||
|
@ -76,6 +76,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
public void RemoveManagedClock(SpectatorPlayerClock clock)
|
||||
{
|
||||
playerClocks.Remove(clock);
|
||||
Logger.Log($"Removing managed clock from {nameof(SpectatorSyncManager)} ({playerClocks.Count} remain)");
|
||||
clock.IsRunning = false;
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@ namespace osu.Game.Screens.Spectate
|
||||
|
||||
case SpectatedUserState.Passed:
|
||||
markReceivedAllFrames(userId);
|
||||
PassGameplay(userId);
|
||||
break;
|
||||
|
||||
case SpectatedUserState.Failed:
|
||||
@ -233,6 +234,12 @@ namespace osu.Game.Screens.Spectate
|
||||
/// <param name="spectatorGameplayState">The gameplay state.</param>
|
||||
protected abstract void StartGameplay(int userId, SpectatorGameplayState spectatorGameplayState);
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a user passes gameplay.
|
||||
/// </summary>
|
||||
/// <param name="userId">The user which passed.</param>
|
||||
protected virtual void PassGameplay(int userId) { }
|
||||
|
||||
/// <summary>
|
||||
/// Quits gameplay for a user.
|
||||
/// Thread safety is not guaranteed – should be scheduled as required.
|
||||
|
Loading…
Reference in New Issue
Block a user