1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-25 12:13:11 +08:00
osu-lazer/osu.Game/Overlays/Comments/TotalCommentsCounter.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.9 KiB
C#
Raw Normal View History

2019-11-16 23:02:34 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2022-06-17 15:37:17 +08:00
#nullable disable
2019-11-16 23:02:34 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
2019-11-25 10:30:55 +08:00
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
2019-11-16 23:02:34 +08:00
namespace osu.Game.Overlays.Comments
{
public partial class TotalCommentsCounter : CompositeDrawable
{
public readonly BindableInt Current = new BindableInt();
2020-01-28 10:57:45 +08:00
private OsuSpriteText counter;
2019-11-16 23:02:34 +08:00
2020-01-28 10:57:45 +08:00
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
2019-11-16 23:02:34 +08:00
{
RelativeSizeAxes = Axes.X;
Height = 50;
AddInternal(new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Margin = new MarginPadding { Left = WaveOverlayContainer.HORIZONTAL_PADDING },
2019-11-16 23:02:34 +08:00
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
2020-01-28 10:57:45 +08:00
new OsuSpriteText
2019-11-16 23:02:34 +08:00
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 20, italics: true),
2020-01-28 10:57:45 +08:00
Colour = colourProvider.Light1,
Text = CommentsStrings.Title
2019-11-16 23:02:34 +08:00
},
new CircularContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
2020-01-28 10:57:45 +08:00
new Box
2019-11-16 23:02:34 +08:00
{
RelativeSizeAxes = Axes.Both,
2020-01-28 10:57:45 +08:00
Colour = colourProvider.Background6
2019-11-16 23:02:34 +08:00
},
2019-11-25 10:30:55 +08:00
counter = new OsuSpriteText
2019-11-16 23:02:34 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
2020-01-28 10:57:45 +08:00
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
Colour = colourProvider.Foreground1
2019-11-16 23:02:34 +08:00
}
},
}
}
});
}
protected override void LoadComplete()
{
Current.BindValueChanged(value => counter.Text = value.NewValue.ToString("N0"), true);
base.LoadComplete();
}
}
}