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
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-06-22 07:06:30 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2019-06-23 22:08:18 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
2017-06-09 14:53:00 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-06-22 07:40:33 +08:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2017-05-25 02:11:07 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-06-21 16:03:47 +08:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-07-17 20:57:05 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2017-06-09 14:53:00 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2019-06-22 07:40:33 +08:00
|
|
|
|
using osu.Game.Graphics.Backgrounds;
|
2021-11-29 08:08:45 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2017-06-09 14:53:00 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2021-11-04 17:02:44 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-06-16 16:36:23 +08:00
|
|
|
|
namespace osu.Game.Overlays.Profile
|
2017-05-25 02:11:07 +08:00
|
|
|
|
{
|
2019-06-22 07:06:30 +08:00
|
|
|
|
public abstract class ProfileSection : Container
|
2017-05-25 02:11:07 +08:00
|
|
|
|
{
|
2021-07-17 20:57:05 +08:00
|
|
|
|
public abstract LocalisableString Title { get; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-06-15 23:47:34 +08:00
|
|
|
|
public abstract string Identifier { get; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-29 08:08:45 +08:00
|
|
|
|
private readonly FillFlowContainer<Drawable> content;
|
2019-06-22 07:06:30 +08:00
|
|
|
|
private readonly Box background;
|
2019-06-22 07:52:07 +08:00
|
|
|
|
private readonly Box underscore;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-06-09 15:22:07 +08:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2021-11-04 17:02:44 +08:00
|
|
|
|
public readonly Bindable<APIUser> User = new Bindable<APIUser>();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2017-06-09 14:53:00 +08:00
|
|
|
|
protected ProfileSection()
|
2017-05-25 02:11:07 +08:00
|
|
|
|
{
|
2017-06-09 14:53:00 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2019-06-22 07:06:30 +08:00
|
|
|
|
|
2017-06-09 15:22:07 +08:00
|
|
|
|
InternalChildren = new Drawable[]
|
2017-06-09 14:53:00 +08:00
|
|
|
|
{
|
2019-06-22 07:06:30 +08:00
|
|
|
|
background = new Box
|
2017-06-09 14:53:00 +08:00
|
|
|
|
{
|
2019-06-22 07:06:30 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2017-06-09 15:22:07 +08:00
|
|
|
|
},
|
2019-06-22 07:40:33 +08:00
|
|
|
|
new SectionTriangles
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
},
|
2019-06-22 07:06:30 +08:00
|
|
|
|
new FillFlowContainer
|
2017-06-09 15:22:07 +08:00
|
|
|
|
{
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-06-22 07:06:30 +08:00
|
|
|
|
Children = new Drawable[]
|
2017-06-09 15:22:07 +08:00
|
|
|
|
{
|
2019-06-22 07:52:07 +08:00
|
|
|
|
new Container
|
2019-06-22 07:06:30 +08:00
|
|
|
|
{
|
2019-06-22 07:52:07 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2019-06-22 07:06:30 +08:00
|
|
|
|
Margin = new MarginPadding
|
|
|
|
|
{
|
|
|
|
|
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
2019-06-22 07:52:07 +08:00
|
|
|
|
Top = 15,
|
2020-09-08 04:43:26 +08:00
|
|
|
|
Bottom = 20,
|
2019-06-22 07:52:07 +08:00
|
|
|
|
},
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Title,
|
|
|
|
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
|
|
|
|
|
},
|
|
|
|
|
underscore = new Box
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Margin = new MarginPadding { Top = 4 },
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 2,
|
|
|
|
|
}
|
2019-06-22 07:06:30 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-12-07 04:00:26 +08:00
|
|
|
|
// reverse ID flow is required for correct Z-ordering of the content (last item should be front-most).
|
|
|
|
|
// particularly important in BeatmapsSection, as it uses beatmap cards, which have expandable overhanging content.
|
2021-11-29 08:08:45 +08:00
|
|
|
|
content = new ReverseChildIDFillFlowContainer<Drawable>
|
2019-06-22 07:06:30 +08:00
|
|
|
|
{
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
|
|
|
|
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
|
|
|
|
|
Bottom = 20
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-06-09 14:53:00 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2019-06-22 07:06:30 +08:00
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2019-06-22 07:06:30 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2020-01-30 05:26:21 +08:00
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-06-22 07:06:30 +08:00
|
|
|
|
{
|
2020-01-30 05:26:21 +08:00
|
|
|
|
background.Colour = colourProvider.Background5;
|
|
|
|
|
underscore.Colour = colourProvider.Highlight1;
|
2017-05-25 02:11:07 +08:00
|
|
|
|
}
|
2019-06-22 07:40:33 +08:00
|
|
|
|
|
|
|
|
|
private class SectionTriangles : Container
|
|
|
|
|
{
|
|
|
|
|
private readonly Triangles triangles;
|
|
|
|
|
private readonly Box foreground;
|
|
|
|
|
|
|
|
|
|
public SectionTriangles()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = 100;
|
|
|
|
|
Masking = true;
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
triangles = new Triangles
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-06-23 22:08:18 +08:00
|
|
|
|
TriangleScale = 3,
|
2019-06-22 07:40:33 +08:00
|
|
|
|
},
|
|
|
|
|
foreground = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-01-30 05:26:21 +08:00
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-06-22 07:40:33 +08:00
|
|
|
|
{
|
2020-01-30 05:26:21 +08:00
|
|
|
|
triangles.ColourLight = colourProvider.Background4;
|
|
|
|
|
triangles.ColourDark = colourProvider.Background5.Darken(0.2f);
|
|
|
|
|
foreground.Colour = ColourInfo.GradientVertical(colourProvider.Background5, colourProvider.Background5.Opacity(0));
|
2019-06-22 07:40:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-25 02:11:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|