1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 13:23:22 +08:00

Fix KeyBinding updates

This commit is contained in:
Dean Herbert 2017-10-25 18:59:15 +09:00
parent 5001e9f264
commit a5fb700229
2 changed files with 9 additions and 3 deletions

View File

@ -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; }

View File

@ -60,7 +60,7 @@ namespace osu.Game.Input
}
/// <summary>
/// Retrieve <see cref="KeyBinding"/>s for a specified ruleset/variant content.
/// Retrieve <see cref="DatabasedKeyBinding"/>s for a specified ruleset/variant content.
/// </summary>
/// <param name="rulesetId">The ruleset's internal ID.</param>
/// <param name="variant">An optional variant.</param>
@ -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();