Don't begin gameplay until all users are in a completely prepared state

This commit is contained in:
Dean Herbert
2020-12-24 15:32:55 +09:00
parent b29a5e2073
commit e86e9bfae6
2 changed files with 40 additions and 17 deletions

View File

@ -723,9 +723,6 @@ namespace osu.Game.Screens.Play
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
GameplayClockContainer.Restart();
GameplayClockContainer.FadeInFromZero(750, Easing.OutQuint);
foreach (var mod in Mods.Value.OfType<IApplicableToPlayer>())
mod.ApplyToPlayer(this);
@ -740,6 +737,21 @@ namespace osu.Game.Screens.Play
mod.ApplyToTrack(musicController.CurrentTrack);
updateGameplayState();
GameplayClockContainer.FadeInFromZero(750, Easing.OutQuint);
StartGameplay();
}
/// <summary>
/// Called to trigger the starting of the gameplay clock and underlying gameplay.
/// This will be called on entering the player screen once. A derived class may block the first call to this to delay the start of gameplay.
/// </summary>
protected virtual void StartGameplay()
{
if (GameplayClockContainer.GameplayClock.IsRunning)
throw new InvalidOperationException($"{nameof(StartGameplay)} should not be called when the gameplay clock is already running");
GameplayClockContainer.Restart();
}
public override void OnSuspending(IScreen next)