2021-01-07 13:35:15 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Input.Bindings;
|
|
|
|
using osu.Game.Database;
|
|
|
|
using Realms;
|
|
|
|
|
|
|
|
namespace osu.Game.Input.Bindings
|
|
|
|
{
|
|
|
|
[MapTo("KeyBinding")]
|
2021-01-08 14:49:01 +08:00
|
|
|
public class RealmKeyBinding : RealmObject, IHasGuidPrimaryKey, IKeyBinding
|
2021-01-07 13:35:15 +08:00
|
|
|
{
|
2021-01-08 14:49:01 +08:00
|
|
|
[PrimaryKey]
|
2021-01-07 14:41:58 +08:00
|
|
|
public string ID { get; set; }
|
2021-01-07 13:35:15 +08:00
|
|
|
|
|
|
|
public int? RulesetID { get; set; }
|
|
|
|
|
|
|
|
public int? Variant { get; set; }
|
|
|
|
|
2021-01-08 14:49:01 +08:00
|
|
|
KeyCombination IKeyBinding.KeyCombination
|
|
|
|
{
|
|
|
|
get => KeyCombination;
|
|
|
|
set => KeyCombination = value.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
object IKeyBinding.Action
|
|
|
|
{
|
|
|
|
get => Action;
|
|
|
|
set => Action = (int)value;
|
|
|
|
}
|
|
|
|
|
2021-01-07 15:53:36 +08:00
|
|
|
public int Action { get; set; }
|
|
|
|
|
|
|
|
public string KeyCombination { get; set; }
|
|
|
|
|
2021-01-07 13:35:15 +08:00
|
|
|
[Ignored]
|
|
|
|
public KeyBinding KeyBinding
|
|
|
|
{
|
2021-01-07 15:53:36 +08:00
|
|
|
get => new KeyBinding(KeyCombination, Action);
|
|
|
|
set
|
2021-01-07 13:35:15 +08:00
|
|
|
{
|
2021-01-07 15:53:36 +08:00
|
|
|
KeyCombination = value.KeyCombination.ToString();
|
|
|
|
Action = (int)value.Action;
|
2021-01-07 13:35:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|