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-06-21 23:06:30 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 10:04:31 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-06-09 06:53:00 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-05-24 18:11:07 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2022-12-31 16:32:20 +00:00
|
|
|
|
using osu.Framework.Graphics.Effects;
|
2017-06-21 08:03:47 +00:00
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-07-17 12:57:05 +00:00
|
|
|
|
using osu.Framework.Localisation;
|
2017-06-09 06:53:00 +00:00
|
|
|
|
using osu.Game.Graphics;
|
2021-11-29 00:08:45 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2017-06-09 06:53:00 +00:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2022-12-31 16:32:20 +00:00
|
|
|
|
using osuTK;
|
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
|
|
|
|
{
|
2019-06-21 23:06:30 +00:00
|
|
|
|
public abstract partial class ProfileSection : Container
|
2017-05-24 18:11:07 +00:00
|
|
|
|
{
|
2021-07-17 12:57:05 +00:00
|
|
|
|
public abstract LocalisableString Title { get; }
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-06-15 15:47:34 +00:00
|
|
|
|
public abstract string Identifier { get; }
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-11-29 00:08:45 +00:00
|
|
|
|
private readonly FillFlowContainer<Drawable> content;
|
2019-06-21 23:06:30 +00:00
|
|
|
|
private readonly Box background;
|
2019-06-21 23:52:07 +00:00
|
|
|
|
private readonly Box underscore;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-06-09 07:22:07 +00:00
|
|
|
|
protected override Container<Drawable> Content => content;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2023-01-10 18:24:54 +00:00
|
|
|
|
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-12-31 16:32:20 +00:00
|
|
|
|
private const float outer_gutter_width = 10;
|
|
|
|
|
|
2017-06-09 06:53:00 +00:00
|
|
|
|
protected ProfileSection()
|
2017-05-24 18:11:07 +00:00
|
|
|
|
{
|
2017-06-09 06:53:00 +00:00
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2019-06-21 23:06:30 +00:00
|
|
|
|
|
2017-06-09 07:22:07 +00:00
|
|
|
|
InternalChildren = new Drawable[]
|
2017-06-09 06:53:00 +00:00
|
|
|
|
{
|
2023-02-04 05:29:01 +00:00
|
|
|
|
new Container
|
2017-06-09 06:53:00 +00:00
|
|
|
|
{
|
2019-06-21 23:06:30 +00:00
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2023-02-04 05:29:01 +00:00
|
|
|
|
Masking = true,
|
|
|
|
|
CornerRadius = 10,
|
|
|
|
|
EdgeEffect = new EdgeEffectParameters
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
|
Offset = new Vector2(0, 1),
|
|
|
|
|
Radius = 3,
|
|
|
|
|
Colour = Colour4.Black.Opacity(0.25f)
|
|
|
|
|
},
|
|
|
|
|
Child = background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
2017-06-09 07:22:07 +00:00
|
|
|
|
},
|
2019-06-21 23:06:30 +00:00
|
|
|
|
new FillFlowContainer
|
2017-06-09 07:22:07 +00:00
|
|
|
|
{
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2019-06-21 23:06:30 +00:00
|
|
|
|
Children = new Drawable[]
|
2017-06-09 07:22:07 +00:00
|
|
|
|
{
|
2019-06-21 23:52:07 +00:00
|
|
|
|
new Container
|
2019-06-21 23:06:30 +00:00
|
|
|
|
{
|
2019-06-21 23:52:07 +00:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2019-06-21 23:06:30 +00:00
|
|
|
|
Margin = new MarginPadding
|
|
|
|
|
{
|
2023-04-03 00:11:19 +00:00
|
|
|
|
Horizontal = WaveOverlayContainer.HORIZONTAL_PADDING - outer_gutter_width,
|
2022-12-31 16:32:20 +00:00
|
|
|
|
Top = 20,
|
2020-09-07 20:43:26 +00:00
|
|
|
|
Bottom = 20,
|
2019-06-21 23:52:07 +00:00
|
|
|
|
},
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = Title,
|
2022-12-31 16:32:20 +00:00
|
|
|
|
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
|
2019-06-21 23:52:07 +00:00
|
|
|
|
},
|
|
|
|
|
underscore = new Box
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Margin = new MarginPadding { Top = 4 },
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 2,
|
|
|
|
|
}
|
2019-06-21 23:06:30 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-12-06 20:00:26 +00: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 00:08:45 +00:00
|
|
|
|
content = new ReverseChildIDFillFlowContainer<Drawable>
|
2019-06-21 23:06:30 +00:00
|
|
|
|
{
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Padding = new MarginPadding
|
|
|
|
|
{
|
2023-04-03 00:11:19 +00:00
|
|
|
|
Horizontal = WaveOverlayContainer.HORIZONTAL_PADDING - outer_gutter_width,
|
2019-06-21 23:06:30 +00:00
|
|
|
|
Bottom = 20
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2017-06-09 06:53:00 +00:00
|
|
|
|
}
|
|
|
|
|
};
|
2019-06-21 23:06:30 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-06-21 23:06:30 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
2020-01-29 21:26:21 +00:00
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2019-06-21 23:06:30 +00:00
|
|
|
|
{
|
2022-12-31 16:32:20 +00:00
|
|
|
|
background.Colour = colourProvider.Background4;
|
2020-01-29 21:26:21 +00:00
|
|
|
|
underscore.Colour = colourProvider.Highlight1;
|
2017-05-24 18:11:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|