mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 17:02:55 +08:00
Extract common implementation into private method
This commit is contained in:
parent
7e73af1c5a
commit
cc9db90d11
@ -129,13 +129,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
var button = buttons[i++];
|
||||
button.UpdateKeyCombination(d);
|
||||
|
||||
using (var usage = realmFactory.GetForWrite())
|
||||
{
|
||||
var binding = usage.Realm.Find<RealmKeyBinding>(((IHasGuidPrimaryKey)button.KeyBinding).ID.ToString());
|
||||
binding.KeyCombinationString = button.KeyBinding.KeyCombinationString;
|
||||
|
||||
usage.Commit();
|
||||
}
|
||||
updateStoreFromButton(button);
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,13 +288,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
{
|
||||
if (bindTarget != null)
|
||||
{
|
||||
using (var write = realmFactory.GetForWrite())
|
||||
{
|
||||
var binding = write.Realm.Find<RealmKeyBinding>(((IHasGuidPrimaryKey)bindTarget.KeyBinding).ID.ToString());
|
||||
binding.KeyCombinationString = bindTarget.KeyBinding.KeyCombinationString;
|
||||
|
||||
write.Commit();
|
||||
}
|
||||
updateStoreFromButton(bindTarget);
|
||||
|
||||
bindTarget.IsBinding = false;
|
||||
Schedule(() =>
|
||||
@ -345,6 +333,17 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
if (bindTarget != null) bindTarget.IsBinding = true;
|
||||
}
|
||||
|
||||
private void updateStoreFromButton(KeyButton button)
|
||||
{
|
||||
using (var usage = realmFactory.GetForWrite())
|
||||
{
|
||||
var binding = usage.Realm.Find<RealmKeyBinding>(((IHasGuidPrimaryKey)button.KeyBinding).ID.ToString());
|
||||
binding.KeyCombinationString = button.KeyBinding.KeyCombinationString;
|
||||
|
||||
usage.Commit();
|
||||
}
|
||||
}
|
||||
|
||||
private class CancelButton : TriangleButton
|
||||
{
|
||||
public CancelButton()
|
||||
|
Loading…
Reference in New Issue
Block a user