1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +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() private void notificationClosed()
{ {
// hide ourselves if all notifications have been dismissed. // 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; State = Visibility.Hidden;
} }

View File

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

View File

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