mirror of https://github.com/ppy/osu
Open login overlay if user isn't signed in after intro sequence (#6038)
Open login overlay if user isn't signed in after intro sequence Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
fc7e8dcbfb
|
@ -11,6 +11,7 @@
|
|||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Charts;
|
||||
|
@ -44,6 +45,12 @@ public class MainMenu : OsuScreen
|
|||
[Resolved(canBeNull: true)]
|
||||
private MusicController music { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private LoginOverlay login { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
private BackgroundScreenDefault background;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => background;
|
||||
|
@ -133,6 +140,8 @@ public override void OnEntering(IScreen last)
|
|||
Beatmap.ValueChanged += beatmap_ValueChanged;
|
||||
}
|
||||
|
||||
private bool loginDisplayed;
|
||||
|
||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||
{
|
||||
base.LogoArriving(logo, resuming);
|
||||
|
@ -151,6 +160,21 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
|
|||
|
||||
sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
|
||||
}
|
||||
else if (!api.IsLoggedIn)
|
||||
{
|
||||
logo.Action += displayLogin;
|
||||
}
|
||||
|
||||
bool displayLogin()
|
||||
{
|
||||
if (!loginDisplayed)
|
||||
{
|
||||
Scheduler.AddDelayed(() => login?.Show(), 500);
|
||||
loginDisplayed = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LogoSuspending(OsuLogo logo)
|
||||
|
|
Loading…
Reference in New Issue