ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.52k stars 2.31k forks source link

Screens with `InitialActivity` set to null don't fallback to last screen's activity #21768

Open Joehuu opened 1 year ago

Joehuu commented 1 year ago

Type

Game behaviour

Bug description

Regressed since https://github.com/ppy/osu/pull/10740.

For example PlayerLoader: https://github.com/ppy/osu/blob/b1232a7ee7d7b5eed34cca0b3f2ee6148615a61c/osu.Game/Screens/Play/PlayerLoader.cs#L49-L50

Screenshots or videos

Discord_MQEQroL1Xv

Version

Since 2020.1114.0 / https://github.com/ppy/osu/pull/10740

Logs

N/A

Joehuu commented 1 year ago

Note: I'm ~planning~working on fixing / adding more activities, but this needs to be fixed before.

I'm willing to fix this by reverting the refactor done in the mentioned PR https://github.com/ppy/osu/pull/10740. From PR:

I also took this opportunity to refactor the user activity handling logic in OsuScreen which was making it basically impossible to share the current activity to the screen stack (in the case of screens being subscreens and not actual screens). The logic now uses a bindable flow, very similarly to how it's done for OverlayActivationMode.

The previous implementation now works with the current code thanks to https://github.com/ppy/osu/commit/a97681a5daa18b6e4374a901b65e836a1bef82eb + a tweak in OnResuming() in which base (main screen) is called first before the subscreen.


Another reason why I want to revert is because of the update flow. BindTo is inside a method that is called when the screen stack ScreenPushed and ScreenExited is invoked: https://github.com/ppy/osu/blob/209d44746ad0386029a375a2c87fe8a217c4184d/osu.Game/OsuGame.cs#L1346-L1355

Those are invoked right after a push or exit is made: https://github.com/ppy/osu-framework/blob/8afa7d26386095b21f76f76ca4ce1f0b52a6567a/osu.Framework/Screens/ScreenStack.cs#L105-L117

The screen doesn't have the time to load() / LoadComplete(), so Activity.Value can potentially be null and resulting in a brief Idle on discord rich presence: https://github.com/ppy/osu/blob/209d44746ad0386029a375a2c87fe8a217c4184d/osu.Game/Screens/OsuScreen.cs#L154-L157