mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 08:12:56 +08:00
Reduce allocation overhead when notification overlay has visible notifications
This commit is contained in:
parent
119b4e8174
commit
3e65dfb9e7
@ -10,9 +10,9 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Notifications
|
namespace osu.Game.Overlays.Notifications
|
||||||
{
|
{
|
||||||
@ -122,7 +122,20 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
countDrawable.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
|
countDrawable.Text = getVisibleCount().ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getVisibleCount()
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
foreach (var c in notifications)
|
||||||
|
{
|
||||||
|
if (c.Alpha > 0.99f)
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ClearAllButton : OsuClickableContainer
|
private class ClearAllButton : OsuClickableContainer
|
||||||
|
Loading…
Reference in New Issue
Block a user