1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-22 15:52:55 +08:00
osu-lazer/osu.Game/Online/Leaderboards/DrawableRank.cs

47 lines
1.1 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-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Extensions;
2018-04-13 17:19:50 +08:00
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
2018-11-28 15:12:57 +08:00
using osu.Game.Scoring;
using System;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Online.Leaderboards
2018-04-13 17:19:50 +08:00
{
public class DrawableRank : Sprite
{
2019-06-18 03:33:27 +08:00
private readonly ScoreRank rank;
2019-06-18 03:33:27 +08:00
public DrawableRank(ScoreRank rank)
{
this.rank = rank;
}
[BackgroundDependencyLoader(true)]
private void load(TextureStore ts)
2018-04-13 17:19:50 +08:00
{
if (ts == null)
throw new ArgumentNullException(nameof(ts));
2018-04-13 17:19:50 +08:00
Texture = ts.Get($@"Grades/{getTextureName()}");
}
2019-05-07 14:09:03 +08:00
private string getTextureName()
{
switch (rank)
2019-04-22 08:57:33 +08:00
{
default:
return rank.GetDescription();
2019-05-07 14:09:03 +08:00
2019-04-22 08:57:33 +08:00
case ScoreRank.SH:
return "SPlus";
2019-05-07 14:09:03 +08:00
2019-04-22 08:57:33 +08:00
case ScoreRank.XH:
return "SSPlus";
2019-04-22 08:57:33 +08:00
}
2018-04-13 17:19:50 +08:00
}
}
}