1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 09:37:42 +08:00
osu-lazer/osu.Game/Users/UserBrickPanel.cs

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

67 lines
2.0 KiB
C#
Raw Normal View History

2020-07-19 01:24:38 +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.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
2020-07-19 01:24:38 +08:00
using osuTK;
namespace osu.Game.Users
{
public class UserBrickPanel : UserPanel
{
public UserBrickPanel(APIUser user)
2020-07-19 01:24:38 +08:00
: base(user)
{
2020-07-19 09:10:35 +08:00
AutoSizeAxes = Axes.Both;
2020-07-19 01:24:38 +08:00
CornerRadius = 6;
}
[BackgroundDependencyLoader]
private void load()
{
2020-07-19 09:10:35 +08:00
Background.FadeTo(0.2f);
2020-07-19 01:24:38 +08:00
}
protected override Drawable CreateLayout() => new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Margin = new MarginPadding
{
2020-07-19 09:10:35 +08:00
Horizontal = 10,
Vertical = 3,
2020-07-19 01:24:38 +08:00
},
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new CircularContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Masking = true,
Width = 4,
Height = 13,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = string.IsNullOrEmpty(User.Colour) ? Color4Extensions.FromHex("0087ca") : Color4Extensions.FromHex(User.Colour)
}
},
CreateUsername().With(u =>
{
u.Anchor = Anchor.CentreLeft;
u.Origin = Anchor.CentreLeft;
u.Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold);
})
}
};
}
}