1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Fix catch by moving cursor-specific handling local

This commit is contained in:
Dan Balasescu 2024-03-04 16:08:17 +09:00
parent dcb195f3c8
commit bce3bd55e5
No known key found for this signature in database
4 changed files with 23 additions and 5 deletions

View File

@ -6,11 +6,11 @@ using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Osu.UI.Cursor; using osu.Game.Rulesets.Osu.UI.Cursor;
using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Tests.Gameplay; using osu.Game.Tests.Gameplay;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests
public partial class TestSceneResumeOverlay : OsuManualInputManagerTestScene public partial class TestSceneResumeOverlay : OsuManualInputManagerTestScene
{ {
private ManualOsuInputManager osuInputManager = null!; private ManualOsuInputManager osuInputManager = null!;
private CursorContainer cursor = null!; private GameplayCursorContainer cursor = null!;
private ResumeOverlay resume = null!; private ResumeOverlay resume = null!;
private bool resumeFired; private bool resumeFired;
@ -99,7 +99,17 @@ namespace osu.Game.Rulesets.Osu.Tests
private void loadContent() private void loadContent()
{ {
Child = osuInputManager = new ManualOsuInputManager(new OsuRuleset().RulesetInfo) { Children = new Drawable[] { cursor = new CursorContainer(), resume = new OsuResumeOverlay { GameplayCursor = cursor }, } }; Child = osuInputManager = new ManualOsuInputManager(new OsuRuleset().RulesetInfo)
{
Children = new Drawable[]
{
cursor = new GameplayCursorContainer(),
resume = new OsuResumeOverlay
{
GameplayCursor = cursor
},
}
};
resumeFired = false; resumeFired = false;
resume.ResumeAction = () => resumeFired = true; resume.ResumeAction = () => resumeFired = true;

View File

@ -39,6 +39,13 @@ namespace osu.Game.Rulesets.Osu.UI
protected override void PopIn() protected override void PopIn()
{ {
// Can't display if the cursor is outside the window.
if (GameplayCursor.LastFrameState == Visibility.Hidden || !Contains(GameplayCursor.ActiveCursor.ScreenSpaceDrawQuad.Centre))
{
Resume();
return;
}
base.PopIn(); base.PopIn();
GameplayCursor.ActiveCursor.Hide(); GameplayCursor.ActiveCursor.Hide();

View File

@ -227,7 +227,7 @@ namespace osu.Game.Rulesets.UI
public override void RequestResume(Action continueResume) public override void RequestResume(Action continueResume)
{ {
if (ResumeOverlay != null && UseResumeOverlay && (Cursor == null || (Cursor.LastFrameState == Visibility.Visible && Contains(Cursor.ActiveCursor.ScreenSpaceDrawQuad.Centre)))) if (ResumeOverlay != null && UseResumeOverlay)
{ {
ResumeOverlay.GameplayCursor = Cursor; ResumeOverlay.GameplayCursor = Cursor;
ResumeOverlay.ResumeAction = continueResume; ResumeOverlay.ResumeAction = continueResume;

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.UI;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -21,7 +22,7 @@ namespace osu.Game.Screens.Play
/// </summary> /// </summary>
public abstract partial class ResumeOverlay : VisibilityContainer public abstract partial class ResumeOverlay : VisibilityContainer
{ {
public CursorContainer GameplayCursor { get; set; } public GameplayCursorContainer GameplayCursor { get; set; }
/// <summary> /// <summary>
/// The action to be performed to complete resuming. /// The action to be performed to complete resuming.