Move OsuScreen activity logic to setUserActivity()

This commit is contained in:
Lucas A 2019-05-06 18:37:21 +02:00
parent a50bbf7f42
commit 59b8da5c77

View File

@ -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;
}
/// <summary>
/// Fired when this screen was entered or resumed and the logo state is required to be adjusted.
/// </summary>