// 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 columns should begin. /// public ManiaAction ActionStart; /// /// Generates a list of s for a specific number of columns. /// /// The number of columns that need to be bound. /// The keybindings. public IEnumerable GenerateKeyBindingsFor(int columns) { ManiaAction currentAction = ActionStart; var bindings = new List(); for (int i = LeftKeys.Length - columns / 2; i < LeftKeys.Length; i++) bindings.Add(new KeyBinding(LeftKeys[i], currentAction++)); if (columns % 2 == 1) bindings.Add(new KeyBinding(SpecialKey, currentAction++)); for (int i = 0; i < columns / 2; i++) bindings.Add(new KeyBinding(RightKeys[i], currentAction++)); return bindings; } } }