diff --git a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs index 13c672cbd6..6819d97bc5 100644 --- a/osu.Game/Graphics/Containers/LogoTrackingContainer.cs +++ b/osu.Game/Graphics/Containers/LogoTrackingContainer.cs @@ -34,17 +34,14 @@ namespace osu.Game.Graphics.Containers /// The easing type of the initial transform. public void StartTracking(OsuLogo logo, double duration = 0, Easing easing = Easing.None) { + if (Logo != null && Logo != logo) + throw new InvalidOperationException("A different logo is already being tracked."); + ArgumentNullException.ThrowIfNull(logo); if (logo.IsTracking && Logo == null) throw new InvalidOperationException($"Cannot track an instance of {typeof(OsuLogo)} to multiple {typeof(LogoTrackingContainer)}s"); - if (Logo != logo && Logo != null) - { - // If we're replacing the logo to be tracked, the old one no longer has a tracking container - Logo.IsTracking = false; - } - Logo = logo; Logo.IsTracking = true; @@ -60,11 +57,10 @@ namespace osu.Game.Graphics.Containers /// public void StopTracking() { - if (Logo != null) - { - Logo.IsTracking = false; - Logo = null; - } + if (Logo == null) return; + + Logo.IsTracking = false; + Logo = null; } /// diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index fba321d128..2d7981113b 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -269,9 +269,6 @@ namespace osu.Game.Screens.Menu dialogOverlay?.Push(new StorageErrorDialog(osuStorage, osuStorage.Error)); } - [CanBeNull] - private Drawable proxiedLogo; - [CanBeNull] private ScheduledDelegate mobileDisclaimerSchedule; @@ -284,7 +281,7 @@ namespace osu.Game.Screens.Menu logo.FadeColour(Color4.White, 100, Easing.OutQuint); logo.FadeIn(100, Easing.OutQuint); - proxiedLogo = logo.ProxyToContainer(logoTarget); + logo.ProxyToContainer(logoTarget); if (resuming) { @@ -343,11 +340,7 @@ namespace osu.Game.Screens.Menu var seq = logo.FadeOut(300, Easing.InSine) .ScaleTo(0.2f, 300, Easing.InSine); - if (proxiedLogo != null) - { - logo.ReturnProxy(); - proxiedLogo = null; - } + logo.ReturnProxy(); seq.OnComplete(_ => Buttons.SetOsuLogo(null)); seq.OnAbort(_ => Buttons.SetOsuLogo(null)); @@ -357,11 +350,7 @@ namespace osu.Game.Screens.Menu { base.LogoExiting(logo); - if (proxiedLogo != null) - { - logo.ReturnProxy(); - proxiedLogo = null; - } + logo.ReturnProxy(); } public override void OnSuspending(ScreenTransitionEvent e) diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index 962c11f345..d7dad86600 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -255,7 +255,7 @@ namespace osu.Game.Screens.SelectV2 { logo?.ScaleTo(v.NewValue == Visibility.Visible ? 0f : logo_scale, 400, Easing.OutQuint) .FadeTo(v.NewValue == Visibility.Visible ? 0f : 1f, 200, Easing.OutQuint); - }, true); + }); } protected override void Update() @@ -455,7 +455,7 @@ namespace osu.Game.Screens.SelectV2 { base.LogoArriving(logo, resuming); - if (logo.Alpha > 0.8f) + if (logo.Alpha > 0.8f && resuming) Footer?.StartTrackingLogo(logo, 400, Easing.OutQuint); else { @@ -469,7 +469,8 @@ namespace osu.Game.Screens.SelectV2 logo.Action = () => { - OnStart(); + if (this.IsCurrentScreen()) + OnStart(); return false; }; } @@ -483,7 +484,9 @@ namespace osu.Game.Screens.SelectV2 protected override void LogoExiting(OsuLogo logo) { base.LogoExiting(logo); - Scheduler.AddDelayed(() => Footer?.StopTrackingLogo(), 120); + + Footer?.StopTrackingLogo(); + logo.ScaleTo(0.2f, 120, Easing.Out); logo.FadeOut(120, Easing.Out); }