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
|
|
|
|
|
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;
|
2019-04-26 12:49:44 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-04-04 06:57:15 +08:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2019-04-26 12:49:44 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-04-04 06:57:15 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-04-26 12:49:44 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2019-03-10 06:58:14 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2019-04-26 12:49:44 +08:00
|
|
|
|
using osu.Game.Overlays.Profile.Header;
|
|
|
|
|
using osu.Game.Users;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile
|
|
|
|
|
{
|
2019-12-28 09:57:41 +08:00
|
|
|
|
public class ProfileHeader : TabControlOverlayHeader
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-05-20 17:02:13 +08:00
|
|
|
|
private UserCoverBackground coverContainer;
|
2018-12-22 23:51:24 +08:00
|
|
|
|
|
2019-05-20 17:02:13 +08:00
|
|
|
|
public Bindable<User> User = new Bindable<User>();
|
|
|
|
|
|
|
|
|
|
private CentreHeaderContainer centreHeaderContainer;
|
|
|
|
|
private DetailHeaderContainer detailHeaderContainer;
|
2018-12-25 08:09:49 +08:00
|
|
|
|
|
2018-12-22 23:51:24 +08:00
|
|
|
|
public ProfileHeader()
|
2020-01-16 03:41:22 +08:00
|
|
|
|
: base(OverlayColourScheme.Green)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-12-27 03:09:06 +08:00
|
|
|
|
BackgroundHeight = 150;
|
|
|
|
|
|
2019-05-20 17:02:13 +08:00
|
|
|
|
User.ValueChanged += e => updateDisplay(e.NewValue);
|
|
|
|
|
|
2019-12-28 07:50:52 +08:00
|
|
|
|
TabControl.AddItem("info");
|
|
|
|
|
TabControl.AddItem("modding");
|
2019-05-20 17:02:13 +08:00
|
|
|
|
|
|
|
|
|
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override Drawable CreateBackground() =>
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
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-04-13 17:19:50 +08:00
|
|
|
|
|
2019-12-27 11:36:41 +08:00
|
|
|
|
protected override Drawable CreateContent() => new FillFlowContainer
|
2019-05-20 17:02:13 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-20 17:02:13 +08:00
|
|
|
|
new TopHeaderContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-05-20 17:02:13 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-12-22 23:51:24 +08:00
|
|
|
|
},
|
2019-05-20 17:02:13 +08:00
|
|
|
|
centreHeaderContainer = new CentreHeaderContainer
|
2018-12-22 23:51:24 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-05-20 17:02:13 +08:00
|
|
|
|
User = { BindTarget = User },
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
2019-05-20 17:02:13 +08:00
|
|
|
|
detailHeaderContainer = new DetailHeaderContainer
|
2018-07-10 12:06:03 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-05-20 17:02:13 +08:00
|
|
|
|
User = { BindTarget = User },
|
|
|
|
|
},
|
|
|
|
|
new MedalHeaderContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
User = { BindTarget = User },
|
|
|
|
|
},
|
|
|
|
|
new BottomHeaderContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
User = { BindTarget = User },
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
};
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-05-20 17:02:13 +08:00
|
|
|
|
protected override ScreenTitle CreateTitle() => new ProfileHeaderTitle();
|
2018-12-22 23:51:24 +08:00
|
|
|
|
|
2019-05-21 15:05:59 +08:00
|
|
|
|
private void updateDisplay(User user) => coverContainer.User = user;
|
|
|
|
|
|
2019-04-04 06:24:42 +08:00
|
|
|
|
private class ProfileHeaderTitle : ScreenTitle
|
|
|
|
|
{
|
|
|
|
|
public ProfileHeaderTitle()
|
|
|
|
|
{
|
2019-12-27 08:53:01 +08:00
|
|
|
|
Title = "player";
|
|
|
|
|
Section = "info";
|
2019-04-04 06:24:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-12-27 09:01:33 +08:00
|
|
|
|
protected override Drawable CreateIcon() => new ScreenTitleTextureIcon(@"Icons/profile");
|
2019-04-04 06:24:42 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|