From 89533fa33d32954a889ff0dcc307a16b2a4519bb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 16 Jun 2022 15:40:17 +0900 Subject: [PATCH 1/3] Fix `Disclaimer` screen handling user change events after initial display Unnecessary overhead, but also should resolve a production hard crash. --- osu.Game/Screens/Menu/Disclaimer.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 24412cd85e..3482b171a3 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -171,6 +171,14 @@ namespace osu.Game.Screens.Menu ((IBindable)currentUser).BindTo(api.LocalUser); } + public override void OnSuspending(ScreenTransitionEvent e) + { + base.OnSuspending(e); + + // Once this screen has finished being displayed, we don't want to unnecessarily handle user change events. + currentUser.UnbindAll(); + } + public override void OnEntering(ScreenTransitionEvent e) { base.OnEntering(e); From e51babdb96f64cf1a75266d69a2814f8653c3175 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Jun 2022 17:01:11 +0900 Subject: [PATCH 2/3] Change heart animation flow to be more correct --- osu.Game/Screens/Menu/Disclaimer.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 3482b171a3..17064e5abc 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -146,16 +146,17 @@ namespace osu.Game.Screens.Menu supportFlow.AddText(" to help support osu!'s development", formatSemiBold); } - heart = supportFlow.AddIcon(FontAwesome.Solid.Heart, t => + supportFlow.AddIcon(FontAwesome.Solid.Heart, t => { + heart = t; + t.Padding = new MarginPadding { Left = 5, Top = 3 }; t.Font = t.Font.With(size: 20); t.Origin = Anchor.Centre; t.Colour = colours.Pink; - }).Drawables.First(); - if (IsLoaded) - animateHeart(); + Schedule(animateHeart); + }); if (supportFlow.IsPresent) supportFlow.FadeInFromZero(500); @@ -214,8 +215,6 @@ namespace osu.Game.Screens.Menu foreach (var c in textFlow.Children) c.FadeTo(0.001f).Delay(delay += 20).FadeIn(500); - animateHeart(); - this .FadeInFromZero(500) .Then(5500) @@ -255,7 +254,7 @@ namespace osu.Game.Screens.Menu private void animateHeart() { - heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); + heart?.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); } } } From 1900480d51ed5cb47d5f9ac4355e5e055df7fcaf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 17 Jun 2022 17:06:06 +0900 Subject: [PATCH 3/3] Inline animation method --- osu.Game/Screens/Menu/Disclaimer.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 17064e5abc..7a6d845bf1 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Menu t.Origin = Anchor.Centre; t.Colour = colours.Pink; - Schedule(animateHeart); + Schedule(() => heart?.FlashColour(Color4.White, 750, Easing.OutQuint).Loop()); }); if (supportFlow.IsPresent) @@ -251,10 +251,5 @@ namespace osu.Game.Screens.Menu return tips[RNG.Next(0, tips.Length)]; } - - private void animateHeart() - { - heart?.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); - } } }