1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 22:07:40 +08:00
osu-lazer/osu.Game/Overlays/Profile/Components/GradeBadge.cs

52 lines
1.4 KiB
C#
Raw Normal View History

2018-06-28 18:23:56 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-08-27 16:26:44 +08:00
using System.Threading.Tasks;
2018-06-28 18:23:56 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Profile.Components
{
public class GradeBadge : Container
{
private const float width = 50;
private readonly string grade;
private readonly Sprite badge;
private readonly SpriteText numberText;
public int DisplayCount
{
set => numberText.Text = value.ToString(@"#,0");
}
public GradeBadge(string grade)
{
this.grade = grade;
Width = width;
Height = 41;
Add(badge = new Sprite
{
Width = width,
Height = 26
});
Add(numberText = new OsuSpriteText
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
TextSize = 14,
Font = @"Exo2.0-Bold"
});
}
[BackgroundDependencyLoader]
2018-08-27 16:26:44 +08:00
private async Task load(TextureStore textures)
2018-06-28 18:23:56 +08:00
{
2018-08-27 16:26:44 +08:00
badge.Texture = await textures.GetAsync($"Grades/{grade}");
2018-06-28 18:23:56 +08:00
}
}
}