From 65ece1aa722b74e6590b4b3d208a10141238164d Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Thu, 21 Jan 2021 07:50:41 +0300 Subject: [PATCH] Mark OverlayHeader as NotNull in FullscreenOverlay --- osu.Game/Overlays/FullscreenOverlay.cs | 8 ++++--- osu.Game/Overlays/OnlineOverlay.cs | 32 ++++++++++++-------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game/Overlays/FullscreenOverlay.cs b/osu.Game/Overlays/FullscreenOverlay.cs index d65213f573..d0a0c994aa 100644 --- a/osu.Game/Overlays/FullscreenOverlay.cs +++ b/osu.Game/Overlays/FullscreenOverlay.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; @@ -16,9 +17,9 @@ namespace osu.Game.Overlays public abstract class FullscreenOverlay : WaveOverlayContainer, INamedOverlayComponent where T : OverlayHeader { - public virtual string IconTexture => Header?.Title.IconTexture ?? string.Empty; - public virtual string Title => Header?.Title.Title ?? string.Empty; - public virtual string Description => Header?.Title.Description ?? string.Empty; + public virtual string IconTexture => Header.Title.IconTexture ?? string.Empty; + public virtual string Title => Header.Title.Title ?? string.Empty; + public virtual string Description => Header.Title.Description ?? string.Empty; public T Header { get; } @@ -76,6 +77,7 @@ namespace osu.Game.Overlays Waves.FourthWaveColour = ColourProvider.Dark3; } + [NotNull] protected abstract T CreateHeader(); protected virtual Color4 GetBackgroundColour() => ColourProvider.Background5; diff --git a/osu.Game/Overlays/OnlineOverlay.cs b/osu.Game/Overlays/OnlineOverlay.cs index b44ccc32c9..4a7318d065 100644 --- a/osu.Game/Overlays/OnlineOverlay.cs +++ b/osu.Game/Overlays/OnlineOverlay.cs @@ -19,29 +19,27 @@ namespace osu.Game.Overlays protected OnlineOverlay(OverlayColourScheme 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[] { ScrollFlow = new OverlayScrollContainer { RelativeSizeAxes = Axes.Both, 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) });