mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Change to use ReadableKeyCombinationProvider
Changes all usages of `KeyCombination.ReadableString()` to `ReadableKeyCombinationProvider.GetReadableString()`. Subscribing to `KeymapChanged` is only required in `KeyButton`. All other places query `GetReadableString()` every time.
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Input.Bindings;
|
||||
@ -16,10 +17,12 @@ namespace osu.Game.Input
|
||||
public class RealmKeyBindingStore
|
||||
{
|
||||
private readonly RealmContextFactory realmFactory;
|
||||
private readonly ReadableKeyCombinationProvider readableKeyCombinationProvider;
|
||||
|
||||
public RealmKeyBindingStore(RealmContextFactory realmFactory)
|
||||
public RealmKeyBindingStore(RealmContextFactory realmFactory, ReadableKeyCombinationProvider readableKeyCombinationProvider)
|
||||
{
|
||||
this.realmFactory = realmFactory;
|
||||
this.readableKeyCombinationProvider = readableKeyCombinationProvider;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -35,7 +38,7 @@ namespace osu.Game.Input
|
||||
{
|
||||
foreach (var action in context.All<RealmKeyBinding>().Where(b => b.RulesetID == null && (GlobalAction)b.ActionInt == globalAction))
|
||||
{
|
||||
string str = action.KeyCombination.ReadableString();
|
||||
string str = readableKeyCombinationProvider.GetReadableString(action.KeyCombination);
|
||||
|
||||
// even if found, the readable string may be empty for an unbound action.
|
||||
if (str.Length > 0)
|
||||
|
Reference in New Issue
Block a user