Make DrawableRank safer.

This commit is contained in:
Dean Herbert
2017-03-22 08:32:28 +09:00
parent 8983bbcaad
commit 1699daaf7f

View File

@ -14,30 +14,18 @@ namespace osu.Game.Screens.Select.Leaderboards
public class DrawableRank : Container public class DrawableRank : Container
{ {
private Sprite sprite; private Sprite sprite;
private TextureStore textures;
private ScoreRank rank; public ScoreRank Rank { get; private set; }
public ScoreRank Rank
{
get { return rank; }
set
{
if (value == rank) return;
rank = value;
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{rank.GetDescription()}");
}
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore ts) private void load(TextureStore textures)
{ {
textures = ts; sprite.Texture = textures.Get($@"Badges/ScoreRanks/{Rank.GetDescription()}");
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{rank.GetDescription()}");
} }
public DrawableRank(ScoreRank rank) public DrawableRank(ScoreRank rank)
{ {
this.rank = rank; Rank = rank;
Children = new Drawable[] Children = new Drawable[]
{ {