mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:02:55 +08:00
Change NotificationOverlay
type based logic to not require specifying every type of notification
This commit is contained in:
parent
3023e44196
commit
55a9de034d
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user