Ensure user is returned to the `RoomSubScreen` before gameplay is started

This covers the scenario where a user may be at the song select screen
while another user (the room host) starts the match. This was only made
possible with the new queue modes, so is quite a recent regression.
This commit is contained in:
Dean Herbert 2021-12-06 14:03:51 +09:00
parent a76cfbea21
commit 0ea7a69084
1 changed files with 10 additions and 0 deletions

View File

@ -319,6 +319,16 @@ public override bool OnExiting(IScreen next)
protected void StartPlay()
{
// User may be at song select or otherwise when the host starts gameplay.
// Ensure that they first return to this screen, else global bindables (beatmap etc.) may be in a bad state.
if (!this.IsCurrentScreen())
{
this.MakeCurrent();
Schedule(StartPlay);
return;
}
sampleStart?.Play();
// fallback is to allow this class to operate when there is no parent OnlineScreen (testing purposes).