mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Introduce OsuScreen.AllowBackButton property
This commit is contained in:
parent
804b59ee80
commit
b08b24b6da
@ -22,6 +22,8 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
public BackgroundScreen Background { get; private set; }
|
public BackgroundScreen Background { get; private set; }
|
||||||
|
|
||||||
|
protected virtual bool AllowBackButton => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Override to create a BackgroundMode for the current screen.
|
/// Override to create a BackgroundMode for the current screen.
|
||||||
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
|
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
|
||||||
@ -92,26 +94,16 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
if (action == GlobalAction.Back && AllowBackButton)
|
||||||
{
|
{
|
||||||
case GlobalAction.Back:
|
Exit();
|
||||||
Exit();
|
return true;
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action)
|
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton;
|
||||||
{
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case GlobalAction.Back:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private bool showOverlays = true;
|
private bool showOverlays = true;
|
||||||
public override bool ShowOverlaysOnEnter => showOverlays;
|
public override bool ShowOverlaysOnEnter => showOverlays;
|
||||||
|
protected override bool AllowBackButton => false;
|
||||||
|
|
||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user