1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 17:23:05 +08:00
osu-lazer/osu.Game/Users/UserListPanel.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

122 lines
4.4 KiB
C#
Raw Normal View History

2020-03-04 13:53:14 +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.
using osu.Framework.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Framework.Extensions.Color4Extensions;
using osuTK.Graphics;
2020-03-04 15:35:43 +08:00
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
2020-03-04 15:35:43 +08:00
using osuTK;
using osu.Game.Overlays.Profile.Header.Components;
2020-03-04 13:53:14 +08:00
2020-03-04 19:58:15 +08:00
namespace osu.Game.Users
2020-03-04 13:53:14 +08:00
{
2020-07-19 01:24:38 +08:00
public partial class UserListPanel : ExtendedUserPanel
2020-03-04 13:53:14 +08:00
{
public UserListPanel(APIUser user)
2020-03-04 13:53:14 +08:00
: base(user)
{
RelativeSizeAxes = Axes.X;
Height = 40;
CornerRadius = 6;
}
[BackgroundDependencyLoader]
private void load()
{
Background.Width = 0.5f;
2020-10-01 03:02:27 +08:00
Background.Origin = Anchor.CentreRight;
Background.Anchor = Anchor.CentreRight;
2020-03-05 06:41:55 +08:00
Background.Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(1), Color4.White.Opacity(0.3f));
2020-03-04 15:35:43 +08:00
}
protected override Drawable CreateLayout()
{
FillFlowContainer details;
var layout = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
details = new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
CreateAvatar().With(avatar =>
{
avatar.Anchor = Anchor.CentreLeft;
avatar.Origin = Anchor.CentreLeft;
avatar.Size = new Vector2(40);
}),
CreateFlag().With(flag =>
{
flag.Anchor = Anchor.CentreLeft;
flag.Origin = Anchor.CentreLeft;
}),
CreateUsername().With(username =>
{
username.Anchor = Anchor.CentreLeft;
username.Origin = Anchor.CentreLeft;
username.UseFullGlyphHeight = false;
2023-03-04 03:16:45 +08:00
})
2020-03-04 15:35:43 +08:00
}
},
new FillFlowContainer
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Margin = new MarginPadding { Right = 10 },
Children = new Drawable[]
{
CreateStatusIcon().With(icon =>
{
icon.Anchor = Anchor.CentreRight;
icon.Origin = Anchor.CentreRight;
}),
CreateStatusMessage(true).With(message =>
{
message.Anchor = Anchor.CentreRight;
message.Origin = Anchor.CentreRight;
})
}
}
}
};
2023-03-04 03:14:19 +08:00
if (User.Groups != null)
{
details.Add(new GroupBadgeFlow
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
User = { Value = User }
});
}
2020-03-04 15:35:43 +08:00
if (User.IsSupporter)
{
details.Add(new SupporterIcon
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Height = 16,
2020-03-04 15:35:43 +08:00
SupportLevel = User.SupportLevel
});
}
return layout;
}
2020-03-04 13:53:14 +08:00
}
}