1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:55:35 +08:00

Mark OverlayHeader as NotNull in FullscreenOverlay

This commit is contained in:
Andrei Zavatski 2021-01-21 07:50:41 +03:00
parent da0066e7b0
commit 65ece1aa72
2 changed files with 20 additions and 20 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -16,9 +17,9 @@ namespace osu.Game.Overlays
public abstract class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent public abstract class FullscreenOverlay<T> : WaveOverlayContainer, INamedOverlayComponent
where T : OverlayHeader where T : OverlayHeader
{ {
public virtual string IconTexture => Header?.Title.IconTexture ?? string.Empty; public virtual string IconTexture => Header.Title.IconTexture ?? string.Empty;
public virtual string Title => Header?.Title.Title ?? string.Empty; public virtual string Title => Header.Title.Title ?? string.Empty;
public virtual string Description => Header?.Title.Description ?? string.Empty; public virtual string Description => Header.Title.Description ?? string.Empty;
public T Header { get; } public T Header { get; }
@ -76,6 +77,7 @@ namespace osu.Game.Overlays
Waves.FourthWaveColour = ColourProvider.Dark3; Waves.FourthWaveColour = ColourProvider.Dark3;
} }
[NotNull]
protected abstract T CreateHeader(); protected abstract T CreateHeader();
protected virtual Color4 GetBackgroundColour() => ColourProvider.Background5; protected virtual Color4 GetBackgroundColour() => ColourProvider.Background5;

View File

@ -19,29 +19,27 @@ namespace osu.Game.Overlays
protected OnlineOverlay(OverlayColourScheme colourScheme) protected OnlineOverlay(OverlayColourScheme colourScheme)
: base(colourScheme) : base(colourScheme)
{ {
FillFlowContainer flow = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical
};
if (Header != null)
flow.Add(Header.With(h => h.Depth = -float.MaxValue));
flow.Add(content = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
});
base.Content.AddRange(new Drawable[] base.Content.AddRange(new Drawable[]
{ {
ScrollFlow = new OverlayScrollContainer ScrollFlow = new OverlayScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ScrollbarVisible = false, ScrollbarVisible = false,
Child = flow Child = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
Header.With(h => h.Depth = -float.MaxValue),
content = new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
}
}
}
}, },
Loading = new LoadingLayer(true) Loading = new LoadingLayer(true)
}); });