diff --git a/osu.Game/Overlays/Mods/AssistedSection.cs b/osu.Game/Overlays/Mods/AssistedSection.cs index 86065fb7e7..a8c4b1909f 100644 --- a/osu.Game/Overlays/Mods/AssistedSection.cs +++ b/osu.Game/Overlays/Mods/AssistedSection.cs @@ -4,12 +4,14 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes; namespace osu.Game.Overlays.Mods { public class AssistedSection : ModSection { protected override Key[] ToggleKeys => new Key[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; + public override ModType ModType => ModType.Special; [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs index 62237812c4..295eb4e173 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs @@ -4,12 +4,14 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes; namespace osu.Game.Overlays.Mods { public class DifficultyIncreaseSection : ModSection { protected override Key[] ToggleKeys => new Key[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }; + public override ModType ModType => ModType.DifficultyIncrease; [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs index f130617701..4e7f13867e 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/DifficultyReductionSection.cs @@ -4,12 +4,14 @@ using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; +using osu.Game.Modes; namespace osu.Game.Overlays.Mods { public class DifficultyReductionSection : ModSection { protected override Key[] ToggleKeys => new Key[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }; + public override ModType ModType => ModType.DifficultyReduction; [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 7e08d02541..4def201f25 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -22,6 +22,7 @@ namespace osu.Game.Overlays.Mods public Action Action; protected abstract Key[] ToggleKeys { get; } + public abstract ModType ModType { get; } public string Header { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 10f98275d1..ec7d8add76 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -41,34 +41,8 @@ namespace osu.Game.Overlays.Mods private void modeChanged(object sender, EventArgs eventArgs) { var ruleset = Ruleset.GetRuleset(PlayMode); - - modSectionsContainer.Children = new ModSection[] - { - new DifficultyReductionSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(), - }, - new DifficultyIncreaseSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(), - }, - new AssistedSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(), - }, - }; + foreach (ModSection section in modSectionsContainer.Children) + section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray(); } [BackgroundDependencyLoader(permitNulls: true)] @@ -298,6 +272,30 @@ namespace osu.Game.Overlays.Mods AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 10f), Width = content_width, + Children = new ModSection[] + { + new DifficultyReductionSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + new DifficultyIncreaseSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + new AssistedSection + { + RelativeSizeAxes = Axes.X, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Action = modButtonPressed, + }, + } }, // Footer new Container