1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00
osu-lazer/osu.Game/Users/UserGridPanel.cs

114 lines
4.0 KiB
C#
Raw Normal View History

2020-03-04 13:41:21 +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-04 17:20:49 +08:00
using osu.Framework.Allocation;
2020-03-04 15:35:43 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2020-03-04 17:20:49 +08:00
using osu.Game.Overlays.Profile.Header.Components;
2020-03-04 13:41:21 +08:00
using osuTK;
2020-03-04 19:58:15 +08:00
namespace osu.Game.Users
2020-03-04 13:41:21 +08:00
{
2020-03-04 19:58:15 +08:00
public class UserGridPanel : UserPanel
2020-03-04 13:41:21 +08:00
{
2020-03-04 17:20:49 +08:00
private const int margin = 10;
2020-03-04 19:58:15 +08:00
public UserGridPanel(User user)
2020-03-04 13:41:21 +08:00
: base(user)
{
2020-03-04 19:58:15 +08:00
Height = 120;
2020-03-04 13:41:21 +08:00
CornerRadius = 10;
}
2020-03-04 15:35:43 +08:00
2020-03-04 17:20:49 +08:00
[BackgroundDependencyLoader]
private void load()
{
2020-03-05 06:41:55 +08:00
Background.FadeTo(0.4f);
2020-03-04 17:20:49 +08:00
}
protected override Drawable CreateLayout()
2020-03-04 15:35:43 +08:00
{
2020-03-04 17:20:49 +08:00
FillFlowContainer details;
var layout = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(margin),
Child = new GridContainer
{
RelativeSizeAxes = Axes.Both,
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension()
},
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension()
},
Content = new[]
{
new Drawable[]
{
CreateAvatar().With(avatar =>
{
avatar.Size = new Vector2(60);
avatar.Margin = new MarginPadding { Bottom = margin };
avatar.Masking = true;
avatar.CornerRadius = 6;
}),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 7),
Margin = new MarginPadding { Left = margin },
Children = new Drawable[]
{
details = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(6),
Children = new Drawable[]
{
CreateFlag(),
}
},
CreateUsername(),
}
}
},
new Drawable[]
{
CreateStatusIcon().With(icon =>
{
icon.Anchor = Anchor.Centre;
icon.Origin = Anchor.Centre;
}),
CreateStatusMessage(false).With(message =>
{
message.Anchor = Anchor.CentreLeft;
message.Origin = Anchor.CentreLeft;
message.Margin = new MarginPadding { Left = margin };
})
}
}
}
};
if (User.IsSupporter)
{
details.Add(new SupporterIcon
{
Height = 26,
SupportLevel = User.SupportLevel
});
}
return layout;
}
2020-03-04 13:41:21 +08:00
}
}