1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 05:07:28 +08:00

Merge pull request #19005 from Susko3/initial-cookie

Allow MIDI and joysticks to trigger the osu! cookie on the initial screen
This commit is contained in:
Dean Herbert 2022-07-05 19:26:56 +09:00 committed by GitHub
commit 85e589f863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -191,20 +191,48 @@ namespace osu.Game.Screens.Menu
State = ButtonSystemState.Initial; State = ButtonSystemState.Initial;
} }
protected override bool OnKeyDown(KeyDownEvent e) /// <summary>
/// Triggers the <see cref="logo"/> if the current <see cref="State"/> is <see cref="ButtonSystemState.Initial"/>.
/// </summary>
/// <returns><c>true</c> if the <see cref="logo"/> was triggered, <c>false</c> otherwise.</returns>
private bool triggerInitialOsuLogo()
{ {
if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed || e.SuperPressed)
return false;
if (State == ButtonSystemState.Initial) if (State == ButtonSystemState.Initial)
{ {
logo?.TriggerClick(); logo?.TriggerClick();
return true; return true;
} }
return false;
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Repeat || e.ControlPressed || e.ShiftPressed || e.AltPressed || e.SuperPressed)
return false;
if (triggerInitialOsuLogo())
return true;
return base.OnKeyDown(e); return base.OnKeyDown(e);
} }
protected override bool OnJoystickPress(JoystickPressEvent e)
{
if (triggerInitialOsuLogo())
return true;
return base.OnJoystickPress(e);
}
protected override bool OnMidiDown(MidiDownEvent e)
{
if (triggerInitialOsuLogo())
return true;
return base.OnMidiDown(e);
}
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e) public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{ {
if (e.Repeat) if (e.Repeat)