1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Simplify LINQ expressions

This commit is contained in:
Andrei Zavatski 2019-11-12 08:45:21 +03:00
parent fa01e11a6e
commit a69a4643c9

View File

@ -53,12 +53,7 @@ namespace osu.Game.Overlays.BeatmapSet
return;
modsContainer.Add(new ModButton(new NoMod()));
ruleset.NewValue.CreateInstance().GetAllMods().ForEach(mod =>
{
if (mod.Ranked)
modsContainer.Add(new ModButton(mod));
});
modsContainer.AddRange(ruleset.NewValue.CreateInstance().GetAllMods().Where(m => m.Ranked).Select(m => new ModButton(m)));
modsContainer.ForEach(button => button.OnSelectionChanged += selectionChanged);
}
@ -77,11 +72,7 @@ namespace osu.Game.Overlays.BeatmapSet
protected override bool OnHover(HoverEvent e)
{
if (!SelectedMods.Any())
modsContainer.ForEach(button =>
{
if (!button.IsHovered)
button.Highlighted.Value = false;
});
modsContainer.Children.Where(button => !button.IsHovered).ForEach(button => button.Highlighted.Value = false);
return base.OnHover(e);
}