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

Merge branch 'master' into not-available-to-download

This commit is contained in:
Dean Herbert 2019-06-21 20:54:35 +09:00 committed by GitHub
commit 763e000bf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 36 deletions

View File

@ -56,16 +56,12 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Children = new[] Children = new[]
{ {
new NotificationSection new NotificationSection(@"Notifications", @"Clear All")
{ {
Title = @"Notifications",
ClearText = @"Clear All",
AcceptTypes = new[] { typeof(SimpleNotification) } AcceptTypes = new[] { typeof(SimpleNotification) }
}, },
new NotificationSection new NotificationSection(@"Running Tasks", @"Cancel All")
{ {
Title = @"Running Tasks",
ClearText = @"Cancel All",
AcceptTypes = new[] { typeof(ProgressNotification) } AcceptTypes = new[] { typeof(ProgressNotification) }
} }
} }

View File

@ -17,10 +17,7 @@ namespace osu.Game.Overlays.Notifications
{ {
public class NotificationSection : AlwaysUpdateFillFlowContainer<Drawable> public class NotificationSection : AlwaysUpdateFillFlowContainer<Drawable>
{ {
private OsuSpriteText titleText; private OsuSpriteText countDrawable;
private OsuSpriteText countText;
private ClearAllButton clearButton;
private FlowContainer<Notification> notifications; private FlowContainer<Notification> notifications;
@ -35,28 +32,14 @@ namespace osu.Game.Overlays.Notifications
public IEnumerable<Type> AcceptTypes; public IEnumerable<Type> AcceptTypes;
private string clearText; private readonly string clearButtonText;
public string ClearText private readonly string titleText;
public NotificationSection(string title, string clearButtonText)
{ {
get => clearText; this.clearButtonText = clearButtonText;
set titleText = title;
{
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();
}
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -82,9 +65,9 @@ namespace osu.Game.Overlays.Notifications
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new Drawable[] Children = new Drawable[]
{ {
clearButton = new ClearAllButton new ClearAllButton
{ {
Text = clearText, Text = clearButtonText,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Action = clearAll Action = clearAll
@ -99,12 +82,12 @@ namespace osu.Game.Overlays.Notifications
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
titleText = new OsuSpriteText new OsuSpriteText
{ {
Text = title.ToUpperInvariant(), Text = titleText.ToUpperInvariant(),
Font = OsuFont.GetFont(weight: FontWeight.Black) Font = OsuFont.GetFont(weight: FontWeight.Black)
}, },
countText = new OsuSpriteText countDrawable = new OsuSpriteText
{ {
Text = "3", Text = "3",
Colour = colours.Yellow, Colour = colours.Yellow,
@ -134,7 +117,7 @@ namespace osu.Game.Overlays.Notifications
{ {
base.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 private class ClearAllButton : OsuClickableContainer