osu/osu.Game/Users/UserBrickPanel.cs

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

69 lines
2.1 KiB
C#
Raw Normal View History

2020-07-18 17:24:38 +00: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.
2022-06-17 07:37:17 +00:00
#nullable disable
2020-07-18 17:24:38 +00:00
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-18 17:24:38 +00:00
using osuTK;
namespace osu.Game.Users
{
public partial class UserBrickPanel : UserPanel
{
public UserBrickPanel(APIUser user)
2020-07-18 17:24:38 +00:00
: base(user)
{
2020-07-19 01:10:35 +00:00
AutoSizeAxes = Axes.Both;
2020-07-18 17:24:38 +00:00
CornerRadius = 6;
}
[BackgroundDependencyLoader]
private void load()
{
2020-07-19 01:10:35 +00:00
Background.FadeTo(0.2f);
2020-07-18 17:24:38 +00:00
}
protected override Drawable CreateLayout() => new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Margin = new MarginPadding
{
2020-07-19 01:10:35 +00:00
Horizontal = 10,
Vertical = 3,
2020-07-18 17:24:38 +00: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);
})
}
};
}
}