1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 07:42:54 +08:00
osu-lazer/osu.Game/Overlays/OverlayHeader.cs

86 lines
3.0 KiB
C#
Raw Normal View History

// 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.
using JetBrains.Annotations;
2020-01-16 03:41:22 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.UserInterface;
using osuTK.Graphics;
namespace osu.Game.Overlays
{
2019-12-31 23:12:03 +08:00
public abstract class OverlayHeader : Container
{
private readonly Box titleBackground;
2020-01-16 03:41:22 +08:00
private readonly ScreenTitle title;
2020-01-20 13:52:03 +08:00
protected readonly FillFlowContainer HeaderInfo;
protected OverlayHeader()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Add(new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new[]
{
HeaderInfo = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Depth = -float.MaxValue,
2020-01-27 21:45:10 +08:00
Children = new[]
{
CreateBackground(),
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
titleBackground = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Gray,
},
2020-01-20 13:52:03 +08:00
title = CreateTitle().With(title =>
{
title.Margin = new MarginPadding
{
Vertical = 10,
Left = UserProfileOverlay.CONTENT_X_MARGIN
};
})
}
},
}
},
CreateContent()
}
});
}
2020-01-16 03:41:22 +08:00
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
2020-01-16 03:41:22 +08:00
{
titleBackground.Colour = colourProvider.Dark5;
title.AccentColour = colourProvider.Highlight1;
2020-01-16 03:41:22 +08:00
}
[NotNull]
protected virtual Drawable CreateContent() => Drawable.Empty();
[NotNull]
protected virtual Drawable CreateBackground() => Drawable.Empty();
protected abstract ScreenTitle CreateTitle();
}
}