1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:53:15 +08:00
osu-lazer/osu.Game/Input/Binding.cs
Dean Herbert 30bd1d70b5 ActionMapping doesn't support concurrent actions by default
But can when required. Also supports key combination bindings now.
2017-08-10 16:08:43 +09:00

45 lines
1.1 KiB
C#

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Rulesets;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
namespace osu.Game.Input
{
public class Binding
{
[ForeignKey(typeof(RulesetInfo))]
public int? RulesetID { get; set; }
[Indexed]
public int? Variant { get; set; }
[Column("Keys")]
public string KeysString
{
get { return Keys.ToString(); }
set { Keys = value; }
}
[Ignore]
public KeyCombination Keys { get; private set; }
public int Action { get; private set; }
public Binding()
{
}
public Binding(KeyCombination keys, object action)
{
Keys = keys;
Action = (int)action;
}
public virtual T GetAction<T>() => (T)(object)Action;
public override string ToString() => $"{KeysString}=>{Action}";
}
}