diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 320aa707e2..41160d10ec 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -56,16 +56,12 @@ private void load() RelativeSizeAxes = Axes.X, Children = new[] { - new NotificationSection + new NotificationSection(@"Notifications", @"Clear All") { - Title = @"Notifications", - ClearText = @"Clear All", AcceptTypes = new[] { typeof(SimpleNotification) } }, - new NotificationSection + new NotificationSection(@"Running Tasks", @"Cancel All") { - Title = @"Running Tasks", - ClearText = @"Cancel All", AcceptTypes = new[] { typeof(ProgressNotification) } } } diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 4608d78324..f9278bbbd2 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -17,10 +17,7 @@ namespace osu.Game.Overlays.Notifications { public class NotificationSection : AlwaysUpdateFillFlowContainer { - private OsuSpriteText titleText; - private OsuSpriteText countText; - - private ClearAllButton clearButton; + private OsuSpriteText countDrawable; private FlowContainer notifications; @@ -35,28 +32,14 @@ public void Add(Notification notification, float position) public IEnumerable AcceptTypes; - private string clearText; + private readonly string clearButtonText; - public string ClearText + private readonly string titleText; + + public NotificationSection(string title, string clearButtonText) { - get => clearText; - set - { - clearText = value; - if (clearButton != null) clearButton.Text = clearText; - } - } - - private string title; - - public string Title - { - get => title; - set - { - title = value; - if (titleText != null) titleText.Text = title.ToUpperInvariant(); - } + this.clearButtonText = clearButtonText; + titleText = title; } [BackgroundDependencyLoader] @@ -82,9 +65,9 @@ private void load(OsuColour colours) AutoSizeAxes = Axes.Y, Children = new Drawable[] { - clearButton = new ClearAllButton + new ClearAllButton { - Text = clearText, + Text = clearButtonText, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Action = clearAll @@ -99,12 +82,12 @@ private void load(OsuColour colours) AutoSizeAxes = Axes.Both, Children = new Drawable[] { - titleText = new OsuSpriteText + new OsuSpriteText { - Text = title.ToUpperInvariant(), + Text = titleText.ToUpperInvariant(), Font = OsuFont.GetFont(weight: FontWeight.Black) }, - countText = new OsuSpriteText + countDrawable = new OsuSpriteText { Text = "3", Colour = colours.Yellow, @@ -134,7 +117,7 @@ protected override void Update() { base.Update(); - countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString(); + countDrawable.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString(); } private class ClearAllButton : OsuClickableContainer