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 @@ public class ChangelogOverlay : OnlineOverlay<ChangelogHeader>
protected List<APIUpdateStream> Streams;
public ChangelogOverlay()
: base(OverlayColourScheme.Purple)
: base(OverlayColourScheme.Purple, false)
{
}

View File

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

View File

@ -4,6 +4,7 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
namespace osu.Game.Overlays
{
@ -16,10 +17,16 @@ public abstract class OnlineOverlay<T> : FullscreenOverlay<T>
protected readonly LoadingLayer Loading;
private readonly Container content;
protected OnlineOverlay(OverlayColourScheme colourScheme)
protected OnlineOverlay(OverlayColourScheme colourScheme, bool requiresSignIn = true)
: 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
{
@ -41,8 +48,10 @@ protected OnlineOverlay(OverlayColourScheme colourScheme)
}
}
},
Loading = new LoadingLayer(true)
Loading = new LoadingLayer()
});
base.Content.Add(mainContent);
}
}
}

View File

@ -61,8 +61,7 @@ protected void LoadDisplay(Drawable display)
LoadComponentAsync(display, loaded =>
{
if (API.IsLoggedIn)
Loading.Hide();
Loading.Hide();
Child = loaded;
}, (cancellationToken = new CancellationTokenSource()).Token);