1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 18:07:24 +08:00
osu-lazer/osu.Game/Users/Profile/ProfileHeader.cs

92 lines
3.7 KiB
C#
Raw Normal View History

2017-05-25 02:11:07 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2017-06-06 11:25:16 +08:00
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
2017-05-25 02:11:07 +08:00
using osu.Framework.Graphics.Containers;
2017-06-06 11:25:16 +08:00
using osu.Game.Graphics.Sprites;
2017-05-25 02:11:07 +08:00
2017-06-05 21:07:57 +08:00
namespace osu.Game.Users.Profile
2017-05-25 02:11:07 +08:00
{
public class UserPageHeader : Container
{
private readonly User user;
2017-06-06 11:25:16 +08:00
private const float cover_height = 200, avatar_size = 110, avatar_bottom_position = -20;
public UserPageHeader(User user)
{
this.user = user;
2017-06-06 11:25:16 +08:00
RelativeSizeAxes = Axes.X;
Height = cover_height;
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
Height = cover_height,
Children = new Drawable[]
{
new AsyncLoadWrapper(new UserCoverBackground(user)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
OnLoadComplete = d => d.FadeInFromZero(200)
})
{
Masking = true,
RelativeSizeAxes = Axes.Both
},
2017-06-06 11:25:16 +08:00
new UpdateableAvatar
{
User = user,
Size = new Vector2(avatar_size),
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
X = UserProfile.CONTENT_X_MARGIN,
Y = avatar_bottom_position,
Masking = true,
CornerRadius = 5,
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.25f),
Radius = 4,
},
},
new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
X = UserProfile.CONTENT_X_MARGIN + avatar_size + 10,
Y = avatar_bottom_position,
Children = new Drawable[]
{
new OsuSpriteText
{
Text = user.Username,
TextSize = 25,
Font = @"Exo2.0-RegularItalic",
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Y = -55
},
new DrawableFlag(user.Country?.FlagName ?? "__")
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Width = 30,
Height = 20
}
}
}
}
}
};
}
2017-05-25 02:11:07 +08:00
}
}