mirror of https://github.com/ppy/osu
Fix attempt to change ruleset/beatmap bindables while screen is not active
This commit is contained in:
parent
25ab3a5fea
commit
5d02de29ca
|
@ -63,6 +63,11 @@ public class Spectator : OsuScreen
|
|||
|
||||
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Becomes true if a new state is waiting to be loaded (while this screen was not active).
|
||||
/// </summary>
|
||||
private bool newStatePending;
|
||||
|
||||
public Spectator([NotNull] User targetUser)
|
||||
{
|
||||
this.targetUser = targetUser ?? throw new ArgumentNullException(nameof(targetUser));
|
||||
|
@ -162,7 +167,21 @@ private void userBeganPlaying(int userId, SpectatorState state)
|
|||
|
||||
this.state = state;
|
||||
|
||||
Schedule(attemptStart);
|
||||
if (this.IsCurrentScreen())
|
||||
Schedule(attemptStart);
|
||||
else
|
||||
newStatePending = true;
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
if (newStatePending)
|
||||
{
|
||||
attemptStart();
|
||||
newStatePending = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void userFinishedPlaying(int userId, SpectatorState state)
|
||||
|
|
Loading…
Reference in New Issue