1
0
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:
Bartłomiej Dach 2024-02-26 16:22:27 +01:00 committed by GitHub
commit 3833f2cfa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -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()
{

View File

@ -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)