Add login placeholder logic to OnlineOverlay

A perfect implementation of this would probably leave the filter/header
content visible, but that requires some re-thinking and restructuring to
how the content is displayed in these overlays (ie. the header
component shouldn't be inside the `ScrollContainer` as it is fixed).

Supersedes and closes #10774.
Closes #933.
Addresses most pieces of #7417.
This commit is contained in:
Dean Herbert
2021-02-18 18:04:41 +09:00
parent 58d8f0733c
commit 0bd1964d8e
4 changed files with 15 additions and 7 deletions

View File

@ -30,7 +30,7 @@ namespace osu.Game.Overlays
protected List<APIUpdateStream> Streams; protected List<APIUpdateStream> Streams;
public ChangelogOverlay() public ChangelogOverlay()
: base(OverlayColourScheme.Purple) : base(OverlayColourScheme.Purple, false)
{ {
} }

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays
private readonly Bindable<string> article = new Bindable<string>(null); private readonly Bindable<string> article = new Bindable<string>(null);
public NewsOverlay() public NewsOverlay()
: base(OverlayColourScheme.Purple) : base(OverlayColourScheme.Purple, false)
{ {
} }

View File

@ -4,6 +4,7 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
namespace osu.Game.Overlays namespace osu.Game.Overlays
{ {
@ -16,10 +17,16 @@ namespace osu.Game.Overlays
protected readonly LoadingLayer Loading; protected readonly LoadingLayer Loading;
private readonly Container content; private readonly Container content;
protected OnlineOverlay(OverlayColourScheme colourScheme) protected OnlineOverlay(OverlayColourScheme colourScheme, bool requiresSignIn = true)
: base(colourScheme) : base(colourScheme)
{ {
base.Content.AddRange(new Drawable[] var mainContent = requiresSignIn
? new OnlineViewContainer($"Sign in to view the {Header.Title.Title}")
: new Container();
mainContent.RelativeSizeAxes = Axes.Both;
mainContent.AddRange(new Drawable[]
{ {
ScrollFlow = new OverlayScrollContainer ScrollFlow = new OverlayScrollContainer
{ {
@ -41,8 +48,10 @@ namespace osu.Game.Overlays
} }
} }
}, },
Loading = new LoadingLayer(true) Loading = new LoadingLayer()
}); });
base.Content.Add(mainContent);
} }
} }
} }

View File

@ -61,8 +61,7 @@ namespace osu.Game.Overlays
LoadComponentAsync(display, loaded => LoadComponentAsync(display, loaded =>
{ {
if (API.IsLoggedIn) Loading.Hide();
Loading.Hide();
Child = loaded; Child = loaded;
}, (cancellationToken = new CancellationTokenSource()).Token); }, (cancellationToken = new CancellationTokenSource()).Token);