mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 12:42:56 +08:00
Merge branch 'master' into not-available-to-download
This commit is contained in:
commit
763e000bf1
@ -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) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
{
|
|
||||||
get => clearText;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
clearText = value;
|
|
||||||
if (clearButton != null) clearButton.Text = clearText;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private string title;
|
public NotificationSection(string title, string clearButtonText)
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
{
|
||||||
get => title;
|
this.clearButtonText = clearButtonText;
|
||||||
set
|
titleText = title;
|
||||||
{
|
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user