2019-05-20 17:02:13 +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.
|
|
|
|
|
2019-12-27 12:15:55 +08:00
|
|
|
using JetBrains.Annotations;
|
2020-01-16 03:41:22 +08:00
|
|
|
using osu.Framework.Allocation;
|
2019-05-20 17:02:13 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-12-27 03:09:06 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2019-12-28 09:57:41 +08:00
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2019-05-20 17:02:13 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2019-12-27 03:09:06 +08:00
|
|
|
using osuTK.Graphics;
|
2019-05-20 17:02:13 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
{
|
2019-12-31 23:12:03 +08:00
|
|
|
public abstract class OverlayHeader : Container
|
2019-05-20 17:02:13 +08:00
|
|
|
{
|
2019-12-27 03:09:06 +08:00
|
|
|
private readonly Box titleBackground;
|
|
|
|
private readonly Box controlBackground;
|
|
|
|
private readonly Container background;
|
2020-01-16 03:41:22 +08:00
|
|
|
private readonly ScreenTitle title;
|
2019-12-27 03:09:06 +08:00
|
|
|
|
|
|
|
protected float BackgroundHeight
|
|
|
|
{
|
|
|
|
set => background.Height = value;
|
|
|
|
}
|
2019-05-20 17:02:13 +08:00
|
|
|
|
2020-01-24 17:33:34 +08:00
|
|
|
protected OverlayHeader()
|
2019-05-20 17:02:13 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
2019-12-27 12:15:55 +08:00
|
|
|
Add(new FillFlowContainer
|
2019-05-20 17:02:13 +08:00
|
|
|
{
|
2019-12-27 03:09:06 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Direction = FillDirection.Vertical,
|
2019-12-27 12:15:55 +08:00
|
|
|
Children = new[]
|
2019-05-20 17:02:13 +08:00
|
|
|
{
|
2019-12-27 03:09:06 +08:00
|
|
|
background = new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 80,
|
|
|
|
Masking = true,
|
|
|
|
Child = CreateBackground()
|
|
|
|
},
|
|
|
|
new Container
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
titleBackground = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
2020-01-16 03:41:22 +08:00
|
|
|
title = CreateTitle().With(title =>
|
2019-12-27 03:09:06 +08:00
|
|
|
{
|
|
|
|
title.Margin = new MarginPadding
|
|
|
|
{
|
2019-12-27 10:53:31 +08:00
|
|
|
Vertical = 10,
|
2019-12-27 03:09:06 +08:00
|
|
|
Left = UserProfileOverlay.CONTENT_X_MARGIN
|
|
|
|
};
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
new Container
|
2019-05-20 17:02:13 +08:00
|
|
|
{
|
2019-12-27 03:09:06 +08:00
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2019-12-27 03:16:20 +08:00
|
|
|
Depth = -float.MaxValue,
|
2019-12-27 03:09:06 +08:00
|
|
|
Children = new Drawable[]
|
2019-05-20 17:02:13 +08:00
|
|
|
{
|
2019-12-27 03:09:06 +08:00
|
|
|
controlBackground = new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = Color4.Gray,
|
|
|
|
},
|
2020-01-03 14:01:42 +08:00
|
|
|
CreateTabControl().With(control => control.Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN })
|
2019-05-20 17:02:13 +08:00
|
|
|
}
|
2019-12-27 12:15:55 +08:00
|
|
|
},
|
|
|
|
CreateContent()
|
2019-12-27 02:21:15 +08:00
|
|
|
}
|
|
|
|
});
|
2019-05-20 17:02:13 +08:00
|
|
|
}
|
|
|
|
|
2020-01-16 03:41:22 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2020-01-24 17:33:34 +08:00
|
|
|
private void load(OverlayColourProvider colourProvider)
|
2020-01-16 03:41:22 +08:00
|
|
|
{
|
2020-01-24 17:33:34 +08:00
|
|
|
titleBackground.Colour = colourProvider.Dark5;
|
|
|
|
title.AccentColour = colourProvider.Highlight1;
|
|
|
|
controlBackground.Colour = colourProvider.Dark4;
|
2020-01-16 03:41:22 +08:00
|
|
|
}
|
|
|
|
|
2019-05-20 17:02:13 +08:00
|
|
|
protected abstract Drawable CreateBackground();
|
|
|
|
|
2019-12-27 12:15:55 +08:00
|
|
|
[NotNull]
|
|
|
|
protected virtual Drawable CreateContent() => new Container();
|
2019-05-20 17:02:13 +08:00
|
|
|
|
|
|
|
protected abstract ScreenTitle CreateTitle();
|
2019-12-28 09:57:41 +08:00
|
|
|
|
2020-01-03 14:01:42 +08:00
|
|
|
protected abstract TabControl<string> CreateTabControl();
|
2019-05-20 17:02:13 +08:00
|
|
|
}
|
|
|
|
}
|