2020-03-17 15:59:34 +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.
|
|
|
|
|
2020-03-17 16:01:38 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
2020-03-17 15:59:34 +08:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-03-17 16:01:38 +08:00
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2020-03-17 15:59:34 +08:00
|
|
|
using osu.Game.Users;
|
2020-03-17 16:01:38 +08:00
|
|
|
using osu.Game.Users.Drawables;
|
|
|
|
using osuTK;
|
2020-03-17 15:59:34 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking.Expanded
|
|
|
|
{
|
2020-03-17 16:35:14 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The content that appears in the middle section of the <see cref="ScorePanel"/>.
|
|
|
|
/// </summary>
|
2020-03-17 15:59:34 +08:00
|
|
|
public class ExpandedPanelTopContent : CompositeDrawable
|
|
|
|
{
|
2020-03-17 16:01:38 +08:00
|
|
|
private readonly User user;
|
|
|
|
|
2020-03-17 16:35:14 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new <see cref="ExpandedPanelTopContent"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="user">The <see cref="User"/> to display.</param>
|
2020-03-17 15:59:34 +08:00
|
|
|
public ExpandedPanelTopContent(User user)
|
|
|
|
{
|
2020-03-17 16:01:38 +08:00
|
|
|
this.user = user;
|
|
|
|
Anchor = Anchor.TopCentre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
InternalChild = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new UpdateableAvatar(user)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Size = new Vector2(80),
|
|
|
|
CornerRadius = 20,
|
|
|
|
CornerExponent = 2.5f,
|
|
|
|
Masking = true,
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.TopCentre,
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
Text = user.Username,
|
|
|
|
Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2020-03-17 15:59:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|