2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2018-12-22 23:51:24 +08:00
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2018-04-16 05:44:59 +08:00
|
|
|
|
using osu.Game.Overlays.Profile.Header;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Users;
|
2019-03-06 15:09:21 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-04-04 06:57:15 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-04-04 06:24:42 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2019-03-10 06:58:14 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile
|
|
|
|
|
{
|
|
|
|
|
public class ProfileHeader : Container
|
|
|
|
|
{
|
2019-03-10 06:58:14 +08:00
|
|
|
|
private readonly UserCoverBackground coverContainer;
|
2018-12-23 04:50:25 +08:00
|
|
|
|
private readonly ProfileHeaderTabControl infoTabControl;
|
2018-12-22 23:51:24 +08:00
|
|
|
|
|
|
|
|
|
private const float cover_height = 150;
|
|
|
|
|
private const float cover_info_height = 75;
|
2018-12-25 08:09:49 +08:00
|
|
|
|
|
2018-12-22 23:51:24 +08:00
|
|
|
|
public ProfileHeader()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-10 06:58:14 +08:00
|
|
|
|
CenterHeaderContainer centerHeaderContainer;
|
|
|
|
|
DetailHeaderContainer detailHeaderContainer;
|
2018-12-23 04:50:25 +08:00
|
|
|
|
Container expandedDetailContainer;
|
|
|
|
|
FillFlowContainer hiddenDetailContainer, headerDetailContainer;
|
2018-12-22 23:51:24 +08:00
|
|
|
|
SpriteIcon expandButtonIcon;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-12-23 04:50:25 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-04-04 06:57:15 +08:00
|
|
|
|
new Container
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = cover_height,
|
2019-04-04 06:57:15 +08:00
|
|
|
|
Masking = true,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
coverContainer = new UserCoverBackground
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientVertical(OsuColour.FromHex("222").Opacity(0.8f), OsuColour.FromHex("222").Opacity(0.2f))
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-12-22 23:51:24 +08:00
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
|
|
|
|
Y = cover_height,
|
|
|
|
|
Height = cover_info_height,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Depth = -float.MaxValue,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-04-04 06:24:42 +08:00
|
|
|
|
new ProfileHeaderTitle
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-04-04 06:24:42 +08:00
|
|
|
|
X = -ScreenTitle.ICON_WIDTH,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
2018-12-23 04:50:25 +08:00
|
|
|
|
infoTabControl = new ProfileHeaderTabControl
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
2018-12-22 23:51:24 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = cover_info_height - 30,
|
|
|
|
|
Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN },
|
|
|
|
|
Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-12-22 23:51:24 +08:00
|
|
|
|
new FillFlowContainer
|
2018-07-10 12:06:03 +08:00
|
|
|
|
{
|
2018-12-22 23:51:24 +08:00
|
|
|
|
Margin = new MarginPadding { Top = cover_height },
|
2018-07-10 12:06:03 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2018-12-22 23:51:24 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-03-10 06:58:14 +08:00
|
|
|
|
new TopHeaderContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-03-10 06:58:14 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
2019-01-11 08:12:19 +08:00
|
|
|
|
centerHeaderContainer = new CenterHeaderContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-03-10 06:58:14 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
2019-01-11 08:12:19 +08:00
|
|
|
|
detailHeaderContainer = new DetailHeaderContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-03-10 06:58:14 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-12-23 04:50:25 +08:00
|
|
|
|
},
|
2019-03-10 06:58:14 +08:00
|
|
|
|
new MedalHeaderContainer
|
2018-12-23 04:50:25 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-03-10 06:58:14 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-12-23 04:50:25 +08:00
|
|
|
|
},
|
2019-03-10 06:58:14 +08:00
|
|
|
|
new BottomHeaderContainer
|
2018-12-23 04:50:25 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-03-10 06:58:14 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-12-23 04:50:25 +08:00
|
|
|
|
},
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2018-12-22 23:51:24 +08:00
|
|
|
|
|
|
|
|
|
infoTabControl.AddItem("Info");
|
|
|
|
|
infoTabControl.AddItem("Modding");
|
|
|
|
|
|
2019-03-10 06:58:14 +08:00
|
|
|
|
centerHeaderContainer.DetailsVisibilityAction = visible => detailHeaderContainer.Alpha = visible ? 0 : 1;
|
|
|
|
|
User.ValueChanged += e => updateDisplay(e.NewValue);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:12:19 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2019-04-04 06:24:42 +08:00
|
|
|
|
private void load(OsuColour colours)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-12-22 23:51:24 +08:00
|
|
|
|
infoTabControl.AccentColour = colours.CommunityUserGreen;
|
2018-12-23 04:50:25 +08:00
|
|
|
|
}
|
2018-12-22 13:40:55 +08:00
|
|
|
|
|
2019-03-10 06:58:14 +08:00
|
|
|
|
public Bindable<User> User = new Bindable<User>();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-03-10 06:58:14 +08:00
|
|
|
|
private void updateDisplay(User user)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-03-10 06:58:14 +08:00
|
|
|
|
coverContainer.User = user;
|
2018-12-22 23:51:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:12:19 +08:00
|
|
|
|
public class HasTooltipContainer : Container, IHasTooltip
|
2018-12-22 23:51:24 +08:00
|
|
|
|
{
|
|
|
|
|
public string TooltipText { get; set; }
|
|
|
|
|
}
|
2019-04-04 06:24:42 +08:00
|
|
|
|
|
|
|
|
|
private class ProfileHeaderTitle : ScreenTitle
|
|
|
|
|
{
|
|
|
|
|
public ProfileHeaderTitle()
|
|
|
|
|
{
|
|
|
|
|
Title = "Player ";
|
|
|
|
|
Section = "Info";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
AccentColour = colours.CommunityUserGreen;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|