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.
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-12-27 03:09:06 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
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
|
|
|
|
{
|
|
|
|
public abstract class OverlayHeader : Container
|
|
|
|
{
|
2019-05-21 12:36:21 +08:00
|
|
|
protected readonly OverlayHeaderTabControl TabControl;
|
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;
|
|
|
|
|
|
|
|
protected Color4 TitleBackgroundColour
|
|
|
|
{
|
|
|
|
set => titleBackground.Colour = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected Color4 ControlBackgroundColour
|
|
|
|
{
|
|
|
|
set => controlBackground.Colour = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected float BackgroundHeight
|
|
|
|
{
|
|
|
|
set => background.Height = value;
|
|
|
|
}
|
2019-05-20 17:02:13 +08:00
|
|
|
|
|
|
|
protected OverlayHeader()
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
2019-12-27 03:09:06 +08:00
|
|
|
FillFlowContainer flow;
|
|
|
|
|
|
|
|
Add(flow = 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,
|
|
|
|
Children = new Drawable[]
|
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,
|
|
|
|
Colour = Color4.Gray,
|
|
|
|
},
|
|
|
|
CreateTitle().With(title =>
|
|
|
|
{
|
|
|
|
title.Margin = new MarginPadding
|
|
|
|
{
|
|
|
|
Vertical = 5,
|
|
|
|
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,
|
|
|
|
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,
|
|
|
|
},
|
|
|
|
TabControl = new OverlayHeaderTabControl
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Height = 30,
|
|
|
|
Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN },
|
|
|
|
}
|
2019-05-20 17:02:13 +08:00
|
|
|
}
|
|
|
|
}
|
2019-12-27 02:21:15 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (CreateContent != null)
|
2019-12-27 03:09:06 +08:00
|
|
|
flow.Add(CreateContent);
|
2019-05-20 17:02:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
protected abstract Drawable CreateBackground();
|
|
|
|
|
2019-12-27 02:21:15 +08:00
|
|
|
protected virtual Drawable CreateContent => null;
|
2019-05-20 17:02:13 +08:00
|
|
|
|
|
|
|
protected abstract ScreenTitle CreateTitle();
|
|
|
|
}
|
|
|
|
}
|