mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 20:33:08 +08:00
Fix escape key to exit PlaySongSelect
This is less than ideal but is the least disruptive solution. The InputManager itself holds Escape keypresses from getting to anything else if something is focused.
This commit is contained in:
parent
637a99e8d0
commit
4597a765b8
@ -18,6 +18,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public string Search => searchTextBox.Text;
|
public string Search => searchTextBox.Text;
|
||||||
public SortMode Sort { get; private set; } = SortMode.Title;
|
public SortMode Sort { get; private set; } = SortMode.Title;
|
||||||
|
public Action Exit;
|
||||||
|
|
||||||
private SearchTextBox searchTextBox;
|
private SearchTextBox searchTextBox;
|
||||||
|
|
||||||
@ -50,10 +51,8 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
searchTextBox.OnChange += (sender, text) =>
|
searchTextBox.OnChange += (sender, text) => FilterChanged?.Invoke();
|
||||||
{
|
searchTextBox.Exit = () => Exit?.Invoke();
|
||||||
FilterChanged?.Invoke();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deactivate()
|
public void Deactivate()
|
||||||
|
@ -146,6 +146,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Position = wedged_container_start_position,
|
Position = wedged_container_start_position,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
FilterChanged = filterChanged,
|
FilterChanged = filterChanged,
|
||||||
|
Exit = () => Exit(),
|
||||||
},
|
},
|
||||||
beatmapInfoWedge = new BeatmapInfoWedge
|
beatmapInfoWedge = new BeatmapInfoWedge
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
@ -15,6 +16,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
|
protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
|
||||||
protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);
|
protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);
|
||||||
|
public Action Exit;
|
||||||
public bool GrabFocus = false;
|
public bool GrabFocus = false;
|
||||||
|
|
||||||
private SpriteText placeholder;
|
private SpriteText placeholder;
|
||||||
@ -60,11 +62,6 @@ namespace osu.Game.Screens.Select
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
if (GrabFocus && !HasFocus && IsVisible)
|
if (GrabFocus && !HasFocus && IsVisible)
|
||||||
@ -72,10 +69,16 @@ namespace osu.Game.Screens.Select
|
|||||||
base.Update();
|
base.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnFocusLost(InputState state)
|
||||||
|
{
|
||||||
|
if (state.Keyboard.Keys.Any(key => key == Key.Escape))
|
||||||
|
Exit?.Invoke();
|
||||||
|
base.OnFocusLost(state);
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Key == Key.Left || args.Key == Key.Right
|
if (args.Key == Key.Left || args.Key == Key.Right || args.Key == Key.Enter)
|
||||||
|| args.Key == Key.Enter || args.Key == Key.Escape)
|
|
||||||
return false;
|
return false;
|
||||||
return base.OnKeyDown(state, args);
|
return base.OnKeyDown(state, args);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user