TotalCommentsCounter improvements

This commit is contained in:
Andrei Zavatski
2020-01-28 05:57:45 +03:00
parent ac904194d3
commit ce95b4a106

View File

@ -16,11 +16,10 @@ namespace osu.Game.Overlays.Comments
{ {
public readonly BindableInt Current = new BindableInt(); public readonly BindableInt Current = new BindableInt();
private readonly OsuSpriteText counter; private OsuSpriteText counter;
private readonly OsuSpriteText text;
private readonly Box pillBackground;
public TotalCommentsCounter() [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 50; Height = 50;
@ -34,11 +33,12 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(5, 0), Spacing = new Vector2(5, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
text = new OsuSpriteText new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 20, italics: true), Font = OsuFont.GetFont(size: 20, italics: true),
Colour = colourProvider.Light1,
Text = @"Comments" Text = @"Comments"
}, },
new CircularContainer new CircularContainer
@ -49,16 +49,18 @@ namespace osu.Game.Overlays.Comments
Masking = true, Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
pillBackground = new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background6
}, },
counter = new OsuSpriteText counter = new OsuSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
Colour = colourProvider.Foreground1
} }
}, },
} }
@ -66,14 +68,6 @@ namespace osu.Game.Overlays.Comments
}); });
} }
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
text.Colour = colourProvider.Light1;
pillBackground.Colour = colourProvider.Background6;
counter.Colour = colourProvider.Foreground1;
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
Current.BindValueChanged(value => counter.Text = value.NewValue.ToString("N0"), true); Current.BindValueChanged(value => counter.Text = value.NewValue.ToString("N0"), true);