mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 02:32:59 +08:00
Fix cursor being displayed on intro/disclaimer
This commit is contained in:
parent
5952f1e7f1
commit
620e125fad
@ -14,6 +14,11 @@ namespace osu.Game.Graphics.Cursor
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container content;
|
||||
|
||||
/// <summary>
|
||||
/// Whether any cursors can be displayed.
|
||||
/// </summary>
|
||||
public bool CanShowCursor;
|
||||
|
||||
public CursorContainer LocalCursor { get; }
|
||||
public bool ProvidesUserCursor => true;
|
||||
|
||||
@ -39,6 +44,12 @@ namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!CanShowCursor)
|
||||
{
|
||||
currentTarget?.LocalCursor?.Hide();
|
||||
return;
|
||||
}
|
||||
|
||||
var newTarget = inputManager.HoveredDrawables.OfType<IProvideLocalCursor>().FirstOrDefault(t => t.ProvidesUserCursor) ?? this;
|
||||
|
||||
if (currentTarget == newTarget)
|
||||
|
@ -444,6 +444,8 @@ namespace osu.Game
|
||||
Beatmap.Disabled = applyRestrictions;
|
||||
|
||||
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||
|
||||
CursorContainer.CanShowCursor = currentScreen?.CursorVisible ?? false;
|
||||
}
|
||||
|
||||
private void screenAdded(Screen newScreen)
|
||||
|
@ -44,6 +44,8 @@ namespace osu.Game
|
||||
|
||||
protected KeyBindingStore KeyBindingStore;
|
||||
|
||||
protected OsuCursorContainer CursorContainer;
|
||||
|
||||
protected override string MainResourceFile => @"osu.Game.Resources.dll";
|
||||
|
||||
public APIAccess API;
|
||||
@ -209,14 +211,14 @@ namespace osu.Game
|
||||
|
||||
GlobalKeyBindingInputManager globalBinding;
|
||||
|
||||
var cursorContainer = new OsuCursorContainer { RelativeSizeAxes = Axes.Both };
|
||||
cursorContainer.Child = globalBinding = new GlobalKeyBindingInputManager(this)
|
||||
CursorContainer = new OsuCursorContainer { RelativeSizeAxes = Axes.Both };
|
||||
CursorContainer.Child = globalBinding = new GlobalKeyBindingInputManager(this)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = content = new OsuTooltipContainer(cursorContainer.LocalCursor) { RelativeSizeAxes = Axes.Both }
|
||||
Child = content = new OsuTooltipContainer(CursorContainer.LocalCursor) { RelativeSizeAxes = Axes.Both }
|
||||
};
|
||||
|
||||
base.Content.Add(new DrawSizePreservingFillContainer { Child = cursorContainer });
|
||||
base.Content.Add(new DrawSizePreservingFillContainer { Child = CursorContainer });
|
||||
|
||||
KeyBindingStore.Register(globalBinding);
|
||||
dependencies.Cache(globalBinding);
|
||||
|
@ -9,21 +9,17 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class Disclaimer : OsuScreen, IProvideLocalCursor
|
||||
public class Disclaimer : OsuScreen
|
||||
{
|
||||
private Intro intro;
|
||||
private readonly SpriteIcon icon;
|
||||
private Color4 iconColour;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
|
||||
public CursorContainer LocalCursor => null;
|
||||
public bool ProvidesUserCursor => true;
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
public Disclaimer()
|
||||
{
|
||||
|
@ -15,12 +15,10 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class Intro : OsuScreen, IProvideLocalCursor
|
||||
public class Intro : OsuScreen
|
||||
{
|
||||
private const string menu_music_beatmap_hash = "3c8b1fcc9434dbb29e2fb613d3b9eada9d7bb6c125ceb32396c3b53437280c83";
|
||||
|
||||
@ -34,9 +32,7 @@ namespace osu.Game.Screens.Menu
|
||||
private SampleChannel seeya;
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
|
||||
public CursorContainer LocalCursor => null;
|
||||
public bool ProvidesUserCursor => true;
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
|
||||
|
||||
|
@ -35,6 +35,11 @@ namespace osu.Game.Screens
|
||||
/// </summary>
|
||||
public virtual bool ShowOverlaysOnEnter => true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
||||
/// </summary>
|
||||
public virtual bool CursorVisible => true;
|
||||
|
||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
||||
|
||||
private OsuLogo logo;
|
||||
|
Loading…
Reference in New Issue
Block a user