2019-01-24 08:43:03 +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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-03-06 07:09:21 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-04-03 22:57:15 +00:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2019-04-26 04:49:44 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-04-03 22:57:15 +00:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2019-04-26 04:49:44 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-04-03 22:57:15 +00:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-07-17 12:46:14 +00:00
|
|
|
|
using osu.Framework.Localisation;
|
2021-11-04 09:02:44 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2019-04-26 04:49:44 +00:00
|
|
|
|
using osu.Game.Overlays.Profile.Header;
|
2021-07-17 12:46:14 +00:00
|
|
|
|
using osu.Game.Resources.Localisation.Web;
|
2019-04-26 04:49:44 +00:00
|
|
|
|
using osu.Game.Users;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-06-16 08:36:23 +00:00
|
|
|
|
namespace osu.Game.Overlays.Profile
|
2017-05-24 18:11:07 +00:00
|
|
|
|
{
|
2021-07-18 17:18:06 +00:00
|
|
|
|
public class ProfileHeader : TabControlOverlayHeader<LocalisableString>
|
2017-05-24 18:11:07 +00:00
|
|
|
|
{
|
2019-05-20 09:02:13 +00:00
|
|
|
|
private UserCoverBackground coverContainer;
|
2018-12-22 15:51:24 +00:00
|
|
|
|
|
2021-11-04 09:02:44 +00:00
|
|
|
|
public Bindable<APIUser> User = new Bindable<APIUser>();
|
2019-05-20 09:02:13 +00:00
|
|
|
|
|
|
|
|
|
private CentreHeaderContainer centreHeaderContainer;
|
|
|
|
|
private DetailHeaderContainer detailHeaderContainer;
|
2018-12-25 00:09:49 +00:00
|
|
|
|
|
2018-12-22 15:51:24 +00:00
|
|
|
|
public ProfileHeader()
|
2017-05-27 15:37:15 +00:00
|
|
|
|
{
|
2020-07-21 19:56:44 +00:00
|
|
|
|
ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN;
|
2020-07-21 17:11:10 +00:00
|
|
|
|
|
2019-05-20 09:02:13 +00:00
|
|
|
|
User.ValueChanged += e => updateDisplay(e.NewValue);
|
|
|
|
|
|
2021-07-18 17:18:06 +00:00
|
|
|
|
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
|
|
|
|
|
TabControl.AddItem(LayoutStrings.HeaderUsersModding);
|
|
|
|
|
|
2019-05-20 09:02:13 +00:00
|
|
|
|
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Drawable CreateBackground() =>
|
|
|
|
|
new Container
|
|
|
|
|
{
|
2020-01-27 12:36:19 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 150,
|
|
|
|
|
Masking = true,
|
2019-05-20 09:02:13 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2020-07-28 11:50:55 +00:00
|
|
|
|
coverContainer = new ProfileCoverBackground
|
2019-05-20 09:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2020-03-11 01:18:41 +00:00
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("222").Opacity(0.8f), Color4Extensions.FromHex("222").Opacity(0.2f))
|
2019-05-20 09:02:13 +00:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-12-27 03:36:41 +00:00
|
|
|
|
protected override Drawable CreateContent() => new FillFlowContainer
|
2019-05-20 09:02:13 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2017-06-06 03:25:16 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-20 09:02:13 +00:00
|
|
|
|
new TopHeaderContainer
|
2017-06-06 03:25:16 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-05-20 09:02:13 +00:00
|
|
|
|
User = { BindTarget = User },
|
2018-12-22 15:51:24 +00:00
|
|
|
|
},
|
2019-05-20 09:02:13 +00:00
|
|
|
|
centreHeaderContainer = new CentreHeaderContainer
|
2018-12-22 15:51:24 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-05-20 09:02:13 +00:00
|
|
|
|
User = { BindTarget = User },
|
2017-06-12 19:31:17 +00:00
|
|
|
|
},
|
2019-05-20 09:02:13 +00:00
|
|
|
|
detailHeaderContainer = new DetailHeaderContainer
|
2018-07-10 04:06:03 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-05-20 09:02:13 +00:00
|
|
|
|
User = { BindTarget = User },
|
|
|
|
|
},
|
|
|
|
|
new MedalHeaderContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
User = { BindTarget = User },
|
|
|
|
|
},
|
|
|
|
|
new BottomHeaderContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
User = { BindTarget = User },
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2020-03-24 21:08:20 +00:00
|
|
|
|
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
|
2018-12-22 15:51:24 +00:00
|
|
|
|
|
2021-11-04 09:02:44 +00:00
|
|
|
|
private void updateDisplay(APIUser user) => coverContainer.User = user;
|
2019-05-21 07:05:59 +00:00
|
|
|
|
|
2020-03-24 21:08:20 +00:00
|
|
|
|
private class ProfileHeaderTitle : OverlayTitle
|
2019-04-03 22:24:42 +00:00
|
|
|
|
{
|
|
|
|
|
public ProfileHeaderTitle()
|
|
|
|
|
{
|
2021-07-17 12:46:14 +00:00
|
|
|
|
Title = PageTitleStrings.MainUsersControllerDefault;
|
2020-09-03 07:26:09 +00:00
|
|
|
|
IconTexture = "Icons/Hexacons/profile";
|
2019-04-03 22:24:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-07-28 11:50:55 +00:00
|
|
|
|
|
|
|
|
|
private class ProfileCoverBackground : UserCoverBackground
|
|
|
|
|
{
|
|
|
|
|
protected override double LoadDelay => 0;
|
|
|
|
|
}
|
2017-05-24 18:11:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|