1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Add user avatar to leaderboard scores

This commit is contained in:
Salman Ahmed 2020-12-18 13:09:05 +03:00
parent fdad5e86d3
commit c9e75e7908

View File

@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
using osu.Game.Users.Drawables;
using osu.Game.Utils; using osu.Game.Utils;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -129,7 +130,7 @@ namespace osu.Game.Screens.Play.HUD
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OsuColour colours)
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -195,19 +196,51 @@ namespace osu.Game.Screens.Play.HUD
}, },
} }
}, },
usernameText = new OsuSpriteText new FillFlowContainer
{ {
Padding = new MarginPadding { Left = SHEAR_WIDTH }, Padding = new MarginPadding { Left = SHEAR_WIDTH },
RelativeSizeAxes = Axes.X,
Width = 0.8f,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Colour = Color4.White, RelativeSizeAxes = Axes.Both,
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold), Direction = FillDirection.Horizontal,
Text = User.Username, Spacing = new Vector2(4f, 0f),
Truncate = true, Children = new Drawable[]
Shadow = false, {
} new CircularContainer
{
Masking = true,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Size = new Vector2(25f),
Children = new Drawable[]
{
new Box
{
Name = "Placeholder while avatar loads",
Alpha = 0.3f,
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray4,
},
new UpdateableAvatar(User)
{
RelativeSizeAxes = Axes.Both,
},
}
},
usernameText = new OsuSpriteText
{
RelativeSizeAxes = Axes.X,
Width = 0.8f,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Colour = Color4.White,
Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold),
Text = User.Username,
Truncate = true,
Shadow = false,
}
}
},
} }
}, },
new Container new Container