mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Detach at point of usage, rather than point of retrieval
This commit is contained in:
parent
536e7229d0
commit
8f9b19a76e
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Input.Bindings
|
||||
@ -63,7 +64,7 @@ namespace osu.Game.Input.Bindings
|
||||
// fallback to defaults instead.
|
||||
KeyBindings = DefaultKeyBindings;
|
||||
else
|
||||
KeyBindings = store.Query(ruleset?.ID, variant);
|
||||
KeyBindings = store.Query(ruleset?.ID, variant).Detach();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,13 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.KeyBinding
|
||||
{
|
||||
@ -34,14 +35,14 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RealmKeyBindingStore store)
|
||||
{
|
||||
var bindings = store.Query(Ruleset?.ID, variant);
|
||||
var bindings = store.Query(Ruleset?.ID, variant).Detach();
|
||||
|
||||
foreach (var defaultGroup in Defaults.GroupBy(d => d.Action))
|
||||
{
|
||||
int intKey = (int)defaultGroup.Key;
|
||||
|
||||
// one row per valid action.
|
||||
Add(new KeyBindingRow(defaultGroup.Key, bindings.Where(b => ((int)b.Action).Equals(intKey)))
|
||||
Add(new KeyBindingRow(defaultGroup.Key, bindings.Where(b => b.Action.Equals(intKey)))
|
||||
{
|
||||
AllowMainMouseButtons = Ruleset != null,
|
||||
Defaults = defaultGroup.Select(d => d.KeyCombination)
|
||||
|
Loading…
Reference in New Issue
Block a user