mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:17:51 +08:00
Merge pull request #27393 from peppy/main-menu-key-delay
Fix main menu eating keys if user presses too fast
This commit is contained in:
commit
3833f2cfa7
@ -28,6 +28,21 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddAssert("state is top level", () => buttons.State == ButtonSystemState.TopLevel);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFastShortcutKeys()
|
||||
{
|
||||
AddAssert("state is initial", () => buttons.State == ButtonSystemState.Initial);
|
||||
|
||||
AddStep("press P three times", () =>
|
||||
{
|
||||
InputManager.Key(Key.P);
|
||||
InputManager.Key(Key.P);
|
||||
InputManager.Key(Key.P);
|
||||
});
|
||||
|
||||
AddAssert("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestShortcutKeys()
|
||||
{
|
||||
|
@ -64,6 +64,10 @@ namespace osu.Game.Screens.Menu
|
||||
private Sample? sampleHover;
|
||||
private SampleChannel? sampleChannel;
|
||||
|
||||
public override bool IsPresent => base.IsPresent
|
||||
// Allow keyboard interaction based on state rather than waiting for delayed animations.
|
||||
|| state == ButtonState.Expanded;
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
public MainMenuButton(LocalisableString text, string sampleName, IconUsage symbol, Color4 colour, Action? clickAction = null, float extraWidth = 0, params Key[] triggerKeys)
|
||||
|
Loading…
Reference in New Issue
Block a user