1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

Allow customising the "close" button icon

This commit is contained in:
Dean Herbert 2022-08-30 17:37:43 +09:00
parent 1484ae19f0
commit 0f203531d9
2 changed files with 15 additions and 3 deletions

View File

@ -56,6 +56,8 @@ namespace osu.Game.Overlays.Notifications
public virtual bool Read { get; set; } public virtual bool Read { get; set; }
protected virtual IconUsage CloseButtonIcon => FontAwesome.Solid.Check;
protected Notification() protected Notification()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
@ -116,7 +118,7 @@ namespace osu.Game.Overlays.Notifications
}, },
} }
}, },
new CloseButton new CloseButton(CloseButtonIcon)
{ {
Action = Close, Action = Close,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -177,9 +179,16 @@ namespace osu.Game.Overlays.Notifications
private SpriteIcon icon = null!; private SpriteIcon icon = null!;
private Box background = null!; private Box background = null!;
private readonly IconUsage iconUsage;
[Resolved] [Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!; private OverlayColourProvider colourProvider { get; set; } = null!;
public CloseButton(IconUsage iconUsage)
{
this.iconUsage = iconUsage;
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -198,7 +207,7 @@ namespace osu.Game.Overlays.Notifications
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Check, Icon = iconUsage,
Size = new Vector2(12), Size = new Vector2(12),
Colour = colourProvider.Foreground1, Colour = colourProvider.Foreground1,
} }

View File

@ -61,7 +61,10 @@ namespace osu.Game.Overlays.Notifications
} }
} }
private void updateProgress(float progress) => progressBar.Progress = progress; protected override IconUsage CloseButtonIcon => FontAwesome.Solid.Times;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
protected override void LoadComplete() protected override void LoadComplete()
{ {