Refactor background creation in OverlayHeader

This commit is contained in:
Andrei Zavatski
2020-01-27 15:36:19 +03:00
parent d0715700eb
commit e6fa793d56
6 changed files with 63 additions and 77 deletions

View File

@ -14,16 +14,10 @@ namespace osu.Game.Overlays
public abstract class OverlayHeader : Container
{
private readonly Box titleBackground;
private readonly Container background;
private readonly ScreenTitle title;
protected readonly FillFlowContainer HeaderInfo;
protected float BackgroundHeight
{
set => background.Height = value;
}
protected OverlayHeader()
{
RelativeSizeAxes = Axes.X;
@ -44,13 +38,7 @@ namespace osu.Game.Overlays
Depth = -float.MaxValue,
Children = new Drawable[]
{
background = new Container
{
RelativeSizeAxes = Axes.X,
Height = 80,
Masking = true,
Child = CreateBackground()
},
CreateBackground(),
new Container
{
RelativeSizeAxes = Axes.X,
@ -86,11 +74,12 @@ namespace osu.Game.Overlays
title.AccentColour = colourProvider.Highlight1;
}
protected abstract Drawable CreateBackground();
[NotNull]
protected virtual Drawable CreateContent() => new Container();
[NotNull]
protected virtual Drawable CreateBackground() => new Container();
protected abstract ScreenTitle CreateTitle();
}
}