2019-01-27 22:45:00 +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.
|
2019-01-11 00:12:19 +00:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2019-03-06 07:09:21 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-01-11 00:12:19 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2023-01-16 20:24:09 +00:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2019-04-26 04:49:44 +00:00
|
|
|
|
using osu.Game.Overlays.Profile.Header.Components;
|
2019-01-11 00:12:19 +00:00
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Header
|
|
|
|
|
{
|
2019-04-25 09:43:29 +00:00
|
|
|
|
public partial class CentreHeaderContainer : CompositeDrawable
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
2023-01-10 18:24:54 +00:00
|
|
|
|
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
2019-01-11 00:12:19 +00:00
|
|
|
|
|
2023-01-16 20:24:09 +00:00
|
|
|
|
private LevelBadge levelBadge = null!;
|
|
|
|
|
|
2019-04-25 11:05:59 +00:00
|
|
|
|
public CentreHeaderContainer()
|
|
|
|
|
{
|
|
|
|
|
Height = 60;
|
|
|
|
|
}
|
2019-01-11 00:12:19 +00:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-01-15 00:06:39 +00:00
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
2019-03-09 22:58:14 +00:00
|
|
|
|
InternalChildren = new Drawable[]
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2022-12-31 16:41:57 +00:00
|
|
|
|
Colour = colourProvider.Background3
|
2019-01-11 00:12:19 +00:00
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.X,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Padding = new MarginPadding { Vertical = 10 },
|
|
|
|
|
Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
|
|
|
|
Spacing = new Vector2(10, 0),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2021-01-21 20:40:23 +00:00
|
|
|
|
new FollowersButton
|
2021-01-21 19:02:54 +00:00
|
|
|
|
{
|
2023-01-10 18:24:54 +00:00
|
|
|
|
User = { BindTarget = User }
|
2021-01-21 19:02:54 +00:00
|
|
|
|
},
|
|
|
|
|
new MappingSubscribersButton
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
2023-01-10 18:24:54 +00:00
|
|
|
|
User = { BindTarget = User }
|
2019-01-11 00:12:19 +00:00
|
|
|
|
},
|
2019-04-26 04:49:44 +00:00
|
|
|
|
new MessageUserButton
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
2023-01-10 18:24:54 +00:00
|
|
|
|
User = { BindTarget = User }
|
2019-01-11 00:12:19 +00:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Margin = new MarginPadding { Right = UserProfileOverlay.CONTENT_X_MARGIN },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2023-01-16 20:24:09 +00:00
|
|
|
|
levelBadge = new LevelBadge
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2023-01-16 20:24:09 +00:00
|
|
|
|
Size = new Vector2(40)
|
2019-01-11 00:12:19 +00:00
|
|
|
|
},
|
2022-12-31 16:41:57 +00:00
|
|
|
|
new Container
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
Width = 200,
|
|
|
|
|
Height = 6,
|
|
|
|
|
Margin = new MarginPadding { Right = 50 },
|
2019-04-25 11:30:16 +00:00
|
|
|
|
Child = new LevelProgressBar
|
2019-01-11 00:12:19 +00:00
|
|
|
|
{
|
2019-04-25 11:30:16 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2023-01-10 18:24:54 +00:00
|
|
|
|
User = { BindTarget = User }
|
2019-01-11 00:12:19 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2023-01-16 20:47:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
2023-01-16 20:24:09 +00:00
|
|
|
|
|
2023-01-16 20:47:31 +00:00
|
|
|
|
User.BindValueChanged(user => updateDisplay(user.NewValue?.User), true);
|
2023-01-16 20:24:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateDisplay(APIUser? user)
|
|
|
|
|
{
|
|
|
|
|
levelBadge.LevelInfo.Value = user?.Statistics?.Level;
|
2019-01-11 00:12:19 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|