diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 17b8ca60dc..d8b38ff20a 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -55,29 +55,27 @@ namespace osu.Game.Screens protected new OsuGameBase Game => base.Game as OsuGameBase; /// - /// The to set the user's status automatically to when this screen is entered + /// The to set the user's activity automatically to when this screen is entered /// - protected virtual UserStatusOnline InitialScreenStatus => new UserStatusOnline(); + protected virtual UserActivity InitialScreenActivity => null; /// - /// The for this screen. - /// Note that the status won't be updated for the user if : - /// - The is set to null - /// - The current of the user is or + /// The for this screen. /// - protected UserStatusOnline ScreenStatus + protected UserActivity ScreenActivity { set { if (value == null) return; + if (api == null) return; - status = value; - setUserStatus(value); + activity = value; + api.LocalUser.Value.Activity.Value = activity; } - get => status; + get => activity; } - private UserStatusOnline status; + private UserActivity activity; /// /// Whether to disallow changes to game-wise Beatmap/Ruleset bindables for this screen (and all children). @@ -122,7 +120,7 @@ namespace osu.Game.Screens Anchor = Anchor.Centre; Origin = Anchor.Centre; - status = null; + activity = null; } [BackgroundDependencyLoader(true)] @@ -152,28 +150,15 @@ namespace osu.Game.Screens sampleExit?.Play(); applyArrivingDefaults(true); - if (api != null) - api.LocalUser.Value.Status.ValueChanged += userStatusChanged; - ScreenStatus = ScreenStatus; base.OnResuming(last); } - private void userStatusChanged(ValueChangedEvent obj) - { - if (obj.NewValue?.GetType() == ScreenStatus?.GetType()) return; //don't update the user's status if the current status is of the same type as the given one - - setUserStatus(ScreenStatus); - } - public override void OnSuspending(IScreen next) { base.OnSuspending(next); - if (api != null) - api.LocalUser.Value.Status.ValueChanged -= userStatusChanged; - onSuspendingLogo(); } @@ -183,10 +168,7 @@ namespace osu.Game.Screens backgroundStack?.Push(localBackground = CreateBackground()); - if (api != null) - api.LocalUser.Value.Status.ValueChanged += userStatusChanged; - - ScreenStatus = InitialScreenStatus; + ScreenStatus = InitialScreenActivity; base.OnEntering(last); } @@ -196,9 +178,6 @@ namespace osu.Game.Screens if (ValidForResume && logo != null) onExitingLogo(); - if (api != null) - api.LocalUser.Value.Status.ValueChanged -= userStatusChanged; - if (base.OnExiting(next)) return true; @@ -208,16 +187,6 @@ namespace osu.Game.Screens return false; } - private void setUserStatus(UserStatus status) - { - if (api == null) return; - if (status == null) return; - - if (!(api.LocalUser.Value.Status.Value is UserStatusOnline)) return; //don't update the user's status if the current status doesn't allow to be modified by screens (eg: DND / Offline) - - api.LocalUser.Value.Status.Value = status; - } - /// /// Fired when this screen was entered or resumed and the logo state is required to be adjusted. ///