From e4b84ebd0b3a89e56c07da34195862bccfbbb38c Mon Sep 17 00:00:00 2001 From: Pasi4K5 Date: Mon, 13 Feb 2023 23:51:39 +0100 Subject: [PATCH] Add `UseResumeOverlay` and use it for hiding the `ResumeOverlay` --- osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs | 4 ++-- osu.Game/Rulesets/UI/DrawableRuleset.cs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs index 276724c169..9eb0a46bfb 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs @@ -54,14 +54,14 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - drawableRuleset.ResumeOverlay = null; - // Grab the input manager to disable the user's cursor, and for future use inputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager; inputManager.AllowUserCursorMovement = false; // Generate the replay frames the cursor should follow replayFrames = new OsuAutoGenerator(drawableRuleset.Beatmap, drawableRuleset.Mods).Generate().Frames.Cast().ToList(); + + drawableRuleset.UseResumeOverlay = false; } } } diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 403dee5651..23e8d1fc2d 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -196,6 +196,8 @@ namespace osu.Game.Rulesets.UI if ((ResumeOverlay = CreateResumeOverlay()) != null) { + UseResumeOverlay = true; + AddInternal(CreateInputManager() .WithChild(CreatePlayfieldAdjustmentContainer() .WithChild(ResumeOverlay))); @@ -230,7 +232,7 @@ namespace osu.Game.Rulesets.UI public override void RequestResume(Action continueResume) { - if (ResumeOverlay != null && (Cursor == null || (Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre)))) + if (ResumeOverlay != null && UseResumeOverlay && (Cursor == null || (Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre)))) { ResumeOverlay.GameplayCursor = Cursor; ResumeOverlay.ResumeAction = continueResume; @@ -507,6 +509,12 @@ namespace osu.Game.Rulesets.UI /// public ResumeOverlay ResumeOverlay { get; set; } + /// + /// Whether the should be used to return the user's cursor position to its previous location after a pause. + /// + /// Defaults to true if a ruleset returns a non-null overlay via . + public bool UseResumeOverlay { get; set; } + /// /// Returns first available provided by a . ///