Fix loader pushing children screens before it is displayed itself

This commit is contained in:
Dean Herbert 2017-11-09 23:24:14 +09:00
parent 8a8e6269ad
commit 5eb94f7e68
1 changed files with 27 additions and 5 deletions

View File

@ -5,11 +5,14 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using OpenTK; using OpenTK;
using osu.Framework.Screens;
namespace osu.Game.Screens namespace osu.Game.Screens
{ {
public class Loader : OsuScreen public class Loader : OsuScreen
{ {
private bool showDisclaimer;
public override bool ShowOverlays => false; public override bool ShowOverlays => false;
public Loader() public Loader()
@ -21,21 +24,40 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
{ {
base.LogoArriving(logo, resuming); base.LogoArriving(logo, resuming);
logo.RelativePositionAxes = Axes.Both; logo.RelativePositionAxes = Axes.None;
logo.Triangles = false; logo.Triangles = false;
logo.Position = new Vector2(0.9f); logo.Origin = Anchor.BottomRight;
logo.Anchor = Anchor.BottomRight;
logo.Position = new Vector2(-40);
logo.Scale = new Vector2(0.2f); logo.Scale = new Vector2(0.2f);
logo.FadeInFromZero(5000, Easing.OutQuint); logo.FadeInFromZero(5000, Easing.OutQuint);
} }
[BackgroundDependencyLoader] protected override void OnEntering(Screen last)
private void load(OsuGameBase game)
{ {
if (game.IsDeployedBuild) base.OnEntering(last);
if (showDisclaimer)
LoadComponentAsync(new Disclaimer(), d => Push(d)); LoadComponentAsync(new Disclaimer(), d => Push(d));
else else
LoadComponentAsync(new Intro(), d => Push(d)); LoadComponentAsync(new Intro(), d => Push(d));
} }
protected override void LogoSuspending(OsuLogo logo)
{
base.LogoSuspending(logo);
logo.FadeOut(100).OnComplete(l =>
{
l.Anchor = Anchor.TopLeft;
l.Origin = Anchor.Centre;
});
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
showDisclaimer = game.IsDeployedBuild;
}
} }
} }