2019-12-17 09:05:35 +00: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.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2020-02-17 01:29:41 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2021-08-29 12:00:28 +00:00
|
|
|
|
using osu.Framework.Extensions.LocalisationExtensions;
|
2019-12-17 09:05:35 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections
|
|
|
|
|
{
|
|
|
|
|
public partial class CounterPill : CircularContainer
|
|
|
|
|
{
|
|
|
|
|
public readonly BindableInt Current = new BindableInt();
|
|
|
|
|
|
2022-12-30 12:17:59 +00:00
|
|
|
|
private OsuSpriteText counter = null!;
|
2019-12-17 09:05:35 +00:00
|
|
|
|
|
2020-02-17 01:29:41 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-12-17 09:05:35 +00:00
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
Masking = true;
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-02-17 01:29:41 +00:00
|
|
|
|
Colour = colourProvider.Background6
|
2019-12-17 09:05:35 +00:00
|
|
|
|
},
|
|
|
|
|
counter = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2020-09-07 19:13:29 +00:00
|
|
|
|
Margin = new MarginPadding { Horizontal = 10, Bottom = 1 },
|
2020-09-10 17:25:35 +00:00
|
|
|
|
Font = OsuFont.GetFont(size: 11.2f, weight: FontWeight.Bold),
|
2020-02-17 01:29:41 +00:00
|
|
|
|
Colour = colourProvider.Foreground1
|
2019-12-17 09:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
Current.BindValueChanged(onCurrentChanged, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onCurrentChanged(ValueChangedEvent<int> value)
|
|
|
|
|
{
|
2021-07-24 08:06:31 +00:00
|
|
|
|
counter.Text = value.NewValue.ToLocalisableString("N0");
|
2019-12-17 09:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|