diff --git a/osu.Game/Overlays/NotificationOverlayToastTray.cs b/osu.Game/Overlays/NotificationOverlayToastTray.cs index 0ebaff9437..e019b31620 100644 --- a/osu.Game/Overlays/NotificationOverlayToastTray.cs +++ b/osu.Game/Overlays/NotificationOverlayToastTray.cs @@ -24,16 +24,16 @@ namespace osu.Game.Overlays /// public partial class NotificationOverlayToastTray : CompositeDrawable { - public override bool IsPresent => toastContentBackground.Height > 0 || toastFlow.Count > 0; + public override bool IsPresent => toastContentBackground.Height > 0 || Notifications.Any(); public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => toastFlow.ReceivePositionalInputAt(screenSpacePos); /// /// All notifications currently being displayed by the toast tray. /// - public IEnumerable Notifications => toastFlow; + public IEnumerable Notifications => toastFlow.Concat(InternalChildren.OfType()); - public bool IsDisplayingToasts => toastFlow.Count > 0; + public bool IsDisplayingToasts => Notifications.Any(); private FillFlowContainer toastFlow = null!; private BufferedContainer toastContentBackground = null!; @@ -43,12 +43,7 @@ namespace osu.Game.Overlays public Action? ForwardNotificationToPermanentStore { get; set; } - public int UnreadCount => allDisplayedNotifications.Count(n => !n.WasClosed && !n.Read); - - /// - /// Notifications contained in the toast flow, or in a detached state while they animate during forwarding to the main overlay. - /// - private IEnumerable allDisplayedNotifications => toastFlow.Concat(InternalChildren.OfType()); + public int UnreadCount => Notifications.Count(n => !n.WasClosed && !n.Read); private int runningDepth; @@ -91,11 +86,7 @@ namespace osu.Game.Overlays }; } - public void MarkAllRead() - { - toastFlow.Children.ForEach(n => n.Read = true); - InternalChildren.OfType().ForEach(n => n.Read = true); - } + public void MarkAllRead() => Notifications.ForEach(n => n.Read = true); public void FlushAllToasts() {