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

Change NotificationOverlay type based logic to not require specifying every type of notification

This commit is contained in:
Dean Herbert 2023-10-12 16:00:23 +09:00
parent 3023e44196
commit 55a9de034d
No known key found for this signature in database

View File

@ -113,7 +113,8 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Children = new[] Children = new[]
{ {
new NotificationSection(AccountsStrings.NotificationsTitle, new[] { typeof(SimpleNotification), typeof(UserAvatarNotification) }), // The main section adds as a catch-all for notifications which don't group into other sections.
new NotificationSection(AccountsStrings.NotificationsTitle, new[] { typeof(Notification) }),
new NotificationSection(NotificationsStrings.RunningTasks, new[] { typeof(ProgressNotification) }), new NotificationSection(NotificationsStrings.RunningTasks, new[] { typeof(ProgressNotification) }),
} }
} }
@ -205,7 +206,7 @@ namespace osu.Game.Overlays
var ourType = notification.GetType(); var ourType = notification.GetType();
int depth = notification.DisplayOnTop ? -runningDepth : runningDepth; int depth = notification.DisplayOnTop ? -runningDepth : runningDepth;
var section = sections.Children.First(s => s.AcceptedNotificationTypes.Any(accept => accept.IsAssignableFrom(ourType))); var section = sections.Children.Last(s => s.AcceptedNotificationTypes.Any(accept => accept.IsAssignableFrom(ourType)));
section.Add(notification, depth); section.Add(notification, depth);