diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 0a91173c10..ee95c3ea9e 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; using OpenTK.Input; @@ -29,24 +28,7 @@ namespace osu.Game.Overlays.Mods public Action Action; protected virtual Key[] ToggleKeys => new Key[] { }; - - public Mod[] SelectedMods - { - get - { - List selectedMods = new List(); - - foreach (ModButton button in Buttons) - { - Mod selectedMod = button.SelectedMod; - if (selectedMod != null) - selectedMods.Add(selectedMod); - } - - return selectedMods.ToArray(); - } - } - + private string header; public string Header { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 03b3091066..764f58802b 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -3,7 +3,6 @@ using System; using System.Linq; -using System.Collections.Generic; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; @@ -71,7 +70,7 @@ namespace osu.Game.Overlays.Mods }; } - [BackgroundDependencyLoader(permitNulls:true)] + [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours, OsuGame osu) { lowMultiplierColour = colours.Red; @@ -189,17 +188,7 @@ namespace osu.Game.Overlays.Mods private void refreshSelectedMods() { - List selectedMods = new List(); - - foreach (ModSection section in modSectionsContainer.Children) - { - foreach (Mod mod in section.SelectedMods) - { - selectedMods.Add(mod); - } - } - - SelectedMods.Value = selectedMods.ToArray(); + SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray(); } public ModSelectOverlay()