1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-21 02:59:53 +08:00

Add Secondary Keys for Mania

This commit is contained in:
Krystian Ptach-Żurakowski
2025-08-30 20:35:51 +02:00
Unverified
parent c26e669fc5
commit 2fb481e2ee
3 changed files with 50 additions and 3 deletions
@@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.Mania
private readonly InputKey[] stage1RightKeys;
private readonly InputKey[] stage2LeftKeys;
private readonly InputKey[] stage2RightKeys;
private readonly InputKey[] stage1SecondaryLeftKeys;
private readonly InputKey[] stage1SecondaryRightKeys;
private readonly InputKey[] stage2SecondaryLeftKeys;
private readonly InputKey[] stage2SecondaryRightKeys;
public DualStageVariantGenerator(int singleStageVariant)
{
@@ -27,6 +32,12 @@ namespace osu.Game.Rulesets.Mania
stage2LeftKeys = new[] { InputKey.S, InputKey.D, InputKey.F, InputKey.G, InputKey.B };
stage2RightKeys = new[] { InputKey.N, InputKey.J, InputKey.K, InputKey.L, InputKey.Semicolon };
stage1SecondaryLeftKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None, InputKey.None };
stage1SecondaryRightKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None, InputKey.None };
stage2SecondaryLeftKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None, InputKey.None };
stage2SecondaryRightKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None, InputKey.None };
}
else
{
@@ -35,6 +46,12 @@ namespace osu.Game.Rulesets.Mania
stage2LeftKeys = new[] { InputKey.S, InputKey.D, InputKey.F, InputKey.G };
stage2RightKeys = new[] { InputKey.J, InputKey.K, InputKey.L, InputKey.Semicolon };
stage1SecondaryLeftKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None };
stage1SecondaryRightKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None };
stage2SecondaryLeftKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None };
stage2SecondaryRightKeys = new[] { InputKey.None, InputKey.None, InputKey.None, InputKey.None };
}
}
@@ -44,14 +61,20 @@ namespace osu.Game.Rulesets.Mania
{
LeftKeys = stage1LeftKeys,
RightKeys = stage1RightKeys,
SecondaryLeftKeys = stage1SecondaryLeftKeys,
SecondaryRightKeys = stage1SecondaryRightKeys,
SpecialKey = InputKey.V,
SecondarySpecialKey = InputKey.Space
}.GenerateKeyBindingsFor(singleStageVariant);
var stage2Bindings = new VariantMappingGenerator
{
LeftKeys = stage2LeftKeys,
RightKeys = stage2RightKeys,
SecondaryLeftKeys = stage2SecondaryLeftKeys,
SecondaryRightKeys = stage2SecondaryRightKeys,
SpecialKey = InputKey.B,
SecondarySpecialKey = InputKey.Enter,
ActionStart = (ManiaAction)singleStageVariant,
}.GenerateKeyBindingsFor(singleStageVariant);
@@ -10,7 +10,9 @@ namespace osu.Game.Rulesets.Mania
{
private readonly int variant;
private readonly InputKey[] leftKeys;
private readonly InputKey[] secondaryLeftKeys;
private readonly InputKey[] rightKeys;
private readonly InputKey[] secondaryRightKeys;
public SingleStageVariantGenerator(int variant)
{
@@ -21,19 +23,26 @@ namespace osu.Game.Rulesets.Mania
{
leftKeys = new[] { InputKey.A, InputKey.S, InputKey.D, InputKey.F, InputKey.V };
rightKeys = new[] { InputKey.N, InputKey.J, InputKey.K, InputKey.L, InputKey.Semicolon };
secondaryLeftKeys = new[] { InputKey.Q, InputKey.W, InputKey.E, InputKey.R, InputKey.G };
secondaryRightKeys = new[] { InputKey.H, InputKey.I, InputKey.O, InputKey.P, InputKey.BracketLeft };
}
else
{
leftKeys = new[] { InputKey.A, InputKey.S, InputKey.D, InputKey.F };
rightKeys = new[] { InputKey.J, InputKey.K, InputKey.L, InputKey.Semicolon };
secondaryLeftKeys = new[] { InputKey.Q, InputKey.W, InputKey.E, InputKey.R };
secondaryRightKeys = new[] { InputKey.I, InputKey.O, InputKey.P, InputKey.BracketLeft };
}
}
public IEnumerable<KeyBinding> GenerateMappings() => new VariantMappingGenerator
{
LeftKeys = leftKeys,
SecondaryLeftKeys = secondaryLeftKeys,
RightKeys = rightKeys,
SecondaryRightKeys = secondaryRightKeys,
SpecialKey = InputKey.Space,
SecondarySpecialKey = InputKey.Enter
}.GenerateKeyBindingsFor(variant);
}
}
@@ -15,16 +15,22 @@ namespace osu.Game.Rulesets.Mania
/// </summary>
public InputKey[] LeftKeys;
public InputKey[] SecondaryLeftKeys;
/// <summary>
/// All the <see cref="InputKey"/>s available to the right hand.
/// </summary>
public InputKey[] RightKeys;
public InputKey[] SecondaryRightKeys;
/// <summary>
/// The <see cref="InputKey"/> for the special key.
/// </summary>
public InputKey SpecialKey;
public InputKey SecondarySpecialKey;
/// <summary>
/// The <see cref="ManiaAction"/> at which the columns should begin.
/// </summary>
@@ -42,13 +48,22 @@ namespace osu.Game.Rulesets.Mania
var bindings = new List<KeyBinding>();
for (int i = LeftKeys.Length - columns / 2; i < LeftKeys.Length; i++)
bindings.Add(new KeyBinding(LeftKeys[i], currentAction++));
{
bindings.Add(new KeyBinding(LeftKeys[i], currentAction));
bindings.Add(new KeyBinding(SecondaryLeftKeys[i], currentAction++));
}
if (columns % 2 == 1)
bindings.Add(new KeyBinding(SpecialKey, currentAction++));
{
bindings.Add(new KeyBinding(SpecialKey, currentAction));
bindings.Add(new KeyBinding(SecondarySpecialKey, currentAction++));
}
for (int i = 0; i < columns / 2; i++)
bindings.Add(new KeyBinding(RightKeys[i], currentAction++));
{
bindings.Add(new KeyBinding(RightKeys[i], currentAction));
bindings.Add(new KeyBinding(SecondaryRightKeys[i], currentAction++));
}
return bindings;
}