2021-01-18 07:48:12 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
2021-06-07 09:18:18 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2021-01-18 07:48:12 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2021-02-18 09:04:41 +00:00
|
|
|
|
using osu.Game.Online;
|
2021-01-18 07:48:12 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
2021-01-18 08:13:38 +00:00
|
|
|
|
public abstract class OnlineOverlay<T> : FullscreenOverlay<T>
|
2021-01-18 07:48:12 +00:00
|
|
|
|
where T : OverlayHeader
|
|
|
|
|
{
|
|
|
|
|
protected override Container<Drawable> Content => content;
|
|
|
|
|
|
2021-06-07 09:18:18 +00:00
|
|
|
|
[Cached]
|
2021-01-18 07:48:12 +00:00
|
|
|
|
protected readonly OverlayScrollContainer ScrollFlow;
|
2021-06-07 09:18:18 +00:00
|
|
|
|
|
2021-01-18 07:48:12 +00:00
|
|
|
|
protected readonly LoadingLayer Loading;
|
|
|
|
|
private readonly Container content;
|
|
|
|
|
|
2021-02-18 09:04:41 +00:00
|
|
|
|
protected OnlineOverlay(OverlayColourScheme colourScheme, bool requiresSignIn = true)
|
2021-01-18 07:48:12 +00:00
|
|
|
|
: base(colourScheme)
|
|
|
|
|
{
|
2021-02-18 09:04:41 +00:00
|
|
|
|
var mainContent = requiresSignIn
|
|
|
|
|
? new OnlineViewContainer($"Sign in to view the {Header.Title.Title}")
|
|
|
|
|
: new Container();
|
|
|
|
|
|
|
|
|
|
mainContent.RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
|
|
mainContent.AddRange(new Drawable[]
|
2021-01-18 07:48:12 +00:00
|
|
|
|
{
|
|
|
|
|
ScrollFlow = new OverlayScrollContainer
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
ScrollbarVisible = false,
|
2021-01-21 04:50:41 +00:00
|
|
|
|
Child = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2021-02-10 02:31:34 +00:00
|
|
|
|
Header.With(h => h.Depth = float.MinValue),
|
2021-01-21 04:50:41 +00:00
|
|
|
|
content = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-18 07:48:12 +00:00
|
|
|
|
},
|
2021-02-18 13:38:17 +00:00
|
|
|
|
Loading = new LoadingLayer(true)
|
2021-01-18 07:48:12 +00:00
|
|
|
|
});
|
2021-02-18 09:04:41 +00:00
|
|
|
|
|
|
|
|
|
base.Content.Add(mainContent);
|
2021-01-18 07:48:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|