mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
ScoreRank, Avatar to own files, +DrawableRank
This commit is contained in:
51
osu.Game/Screens/Select/Leaderboards/DrawableRank.cs
Normal file
51
osu.Game/Screens/Select/Leaderboards/DrawableRank.cs
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
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.Framework.Extensions;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class DrawableRank : Container
|
||||
{
|
||||
private Sprite sprite;
|
||||
private TextureStore textures;
|
||||
|
||||
private ScoreRank rank;
|
||||
public ScoreRank Rank
|
||||
{
|
||||
get { return rank; }
|
||||
set
|
||||
{
|
||||
if (value == rank) return;
|
||||
rank = value;
|
||||
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{rank.GetDescription()}");
|
||||
}
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore ts)
|
||||
{
|
||||
textures = ts;
|
||||
sprite.Texture = textures.Get($@"Badges/ScoreRanks/{rank.GetDescription()}");
|
||||
}
|
||||
|
||||
public DrawableRank(ScoreRank rank)
|
||||
{
|
||||
this.rank = rank;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
sprite = new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -13,10 +13,10 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Modes;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Allocation;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Modes.Mods;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
private Box background;
|
||||
private Container content, avatarContainer;
|
||||
private Sprite scoreRank;
|
||||
private DrawableRank scoreRank;
|
||||
private OsuSpriteText nameLabel;
|
||||
private GlowingSpriteText scoreLabel;
|
||||
private ScoreComponentLabel maxCombo, accuracy;
|
||||
@ -59,12 +59,6 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
scoreRank.Texture = textures.Get($@"Badges/ScoreRanks/{Score.Rank.GetDescription()}");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -182,7 +176,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
EdgeEffect = imageShadow,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Overlays.Toolbar.ToolbarUserButton.Avatar
|
||||
new Avatar
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
UserId = Score.User.Id,
|
||||
@ -237,7 +231,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
},
|
||||
},
|
||||
},
|
||||
scoreRank = new Sprite
|
||||
scoreRank = new DrawableRank(Score.Rank)
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
|
Reference in New Issue
Block a user