mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 05:03:20 +08:00
Use both OnKeyDown and GlobalAction.Back
This commit is contained in:
parent
e802b722f0
commit
f2f2fb8c73
@ -19,6 +19,8 @@ namespace osu.Game.Screens
|
||||
|
||||
public override bool ShowOverlaysOnEnter => false;
|
||||
|
||||
protected override bool AllowBackButton => false;
|
||||
|
||||
public Loader()
|
||||
{
|
||||
ValidForResume = false;
|
||||
|
@ -26,6 +26,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public override bool ShowOverlaysOnEnter => buttons.State != MenuState.Initial;
|
||||
|
||||
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
|
||||
|
||||
private readonly BackgroundScreenDefault background;
|
||||
private Screen songSelect;
|
||||
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -15,6 +16,7 @@ using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Menu;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
@ -105,6 +107,20 @@ namespace osu.Game.Screens
|
||||
|
||||
public bool OnReleased(GlobalAction action) => action == GlobalAction.Back && AllowBackButton;
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (args.Repeat || !IsCurrentScreen) return false;
|
||||
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Escape:
|
||||
Exit();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
protected override void OnResuming(Screen last)
|
||||
{
|
||||
sampleExit?.Play();
|
||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Screens.Play
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
||||
public override bool AllowBeatmapRulesetChange => false;
|
||||
protected override bool AllowBackButton => false;
|
||||
|
||||
protected const float BACKGROUND_FADE_DURATION = 800;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user