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