1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Merge pull request #1173 from peppy/fix-incorrect-notification-count

Fix notification count including fading (already closed) notifications
This commit is contained in:
Dean Herbert 2017-08-23 17:29:58 +09:00 committed by GitHub
commit 17900fea62
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;