Skip to content

Commit

Permalink
Remove linq usage to kill allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Oct 4, 2024
1 parent 2941822 commit e136568
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions osu.Game/Graphics/UserInterface/OsuMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#nullable disable

using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
Expand Down Expand Up @@ -47,10 +46,19 @@ protected override void Update()
{
base.Update();

bool showCheckboxes = Items.Any(i => i is StatefulMenuItem);
bool showCheckboxes = false;

foreach (var drawableItem in ItemsContainer.OfType<DrawableOsuMenuItem>())
drawableItem.ShowCheckbox.Value = showCheckboxes;
foreach (var drawableItem in ItemsContainer)
{
if (drawableItem.Item is StatefulMenuItem)
showCheckboxes = true;
}

foreach (var drawableItem in ItemsContainer)
{
if (drawableItem is DrawableOsuMenuItem osuItem)
osuItem.ShowCheckbox.Value = showCheckboxes;
}
}

protected override void AnimateOpen()
Expand Down

0 comments on commit e136568

Please sign in to comment.