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

51 lines
1.4 KiB
C#
Raw Normal View History

// 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.
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-31 06:04:40 +08:00
private void load(TextureStore textures)
2018-06-28 18:23:56 +08:00
{
2018-08-31 06:04:40 +08:00
badge.Texture = textures.Get($"Grades/{grade}");
2018-06-28 18:23:56 +08:00
}
}
}