Remove the necessity for NotificationOverlay to always be present

Now it will only become present when there is a pending notification.
This commit is contained in:
Dean Herbert
2019-06-20 19:06:21 +09:00
parent 9a663715cd
commit 21a1fd738b
2 changed files with 153 additions and 74 deletions

View File

@ -35,8 +35,6 @@ namespace osu.Game.Overlays
Width = width;
RelativeSizeAxes = Axes.Y;
AlwaysPresent = true;
Children = new Drawable[]
{
new Box
@ -100,9 +98,6 @@ namespace osu.Game.Overlays
OverlayActivationMode.BindValueChanged(_ => updateProcessingMode(), true);
}
private int totalCount => sections.Select(c => c.DisplayedCount).Sum();
private int unreadCount => sections.Select(c => c.UnreadCount).Sum();
public readonly BindableInt UnreadCount = new BindableInt();
private int runningDepth;
@ -111,6 +106,8 @@ namespace osu.Game.Overlays
private readonly Scheduler postScheduler = new Scheduler();
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
private bool processingPosts = true;
public void Post(Notification notification) => postScheduler.Add(() =>
@ -160,7 +157,7 @@ namespace osu.Game.Overlays
private void updateCounts()
{
UnreadCount.Value = unreadCount;
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();
}
private void markAllRead()