1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Fix notification count including fading (already closed) notifications

This commit is contained in:
Dean Herbert 2017-08-23 12:47:20 +09:00
parent a2407948ed
commit b2db550cb4
3 changed files with 6 additions and 9 deletions

View File

@ -75,7 +75,7 @@ namespace osu.Game.Overlays
private void notificationClosed()
{
// hide ourselves if all notifications have been dismissed.
if (sections.Select(c => c.DisplayedCount).Sum() > 0)
if (sections.Select(c => c.DisplayedCount).Sum() == 0)
State = Visibility.Hidden;
}

View File

@ -142,12 +142,12 @@ namespace osu.Game.Overlays.Notifications
NotificationContent.MoveToX(0, 500, Easing.OutQuint);
}
private bool wasClosed;
public bool WasClosed;
public virtual void Close()
{
if (wasClosed) return;
wasClosed = true;
if (WasClosed) return;
WasClosed = true;
Closed?.Invoke();
this.FadeOut(100);

View File

@ -24,12 +24,9 @@ namespace osu.Game.Overlays.Notifications
private FlowContainer<Notification> notifications;
public int DisplayedCount => notifications.Count;
public int DisplayedCount => notifications.Count(n => !n.WasClosed);
public void Add(Notification notification)
{
notifications.Add(notification);
}
public void Add(Notification notification) => notifications.Add(notification);
public IEnumerable<Type> AcceptTypes;