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