1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:17:23 +08:00

Keep cursor hiding feature to gameplay screens for now

This commit is contained in:
Salman Ahmed 2022-10-20 03:44:58 +03:00
parent 31f499a950
commit 4bf4938b72
5 changed files with 27 additions and 4 deletions

View File

@ -23,6 +23,21 @@ namespace osu.Game.Graphics.Cursor
private readonly IBindable<bool> screenshotCursorVisibility = new Bindable<bool>(true);
public override bool IsPresent => screenshotCursorVisibility.Value && base.IsPresent;
private bool hideCursorOnNonMouseInput;
public bool HideCursorOnNonMouseInput
{
get => hideCursorOnNonMouseInput;
set
{
if (hideCursorOnNonMouseInput == value)
return;
hideCursorOnNonMouseInput = value;
updateState();
}
}
protected override Drawable CreateCursor() => activeCursor = new Cursor();
private Cursor activeCursor = null!;
@ -75,7 +90,7 @@ namespace osu.Game.Graphics.Cursor
private void updateState()
{
bool combinedVisibility = State.Value == Visibility.Visible && lastInputWasMouse.Value && !isIdle.Value;
bool combinedVisibility = State.Value == Visibility.Visible && (lastInputWasMouse.Value || !hideCursorOnNonMouseInput) && !isIdle.Value;
if (visible == combinedVisibility)
return;

View File

@ -1333,6 +1333,8 @@ namespace osu.Game
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
API.Activity.BindTo(newOsuScreen.Activity);
GlobalCursorDisplay.MenuCursor.HideCursorOnNonMouseInput = newOsuScreen.HideMenuCursorOnNonMouseInput;
if (newOsuScreen.HideOverlaysOnEnter)
CloseAllOverlays();
else

View File

@ -41,6 +41,11 @@ namespace osu.Game.Screens
/// </summary>
bool HideOverlaysOnEnter { get; }
/// <summary>
/// Whether the menu cursor should be hidden when non-mouse input is received.
/// </summary>
bool HideMenuCursorOnNonMouseInput { get; }
/// <summary>
/// Whether overlays should be able to be opened when this screen is current.
/// </summary>

View File

@ -40,11 +40,10 @@ namespace osu.Game.Screens
public virtual bool AllowExternalScreenChange => false;
/// <summary>
/// Whether all overlays should be hidden when this screen is entered or resumed.
/// </summary>
public virtual bool HideOverlaysOnEnter => false;
public virtual bool HideMenuCursorOnNonMouseInput => false;
/// <summary>
/// The initial overlay activation mode to use when this screen is entered for the first time.
/// </summary>

View File

@ -66,6 +66,8 @@ namespace osu.Game.Screens.Play
public override bool HideOverlaysOnEnter => true;
public override bool HideMenuCursorOnNonMouseInput => true;
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
// We are managing our own adjustments (see OnEntering/OnExiting).