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:
commit
17900fea62
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user