2021-01-22 02:38:52 +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.
|
|
|
|
|
|
2021-08-29 20:00:28 +08:00
|
|
|
|
using osu.Framework.Extensions.LocalisationExtensions;
|
2021-01-22 02:38:52 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Header.Components
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public abstract partial class ProfileHeaderStatisticsButton : ProfileHeaderButton
|
2021-01-22 02:38:52 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText drawableText;
|
|
|
|
|
|
|
|
|
|
protected ProfileHeaderStatisticsButton()
|
|
|
|
|
{
|
|
|
|
|
Child = new FillFlowContainer
|
|
|
|
|
{
|
2021-01-22 03:02:54 +08:00
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
2021-01-22 02:38:52 +08:00
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
2021-01-22 04:39:19 +08:00
|
|
|
|
Icon = Icon,
|
2021-01-22 02:38:52 +08:00
|
|
|
|
FillMode = FillMode.Fit,
|
|
|
|
|
Size = new Vector2(50, 14)
|
|
|
|
|
},
|
|
|
|
|
drawableText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
2021-01-22 03:02:54 +08:00
|
|
|
|
Margin = new MarginPadding { Right = 10 },
|
2021-01-22 03:48:31 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold)
|
2021-01-22 02:38:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-22 04:39:19 +08:00
|
|
|
|
protected abstract IconUsage Icon { get; }
|
2021-01-22 02:38:52 +08:00
|
|
|
|
|
2021-07-24 16:14:13 +08:00
|
|
|
|
protected void SetValue(int value) => drawableText.Text = value.ToLocalisableString("#,##0");
|
2021-01-22 02:38:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|