mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:57:52 +08:00
Don't match on partial key chords when concurrent is disallowed
This commit is contained in:
parent
d9e36237c7
commit
da50101c25
@ -81,7 +81,7 @@ namespace osu.Game.Input
|
||||
{
|
||||
Binding validBinding;
|
||||
|
||||
if ((validBinding = mappings.Except(pressedBindings).LastOrDefault(m => m.Keys.CheckValid(state.Keyboard.Keys))) != null)
|
||||
if ((validBinding = mappings.Except(pressedBindings).LastOrDefault(m => m.Keys.CheckValid(state.Keyboard.Keys, !allowConcurrentActions))) != null)
|
||||
{
|
||||
// store both the pressed combination and the resulting action, just in case the assignments change while we are actuated.
|
||||
pressedBindings.Add(validBinding);
|
||||
@ -96,7 +96,7 @@ namespace osu.Game.Input
|
||||
{
|
||||
foreach (var binding in pressedBindings.ToList())
|
||||
{
|
||||
if (!binding.Keys.CheckValid(state.Keyboard.Keys))
|
||||
if (!binding.Keys.CheckValid(state.Keyboard.Keys, !allowConcurrentActions))
|
||||
{
|
||||
// set data as KeyUp.
|
||||
state.Data = binding.GetAction<T>();
|
||||
|
@ -30,7 +30,13 @@ namespace osu.Game.Input
|
||||
Keys = stringRepresentation.Split(',').Select(s => (Key)int.Parse(s));
|
||||
}
|
||||
|
||||
public bool CheckValid(IEnumerable<Key> keys) => !Keys.Except(keys).Any();
|
||||
public bool CheckValid(IEnumerable<Key> keys, bool requireExactMatch = false)
|
||||
{
|
||||
if (requireExactMatch)
|
||||
return Keys.SequenceEqual(keys);
|
||||
else
|
||||
return !Keys.Except(keys).Any();
|
||||
}
|
||||
|
||||
public bool Equals(KeyCombination other)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user