// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System.Collections.Generic; using osu.Framework.Input.Bindings; namespace osu.Game.Rulesets.Mania { public class VariantMappingGenerator { /// /// All the s available to the left hand. /// public InputKey[] LeftKeys; /// /// All the s available to the right hand. /// public InputKey[] RightKeys; /// /// The for the special key. /// public InputKey SpecialKey; /// /// The at which the normal columns should begin. /// public ManiaAction NormalActionStart; /// /// The for the special column. /// public ManiaAction SpecialAction; /// /// Generates a list of s for a specific number of columns. /// /// The number of columns that need to be bound. /// The next to use for normal columns. /// The keybindings. public IEnumerable GenerateKeyBindingsFor(int columns, out ManiaAction nextNormalAction) { ManiaAction currentNormalAction = NormalActionStart; var bindings = new List(); for (int i = LeftKeys.Length - columns / 2; i < LeftKeys.Length; i++) bindings.Add(new KeyBinding(LeftKeys[i], currentNormalAction++)); if (columns % 2 == 1) bindings.Add(new KeyBinding(SpecialKey, SpecialAction)); for (int i = 0; i < columns / 2; i++) bindings.Add(new KeyBinding(RightKeys[i], currentNormalAction++)); nextNormalAction = currentNormalAction; return bindings; } } }