1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:23:21 +08:00

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();
private readonly OsuSpriteText counter;
private readonly OsuSpriteText text;
private readonly Box pillBackground;
private OsuSpriteText counter;
public TotalCommentsCounter()
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
RelativeSizeAxes = Axes.X;
Height = 50;
@ -34,11 +33,12 @@ namespace osu.Game.Overlays.Comments
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
text = new OsuSpriteText
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 20, italics: true),
Colour = colourProvider.Light1,
Text = @"Comments"
},
new CircularContainer
@ -49,16 +49,18 @@ namespace osu.Game.Overlays.Comments
Masking = true,
Children = new Drawable[]
{
pillBackground = new Box
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background6
},
counter = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
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()
{
Current.BindValueChanged(value => counter.Text = value.NewValue.ToString("N0"), true);