1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 02:22:55 +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,9 +196,39 @@ namespace osu.Game.Screens.Play.HUD
}, },
} }
}, },
usernameText = new OsuSpriteText new FillFlowContainer
{ {
Padding = new MarginPadding { Left = SHEAR_WIDTH }, Padding = new MarginPadding { Left = SHEAR_WIDTH },
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(4f, 0f),
Children = new Drawable[]
{
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, RelativeSizeAxes = Axes.X,
Width = 0.8f, Width = 0.8f,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
@ -210,6 +241,8 @@ namespace osu.Game.Screens.Play.HUD
} }
} }
}, },
}
},
new Container new Container
{ {
Padding = new MarginPadding { Top = 2f, Right = 17.5f, Bottom = 5f }, Padding = new MarginPadding { Top = 2f, Right = 17.5f, Bottom = 5f },