mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
Fix KeyBinding updates
This commit is contained in:
parent
5001e9f264
commit
a5fb700229
@ -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; }
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user