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

Fix menu cursor not displaying outside of gameplay scaling area

This commit is contained in:
Dean Herbert 2019-03-05 18:06:24 +09:00
parent 34ae3c111c
commit fc0b297232
5 changed files with 15 additions and 14 deletions

View File

@ -16,18 +16,18 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestFixture] [TestFixture]
public class TestCaseGameplayCursor : OsuTestCase, IProvideCursor public class TestCaseGameplayCursor : OsuTestCase, IProvideCursor
{ {
private GameplayCursor cursor; private GameplayCursorContainer cursorContainer;
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) }; public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) };
public CursorContainer Cursor => cursor; public CursorContainer Cursor => cursorContainer;
public bool ProvidingUserCursor => true; public bool ProvidingUserCursor => true;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Add(cursor = new GameplayCursor { RelativeSizeAxes = Axes.Both }); Add(cursorContainer = new GameplayCursorContainer { RelativeSizeAxes = Axes.Both });
} }
} }
} }

View File

@ -17,7 +17,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Osu.UI.Cursor namespace osu.Game.Rulesets.Osu.UI.Cursor
{ {
public class GameplayCursor : CursorContainer, IKeyBindingHandler<OsuAction> public class GameplayCursorContainer : CursorContainer, IKeyBindingHandler<OsuAction>
{ {
protected override Drawable CreateCursor() => new OsuCursor(); protected override Drawable CreateCursor() => new OsuCursor();
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
private readonly Container<Drawable> fadeContainer; private readonly Container<Drawable> fadeContainer;
public GameplayCursor() public GameplayCursorContainer()
{ {
InternalChild = fadeContainer = new Container InternalChild = fadeContainer = new Container
{ {

View File

@ -60,6 +60,6 @@ namespace osu.Game.Rulesets.Osu.UI
} }
} }
protected override CursorContainer CreateCursor() => new GameplayCursor(); protected override CursorContainer CreateCursor() => new GameplayCursorContainer();
} }
} }

View File

@ -16,7 +16,9 @@ using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Input.Events;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.Cursor;
using osu.Game.Input.Handlers; using osu.Game.Input.Handlers;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Replays; using osu.Game.Replays;
@ -32,7 +34,7 @@ namespace osu.Game.Rulesets.UI
/// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead. /// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead.
/// </para> /// </para>
/// </summary> /// </summary>
public abstract class RulesetContainer : Container public abstract class RulesetContainer : Container, IProvideCursor
{ {
/// <summary> /// <summary>
/// The selected variant. /// The selected variant.
@ -77,7 +79,11 @@ namespace osu.Game.Rulesets.UI
/// <summary> /// <summary>
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided. /// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
/// </summary> /// </summary>
public readonly CursorContainer Cursor; public CursorContainer Cursor { get; }
public bool ProvidingUserCursor => Cursor != null && !HasReplayLoaded.Value;
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
public readonly Ruleset Ruleset; public readonly Ruleset Ruleset;

View File

@ -11,7 +11,6 @@ using osu.Framework.Audio.Sample;
using osu.Framework.Bindables; using osu.Framework.Bindables;
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.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Screens; using osu.Framework.Screens;
@ -20,7 +19,6 @@ using osu.Framework.Timing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -34,7 +32,7 @@ using osu.Game.Storyboards.Drawables;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
public class Player : ScreenWithBeatmapBackground, IProvideCursor public class Player : ScreenWithBeatmapBackground
{ {
protected override bool AllowBackButton => false; // handled by HoldForMenuButton protected override bool AllowBackButton => false; // handled by HoldForMenuButton
@ -59,9 +57,6 @@ namespace osu.Game.Screens.Play
public int RestartCount; public int RestartCount;
public CursorContainer Cursor => RulesetContainer.Cursor;
public bool ProvidingUserCursor => RulesetContainer?.Cursor != null && !RulesetContainer.HasReplayLoaded.Value;
private IAdjustableClock sourceClock; private IAdjustableClock sourceClock;
/// <summary> /// <summary>