1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Don't pass through repeat events if we've already handled an action

This commit is contained in:
Dean Herbert 2017-08-11 11:46:21 +09:00
parent a93a92a2bb
commit 8ae010f62b

View File

@ -71,18 +71,26 @@ namespace osu.Game.Input
{
bool handled = false;
if (!args.Repeat && (concurrencyMode > ConcurrentActionMode.None || pressedBindings.Count == 0))
if (args.Repeat)
{
Binding validBinding;
if (pressedBindings.Count > 0)
return true;
while ((validBinding = mappings.Except(pressedBindings).LastOrDefault(m => m.Keys.CheckValid(state.Keyboard.Keys, concurrencyMode == ConcurrentActionMode.None))) != null)
{
if (concurrencyMode == ConcurrentActionMode.UniqueAndSameActions || pressedBindings.All(p => p.Action != validBinding.Action))
handled = drawables.OfType<IHandleActions<T>>().Any(d => d.OnPressed(validBinding.GetAction<T>()));
return base.PropagateKeyDown(drawables, state, args);
}
// store both the pressed combination and the resulting action, just in case the assignments change while we are actuated.
pressedBindings.Add(validBinding);
}
if (concurrencyMode == ConcurrentActionMode.None && pressedBindings.Count > 0)
return true;
Binding validBinding;
while ((validBinding = mappings.Except(pressedBindings).LastOrDefault(m => m.Keys.CheckValid(state.Keyboard.Keys, concurrencyMode == ConcurrentActionMode.None))) != null)
{
if (concurrencyMode == ConcurrentActionMode.UniqueAndSameActions || pressedBindings.All(p => p.Action != validBinding.Action))
handled = drawables.OfType<IHandleActions<T>>().Any(d => d.OnPressed(validBinding.GetAction<T>()));
// store both the pressed combination and the resulting action, just in case the assignments change while we are actuated.
pressedBindings.Add(validBinding);
}
return handled || base.PropagateKeyDown(drawables, state, args);