mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Apply NRT to notification classes
and tidy things up a bit.
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -21,9 +19,9 @@ namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
public class NotificationSection : AlwaysUpdateFillFlowContainer<Drawable>
|
||||
{
|
||||
private OsuSpriteText countDrawable;
|
||||
private OsuSpriteText countDrawable = null!;
|
||||
|
||||
private FlowContainer<Notification> notifications;
|
||||
private FlowContainer<Notification> notifications = null!;
|
||||
|
||||
public int DisplayedCount => notifications.Count(n => !n.WasClosed);
|
||||
public int UnreadCount => notifications.Count(n => !n.WasClosed && !n.Read);
|
||||
@ -33,14 +31,16 @@ namespace osu.Game.Overlays.Notifications
|
||||
notifications.Insert((int)position, notification);
|
||||
}
|
||||
|
||||
public IEnumerable<Type> AcceptTypes;
|
||||
public IEnumerable<Type> AcceptedNotificationTypes { get; }
|
||||
|
||||
private readonly string clearButtonText;
|
||||
|
||||
private readonly LocalisableString titleText;
|
||||
|
||||
public NotificationSection(LocalisableString title, string clearButtonText)
|
||||
public NotificationSection(LocalisableString title, IEnumerable<Type> acceptedNotificationTypes, string clearButtonText)
|
||||
{
|
||||
AcceptedNotificationTypes = acceptedNotificationTypes.ToArray();
|
||||
|
||||
this.clearButtonText = clearButtonText.ToUpperInvariant();
|
||||
titleText = title;
|
||||
}
|
||||
@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
public void MarkAllRead()
|
||||
{
|
||||
notifications?.Children.ForEach(n => n.Read = true);
|
||||
notifications.Children.ForEach(n => n.Read = true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user