1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 11:23:00 +08:00

Reorder defaults to give non-global areas priority for global actions

This commit is contained in:
Dean Herbert 2021-04-07 17:41:05 +09:00
parent afc745f999
commit 08858e6426
2 changed files with 12 additions and 4 deletions

View File

@ -64,12 +64,20 @@ namespace osu.Game.Input.Bindings
protected override void ReloadMappings()
{
var defaults = DefaultKeyBindings.ToList();
if (ruleset != null && !ruleset.ID.HasValue)
// if the provided ruleset is not stored to the database, we have no way to retrieve custom bindings.
// fallback to defaults instead.
KeyBindings = DefaultKeyBindings;
KeyBindings = defaults;
else
KeyBindings = store.Query(ruleset?.ID, variant).ToList();
{
KeyBindings = store.Query(ruleset?.ID, variant)
// this ordering is important to ensure that we read entries from the database in the order
// enforced by DefaultKeyBindings. allow for song select to handle actions that may otherwise
// have been eaten by the music controller due to query order.
.OrderBy(b => defaults.FindIndex(d => (int)d.Action == b.IntAction)).ToList();
}
}
}
}

View File

@ -28,10 +28,10 @@ namespace osu.Game.Input.Bindings
}
public override IEnumerable<IKeyBinding> DefaultKeyBindings => GlobalKeyBindings
.Concat(EditorKeyBindings)
.Concat(InGameKeyBindings)
.Concat(AudioControlKeyBindings)
.Concat(SongSelectKeyBindings)
.Concat(EditorKeyBindings);
.Concat(AudioControlKeyBindings);
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
{