mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 12:45:09 +08:00
Fix KeyBinding updates
This commit is contained in:
parent
5001e9f264
commit
a5fb700229
@ -3,11 +3,12 @@
|
|||||||
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Input.Bindings
|
namespace osu.Game.Input.Bindings
|
||||||
{
|
{
|
||||||
[Table("KeyBinding")]
|
[Table("KeyBinding")]
|
||||||
public class DatabasedKeyBinding : KeyBinding
|
public class DatabasedKeyBinding : KeyBinding, IHasPrimaryKey
|
||||||
{
|
{
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Input
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve <see cref="KeyBinding"/>s for a specified ruleset/variant content.
|
/// Retrieve <see cref="DatabasedKeyBinding"/>s for a specified ruleset/variant content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rulesetId">The ruleset's internal ID.</param>
|
/// <param name="rulesetId">The ruleset's internal ID.</param>
|
||||||
/// <param name="variant">An optional variant.</param>
|
/// <param name="variant">An optional variant.</param>
|
||||||
@ -70,8 +70,13 @@ namespace osu.Game.Input
|
|||||||
|
|
||||||
public void Update(KeyBinding keyBinding)
|
public void Update(KeyBinding keyBinding)
|
||||||
{
|
{
|
||||||
|
var dbKeyBinding = (DatabasedKeyBinding)keyBinding;
|
||||||
|
|
||||||
var context = GetContext();
|
var context = GetContext();
|
||||||
context.Update(keyBinding);
|
|
||||||
|
Refresh(ref dbKeyBinding);
|
||||||
|
|
||||||
|
context.Update(dbKeyBinding);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
KeyBindingChanged?.Invoke();
|
KeyBindingChanged?.Invoke();
|
||||||
|
Loading…
Reference in New Issue
Block a user