osu/osu.Game/Users/UserBrickPanel.cs

66 lines
2.0 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.
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 osuTK;
namespace osu.Game.Users
{
public class UserBrickPanel : UserPanel
{
public UserBrickPanel(User user)
: 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);
})
}
};
}
}