mirror of
https://github.com/osukey/osukey.git
synced 2025-06-09 05:19:11 +09:00
Fix multiplayer race condition when starting gameplay
This commit is contained in:
parent
c524b665ad
commit
3915b8e414
@ -149,6 +149,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
protected override void StartGameplay()
|
protected override void StartGameplay()
|
||||||
{
|
{
|
||||||
|
// We can enter this screen one of two ways:
|
||||||
|
// 1. Via the automatic natural progression of PlayerLoader into Player.
|
||||||
|
// We'll arrive here in a Loaded state, and we need to let the server know that we're ready to start.
|
||||||
|
// 2. Via the server forcefully starting gameplay because players have been hanging out in PlayerLoader for too long.
|
||||||
|
// We'll arrive here in a Playing state, and we should neither show the loading spinner nor tell the server that we're ready to start (gameplay has already started).
|
||||||
|
|
||||||
if (client.LocalUser?.State == MultiplayerUserState.Loaded)
|
if (client.LocalUser?.State == MultiplayerUserState.Loaded)
|
||||||
{
|
{
|
||||||
// block base call, but let the server know we are ready to start.
|
// block base call, but let the server know we are ready to start.
|
||||||
|
@ -26,8 +26,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ReadyForGameplay =>
|
protected override bool ReadyForGameplay =>
|
||||||
base.ReadyForGameplay
|
(
|
||||||
// The server is forcefully starting gameplay.
|
// The user is ready to enter gameplay.
|
||||||
|
base.ReadyForGameplay
|
||||||
|
// And the server has received the message that we're loaded.
|
||||||
|
&& multiplayerClient.LocalUser?.State == MultiplayerUserState.Loaded
|
||||||
|
)
|
||||||
|
// Or the server is forcefully starting gameplay.
|
||||||
|| multiplayerClient.LocalUser?.State == MultiplayerUserState.Playing;
|
|| multiplayerClient.LocalUser?.State == MultiplayerUserState.Playing;
|
||||||
|
|
||||||
protected override void OnPlayerLoaded()
|
protected override void OnPlayerLoaded()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user