mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 04:02:57 +08:00
Split into a function
This commit is contained in:
parent
bb0f212448
commit
4c3789ec5d
@ -191,38 +191,44 @@ 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)
|
protected override bool OnJoystickPress(JoystickPressEvent e)
|
||||||
{
|
{
|
||||||
if (State == ButtonSystemState.Initial)
|
if (triggerInitialOsuLogo())
|
||||||
{
|
|
||||||
logo?.TriggerClick();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnJoystickPress(e);
|
return base.OnJoystickPress(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMidiDown(MidiDownEvent e)
|
protected override bool OnMidiDown(MidiDownEvent e)
|
||||||
{
|
{
|
||||||
if (State == ButtonSystemState.Initial)
|
if (triggerInitialOsuLogo())
|
||||||
{
|
|
||||||
logo?.TriggerClick();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnMidiDown(e);
|
return base.OnMidiDown(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user