mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 20:52:54 +08:00
Forward entire event to IModHotkeyHandler
Required for shift handling in the classic implementation.
This commit is contained in:
parent
143c8e8da6
commit
234120ff43
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osuTK.Input;
|
using osu.Framework.Input.Events;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods.Input
|
namespace osu.Game.Overlays.Mods.Input
|
||||||
{
|
{
|
||||||
@ -11,6 +11,6 @@ namespace osu.Game.Overlays.Mods.Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ClassicModHotkeyHandler : IModHotkeyHandler
|
public class ClassicModHotkeyHandler : IModHotkeyHandler
|
||||||
{
|
{
|
||||||
public bool HandleHotkeyPressed(Key hotkey, IEnumerable<ModState> availableMods) => false; // TODO
|
public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable<ModState> availableMods) => false; // TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osuTK.Input;
|
using osu.Framework.Input.Events;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods.Input
|
namespace osu.Game.Overlays.Mods.Input
|
||||||
{
|
{
|
||||||
@ -12,11 +12,11 @@ namespace osu.Game.Overlays.Mods.Input
|
|||||||
public interface IModHotkeyHandler
|
public interface IModHotkeyHandler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempt to handle a press of the supplied <paramref name="hotkey"/> as a selection of one of the mods in <paramref name="availableMods"/>.
|
/// Attempt to handle the supplied <see cref="KeyDownEvent"/> as a selection of one of the mods in <paramref name="availableMods"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hotkey">The key that was pressed by the user.</param>
|
/// <param name="e">The event representing the user's keypress.</param>
|
||||||
/// <param name="availableMods">The list of currently available mods.</param>
|
/// <param name="availableMods">The list of currently available mods.</param>
|
||||||
/// <returns>Whether the <paramref name="hotkey"/> was handled as a mod selection/deselection.</returns>
|
/// <returns>Whether the supplied event was handled as a mod selection/deselection.</returns>
|
||||||
bool HandleHotkeyPressed(Key hotkey, IEnumerable<ModState> availableMods);
|
bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable<ModState> availableMods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osuTK.Input;
|
using osu.Framework.Input.Events;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods.Input
|
namespace osu.Game.Overlays.Mods.Input
|
||||||
{
|
{
|
||||||
@ -12,6 +12,6 @@ namespace osu.Game.Overlays.Mods.Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class NoopModHotkeyHandler : IModHotkeyHandler
|
public class NoopModHotkeyHandler : IModHotkeyHandler
|
||||||
{
|
{
|
||||||
public bool HandleHotkeyPressed(Key hotkey, IEnumerable<ModState> availableMods) => false;
|
public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable<ModState> availableMods) => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
@ -41,9 +42,9 @@ namespace osu.Game.Overlays.Mods.Input
|
|||||||
toggleKeys = keys;
|
toggleKeys = keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HandleHotkeyPressed(Key hotkey, IEnumerable<ModState> availableMods)
|
public bool HandleHotkeyPressed(KeyDownEvent e, IEnumerable<ModState> availableMods)
|
||||||
{
|
{
|
||||||
int index = Array.IndexOf(toggleKeys, hotkey);
|
int index = Array.IndexOf(toggleKeys, e.Key);
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.Repeat)
|
if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.Repeat)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return hotkeyHandler.HandleHotkeyPressed(e.Key, availableMods);
|
return hotkeyHandler.HandleHotkeyPressed(e, availableMods);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
Reference in New Issue
Block a user