mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 14:17:06 +09:00
Block screen suspend while gameplay is active
This commit is contained in:
@ -125,6 +125,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private GameplayBeatmap gameplayBeatmap;
|
||||
|
||||
private ScreenSuspensionHandler screenSuspension;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -179,6 +181,7 @@ namespace osu.Game.Screens.Play
|
||||
InternalChild = GameplayClockContainer = new GameplayClockContainer(Beatmap.Value, Mods.Value, DrawableRuleset.GameplayStartTime);
|
||||
|
||||
AddInternal(gameplayBeatmap = new GameplayBeatmap(playableBeatmap));
|
||||
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
|
||||
|
||||
dependencies.CacheAs(gameplayBeatmap);
|
||||
|
||||
@ -628,12 +631,16 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override void OnSuspending(IScreen next)
|
||||
{
|
||||
screenSuspension?.Expire();
|
||||
|
||||
fadeOut();
|
||||
base.OnSuspending(next);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
screenSuspension?.Expire();
|
||||
|
||||
if (completionProgressDelegate != null && !completionProgressDelegate.Cancelled && !completionProgressDelegate.Completed)
|
||||
{
|
||||
// proceed to result screen if beatmap already finished playing
|
||||
|
Reference in New Issue
Block a user