From 59b8da5c77ab5e9d6304daea09621fa6a36bca53 Mon Sep 17 00:00:00 2001 From: Lucas A Date: Mon, 6 May 2019 18:37:21 +0200 Subject: [PATCH] Move OsuScreen activity logic to setUserActivity() --- osu.Game/Screens/OsuScreen.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 8a6049b6fd..ad90e97a09 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -68,10 +68,9 @@ namespace osu.Game.Screens set { if (value == activity) return; - if (api == null) return; activity = value; - api.LocalUser.Value.Activity.Value = activity; + setUserActivity(activity); } } @@ -150,7 +149,7 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - ScreenActivity = ScreenActivity; + setUserActivity(activity); base.OnResuming(last); } @@ -159,6 +158,8 @@ namespace osu.Game.Screens { base.OnSuspending(next); + setUserActivity(null); + onSuspendingLogo(); } @@ -175,6 +176,8 @@ namespace osu.Game.Screens public override bool OnExiting(IScreen next) { + setUserActivity(null); + if (ValidForResume && logo != null) onExitingLogo(); @@ -187,6 +190,13 @@ namespace osu.Game.Screens return false; } + private void setUserActivity(UserActivity activity) + { + if (api == null) return; + + api.LocalUser.Value.Activity.Value = activity; + } + /// /// Fired when this screen was entered or resumed and the logo state is required to be adjusted. ///