1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Solo -> Single, Coop -> Dual

This commit is contained in:
smoogipoo 2018-01-22 14:57:25 +09:00
parent 3b47c0fea0
commit 286b1bb81f
3 changed files with 16 additions and 13 deletions

View File

@ -124,9 +124,9 @@ namespace osu.Game.Rulesets.Mania
get get
{ {
for (int i = 1; i <= 9; i++) for (int i = 1; i <= 9; i++)
yield return (int)ManiaKeyBindingVariantType.Solo + i; yield return (int)ManiaKeyBindingVariantType.Single + i;
for (int i = 2; i <= 18; i++) for (int i = 2; i <= 18; i++)
yield return (int)ManiaKeyBindingVariantType.Coop + i; yield return (int)ManiaKeyBindingVariantType.Dual + i;
} }
} }
@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Mania
{ {
switch (getVariantType(variant)) switch (getVariantType(variant))
{ {
case ManiaKeyBindingVariantType.Solo: case ManiaKeyBindingVariantType.Single:
return new VariantMappingGenerator return new VariantMappingGenerator
{ {
LeftKeys = new[] LeftKeys = new[]
@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Mania
SpecialAction = ManiaAction.Special1, SpecialAction = ManiaAction.Special1,
NormalActionStart = ManiaAction.Key1, NormalActionStart = ManiaAction.Key1,
}.GenerateKeyBindingsFor(variant, out _); }.GenerateKeyBindingsFor(variant, out _);
case ManiaKeyBindingVariantType.Coop: case ManiaKeyBindingVariantType.Dual:
getDualStageKeyCounts(variant, out int s1K, out int s2K); getDualStageKeyCounts(variant, out int s1K, out int s2K);
var stage1Bindings = new VariantMappingGenerator var stage1Bindings = new VariantMappingGenerator
@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Mania
{ {
default: default:
return $"{variant}K"; return $"{variant}K";
case ManiaKeyBindingVariantType.Coop: case ManiaKeyBindingVariantType.Dual:
{ {
getDualStageKeyCounts(variant, out int s1K, out int s2K); getDualStageKeyCounts(variant, out int s1K, out int s2K);
return $"{s1K}K + {s2K}K"; return $"{s1K}K + {s2K}K";
@ -221,14 +221,14 @@ namespace osu.Game.Rulesets.Mania
} }
/// <summary> /// <summary>
/// Finds the number of keys for each stage in a <see cref="ManiaKeyBindingVariantType.Coop"/> variant. /// Finds the number of keys for each stage in a <see cref="ManiaKeyBindingVariantType.Dual"/> variant.
/// </summary> /// </summary>
/// <param name="variant">The variant.</param> /// <param name="variant">The variant.</param>
/// <param name="stage1">The number of keys for the first stage.</param> /// <param name="stage1">The number of keys for the first stage.</param>
/// <param name="stage2">The number of keys for the second stage.</param> /// <param name="stage2">The number of keys for the second stage.</param>
private void getDualStageKeyCounts(int variant, out int stage1, out int stage2) private void getDualStageKeyCounts(int variant, out int stage1, out int stage2)
{ {
int totalKeys = variant - (int)ManiaKeyBindingVariantType.Coop; int totalKeys = variant - (int)ManiaKeyBindingVariantType.Dual;
stage1 = (int)Math.Ceiling(totalKeys / 2f); stage1 = (int)Math.Ceiling(totalKeys / 2f);
stage2 = (int)Math.Floor(totalKeys / 2f); stage2 = (int)Math.Floor(totalKeys / 2f);
} }
@ -300,12 +300,15 @@ namespace osu.Game.Rulesets.Mania
public enum ManiaKeyBindingVariantType public enum ManiaKeyBindingVariantType
{ {
/// <summary> /// <summary>
/// Solo play keybinding variant (single stage). /// A single stage.
/// Number of columns in this stage lies at (item - Single).
/// </summary> /// </summary>
Solo = 0, Single = 0,
/// <summary> /// <summary>
/// Co-op play keybinding variant (multiple stages). /// A split stage.
/// Overall number of columns lies at (item - Dual), further computation is required for
/// number of columns in each individual stage.
/// </summary> /// </summary>
Coop = 1000, Dual = 1000,
} }
} }

View File

@ -45,6 +45,6 @@ namespace osu.Game.Rulesets.Mania.Mods
mrc.Beatmap.Stages = newDefinitions; mrc.Beatmap.Stages = newDefinitions;
} }
public ManiaKeyBindingVariantType Variant => ManiaKeyBindingVariantType.Coop; public ManiaKeyBindingVariantType Variant => ManiaKeyBindingVariantType.Dual;
} }
} }

View File

@ -79,7 +79,7 @@ namespace osu.Game.Rulesets.Mania.UI
public override PassThroughInputManager CreateInputManager() public override PassThroughInputManager CreateInputManager()
{ {
var variantType = Mods.OfType<IKeyBindingMod>().FirstOrDefault()?.Variant ?? ManiaKeyBindingVariantType.Solo; var variantType = Mods.OfType<IKeyBindingMod>().FirstOrDefault()?.Variant ?? ManiaKeyBindingVariantType.Single;
return new ManiaInputManager(Ruleset.RulesetInfo, (int)variantType + Beatmap.TotalColumns); return new ManiaInputManager(Ruleset.RulesetInfo, (int)variantType + Beatmap.TotalColumns);
} }