Skip to content

Commit d715946

Browse files
committed
leaving a game session now sets every player as unready
1 parent a46a38f commit d715946

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Assets/BossRoom/Scripts/Server/Game/State/ServerCharSelectState.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ void CancelCloseLobby()
134134
StopCoroutine(m_WaitToEndLobbyCoroutine);
135135
}
136136
CharSelectData.IsLobbyClosed.Value = false;
137+
// Set all players unready so they can react to this cancellation
138+
SetAllUnready();
139+
}
140+
141+
void SetAllUnready()
142+
{
137143
for (int i = 0; i < CharSelectData.LobbyPlayers.Count; ++i)
138144
{
139145
// Set all locked players to active so that they have to confirm their choice again
@@ -272,11 +278,18 @@ void OnClientDisconnectCallback(ulong clientId)
272278
}
273279
}
274280

275-
// If lobby is closing and waiting to start the game, cancel so that other players can react to it
281+
276282
if (CharSelectData.IsLobbyClosed.Value)
277283
{
284+
// If lobby is closing and waiting to start the game, cancel so that other players can react to it, and
285+
// wait for the player coming back if they want to.
278286
CancelCloseLobby();
279287
}
288+
else
289+
{
290+
// If it is not closing, set everyone as unready for the same reason
291+
SetAllUnready();
292+
}
280293
}
281294
}
282295
}

0 commit comments

Comments
 (0)