From a5fb70022901054d28863554d29e8f8abffc1790 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Oct 2017 18:59:15 +0900 Subject: [PATCH] Fix KeyBinding updates --- osu.Game/Input/Bindings/DatabasedKeyBinding.cs | 3 ++- osu.Game/Input/KeyBindingStore.cs | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs index c0cecf361d..7e9e25aeff 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs @@ -3,11 +3,12 @@ using System.ComponentModel.DataAnnotations.Schema; using osu.Framework.Input.Bindings; +using osu.Game.Database; namespace osu.Game.Input.Bindings { [Table("KeyBinding")] - public class DatabasedKeyBinding : KeyBinding + public class DatabasedKeyBinding : KeyBinding, IHasPrimaryKey { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ID { get; set; } diff --git a/osu.Game/Input/KeyBindingStore.cs b/osu.Game/Input/KeyBindingStore.cs index 53309fc72d..e21597130a 100644 --- a/osu.Game/Input/KeyBindingStore.cs +++ b/osu.Game/Input/KeyBindingStore.cs @@ -60,7 +60,7 @@ namespace osu.Game.Input } /// - /// Retrieve s for a specified ruleset/variant content. + /// Retrieve s for a specified ruleset/variant content. /// /// The ruleset's internal ID. /// An optional variant. @@ -70,8 +70,13 @@ namespace osu.Game.Input public void Update(KeyBinding keyBinding) { + var dbKeyBinding = (DatabasedKeyBinding)keyBinding; + var context = GetContext(); - context.Update(keyBinding); + + Refresh(ref dbKeyBinding); + + context.Update(dbKeyBinding); context.SaveChanges(); KeyBindingChanged?.Invoke();