mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 13:42:54 +08:00
Add variant for rulesets with more than one possible key layout
This commit is contained in:
parent
7c0e7ebcd0
commit
f21b370f4e
@ -10,6 +10,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using SQLite.Net;
|
using SQLite.Net;
|
||||||
|
using SQLite.Net.Attributes;
|
||||||
using SQLiteNetExtensions.Attributes;
|
using SQLiteNetExtensions.Attributes;
|
||||||
|
|
||||||
namespace osu.Game.Input
|
namespace osu.Game.Input
|
||||||
@ -19,9 +20,12 @@ namespace osu.Game.Input
|
|||||||
{
|
{
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
protected ActionMappingInputManager(RulesetInfo ruleset = null)
|
private readonly int? variant;
|
||||||
|
|
||||||
|
protected ActionMappingInputManager(RulesetInfo ruleset = null, int? variant = null)
|
||||||
{
|
{
|
||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset;
|
||||||
|
this.variant = variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IDictionary<Key, T> Mappings { get; set; }
|
protected IDictionary<Key, T> Mappings { get; set; }
|
||||||
@ -30,7 +34,7 @@ namespace osu.Game.Input
|
|||||||
private void load(BindingStore bindings)
|
private void load(BindingStore bindings)
|
||||||
{
|
{
|
||||||
var rulesetId = ruleset?.ID;
|
var rulesetId = ruleset?.ID;
|
||||||
foreach (var b in bindings.Query<Binding>(b => b.RulesetID == rulesetId))
|
foreach (var b in bindings.Query<Binding>(b => b.RulesetID == rulesetId && b.Variant == variant))
|
||||||
Mappings[b.Key] = (T)(object)b.Action;
|
Mappings[b.Key] = (T)(object)b.Action;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +73,9 @@ namespace osu.Game.Input
|
|||||||
[ForeignKey(typeof(RulesetInfo))]
|
[ForeignKey(typeof(RulesetInfo))]
|
||||||
public int? RulesetID { get; set; }
|
public int? RulesetID { get; set; }
|
||||||
|
|
||||||
|
[Indexed]
|
||||||
|
public int? Variant { get; set; }
|
||||||
|
|
||||||
public Key Key { get; set; }
|
public Key Key { get; set; }
|
||||||
|
|
||||||
public int Action { get; set; }
|
public int Action { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user