1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 07:22:54 +08:00

Add UseResumeOverlay and use it for hiding the ResumeOverlay

This commit is contained in:
Pasi4K5 2023-02-13 23:51:39 +01:00
parent 8b47af6503
commit e4b84ebd0b
2 changed files with 11 additions and 3 deletions

View File

@ -54,14 +54,14 @@ namespace osu.Game.Rulesets.Osu.Mods
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> 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<OsuReplayFrame>().ToList();
drawableRuleset.UseResumeOverlay = false;
}
}
}

View File

@ -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
/// </summary>
public ResumeOverlay ResumeOverlay { get; set; }
/// <summary>
/// Whether the <see cref="ResumeOverlay"/> should be used to return the user's cursor position to its previous location after a pause.
/// </summary>
/// <remarks>Defaults to <c>true</c> if a ruleset returns a non-null overlay via <see cref="CreateResumeOverlay"/>.</remarks>
public bool UseResumeOverlay { get; set; }
/// <summary>
/// Returns first available <see cref="HitWindows"/> provided by a <see cref="HitObject"/>.
/// </summary>