mirror of
https://github.com/ppy/osu.git
synced 2026-05-24 06:19:55 +08:00
revert: changes made for preset hotkeys in SequentialModHotkeyHandler
This commit is contained in:
@@ -12,10 +12,10 @@ namespace osu.Game.Overlays.Mods.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// This implementation of <see cref="IModHotkeyHandler"/> receives a sequence of <see cref="Key"/>s,
|
||||
/// and maps the sequence of keys onto the items it is provided in <see cref="HandleModHotkeyPressed"/> and <see cref="HandlePresetHotkeyPressed"/>.
|
||||
/// and maps the sequence of keys onto the items it is provided in <see cref="HandleModHotkeyPressed"/>.
|
||||
/// In this case, particular mods are not bound to particular keys, the hotkeys are a byproduct of mod ordering.
|
||||
/// </summary>
|
||||
public class SequentialModHotkeyHandler : IModHotkeyHandler, IPresetHotkeyHandler
|
||||
public class SequentialModHotkeyHandler : IModHotkeyHandler
|
||||
{
|
||||
public static SequentialModHotkeyHandler Create(ModType modType)
|
||||
{
|
||||
@@ -35,11 +35,6 @@ namespace osu.Game.Overlays.Mods.Input
|
||||
}
|
||||
}
|
||||
|
||||
public static SequentialModHotkeyHandler CreateForPresets()
|
||||
{
|
||||
return new SequentialModHotkeyHandler(new[] { Key.Number1, Key.Number2, Key.Number3, Key.Number4, Key.Number5, Key.Number6, Key.Number7, Key.Number8, Key.Number9, Key.Number0 });
|
||||
}
|
||||
|
||||
private readonly Key[] toggleKeys;
|
||||
|
||||
private SequentialModHotkeyHandler(Key[] keys)
|
||||
@@ -60,20 +55,5 @@ namespace osu.Game.Overlays.Mods.Input
|
||||
modState.Active.Toggle();
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool HandlePresetHotkeyPressed(KeyDownEvent e, IEnumerable<ModPresetPanel> availablePresets)
|
||||
{
|
||||
int index = Array.IndexOf(toggleKeys, e.Key);
|
||||
if (index < 0)
|
||||
return false;
|
||||
|
||||
var panel = availablePresets.ElementAtOrDefault(index);
|
||||
if (panel == null)
|
||||
return false;
|
||||
|
||||
panel.Toggle();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user