mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 17:27:48 +08:00
Add mania bindings.
This commit is contained in:
parent
c1860f2ce2
commit
0e41fc8842
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
@ -8,14 +9,33 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
{
|
{
|
||||||
public class ManiaInputManager : RulesetInputManager<ManiaAction>
|
public class ManiaInputManager : RulesetInputManager<ManiaAction>
|
||||||
{
|
{
|
||||||
public ManiaInputManager(RulesetInfo ruleset)
|
public ManiaInputManager(RulesetInfo ruleset, int variant)
|
||||||
: base(ruleset, 0, SimultaneousBindingMode.Unique)
|
: base(ruleset, variant, SimultaneousBindingMode.Unique)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ManiaAction
|
public enum ManiaAction
|
||||||
{
|
{
|
||||||
// placeholder
|
[Description("Key 1")]
|
||||||
|
Key1,
|
||||||
|
[Description("Key 2")]
|
||||||
|
Key2,
|
||||||
|
[Description("Key 3")]
|
||||||
|
Key3,
|
||||||
|
[Description("Key 4")]
|
||||||
|
Key4,
|
||||||
|
[Description("Key 5")]
|
||||||
|
Key5,
|
||||||
|
[Description("Key 6")]
|
||||||
|
Key6,
|
||||||
|
[Description("Key 7")]
|
||||||
|
Key7,
|
||||||
|
[Description("Key 8")]
|
||||||
|
Key8,
|
||||||
|
[Description("Key 9")]
|
||||||
|
Key9,
|
||||||
|
[Description("Special")]
|
||||||
|
Special
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -120,5 +121,41 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
: base(rulesetInfo)
|
: base(rulesetInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<int> AvailableVariants => new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||||
|
|
||||||
|
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0)
|
||||||
|
{
|
||||||
|
var leftKeys = new[]
|
||||||
|
{
|
||||||
|
InputKey.A,
|
||||||
|
InputKey.S,
|
||||||
|
InputKey.D,
|
||||||
|
InputKey.F
|
||||||
|
};
|
||||||
|
|
||||||
|
var rightKeys = new[]
|
||||||
|
{
|
||||||
|
InputKey.J,
|
||||||
|
InputKey.K,
|
||||||
|
InputKey.L,
|
||||||
|
InputKey.Semicolon
|
||||||
|
};
|
||||||
|
|
||||||
|
ManiaAction currentKey = ManiaAction.Key1;
|
||||||
|
|
||||||
|
var bindings = new List<KeyBinding>();
|
||||||
|
|
||||||
|
for (int i = 0; i < variant / 2; i++)
|
||||||
|
bindings.Add(new KeyBinding(leftKeys[leftKeys.Length - 1 - i], currentKey++));
|
||||||
|
|
||||||
|
for (int i = 0; i < variant / 2; i++)
|
||||||
|
bindings.Add(new KeyBinding(rightKeys[i], currentKey++));
|
||||||
|
|
||||||
|
if (variant % 2 == 1)
|
||||||
|
bindings.Add(new KeyBinding(InputKey.Space, ManiaAction.Special));
|
||||||
|
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this);
|
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this);
|
||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo);
|
public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, availableColumns);
|
||||||
|
|
||||||
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter()
|
protected override BeatmapConverter<ManiaHitObject> CreateBeatmapConverter()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user