Switch realm ruleset key bindings to use ruleset's ShortName as key

This commit is contained in:
Dean Herbert
2021-11-22 18:34:04 +09:00
parent 329bae50b0
commit d94b27a8a2
7 changed files with 53 additions and 26 deletions

View File

@ -50,23 +50,20 @@ namespace osu.Game.Input.Bindings
protected override void LoadComplete()
{
if (ruleset == null || ruleset.ID.HasValue)
{
int? rulesetId = ruleset?.ID;
string rulesetName = ruleset?.ShortName;
realmKeyBindings = realmFactory.Context.All<RealmKeyBinding>()
.Where(b => b.RulesetID == rulesetId && b.Variant == variant);
realmKeyBindings = realmFactory.Context.All<RealmKeyBinding>()
.Where(b => b.RulesetName == rulesetName && b.Variant == variant);
realmSubscription = realmKeyBindings
.SubscribeForNotifications((sender, changes, error) =>
{
// first subscription ignored as we are handling this in LoadComplete.
if (changes == null)
return;
realmSubscription = realmKeyBindings
.SubscribeForNotifications((sender, changes, error) =>
{
// first subscription ignored as we are handling this in LoadComplete.
if (changes == null)
return;
ReloadMappings();
});
}
ReloadMappings();
});
base.LoadComplete();
}