1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Split into a function

This commit is contained in:
Susko3 2022-07-05 11:15:37 +02:00
parent bb0f212448
commit 4c3789ec5d

View File

@ -191,38 +191,44 @@ namespace osu.Game.Screens.Menu
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)
{
logo?.TriggerClick();
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);
}
protected override bool OnJoystickPress(JoystickPressEvent e)
{
if (State == ButtonSystemState.Initial)
{
logo?.TriggerClick();
if (triggerInitialOsuLogo())
return true;
}
return base.OnJoystickPress(e);
}
protected override bool OnMidiDown(MidiDownEvent e)
{
if (State == ButtonSystemState.Initial)
{
logo?.TriggerClick();
if (triggerInitialOsuLogo())
return true;
}
return base.OnMidiDown(e);
}