Skip to content

fix: setting players unready when one leaves or joins #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,6 @@ void CancelCloseLobby()
StopCoroutine(m_WaitToEndLobbyCoroutine);
}
CharSelectData.IsLobbyClosed.Value = false;
// Set all players unready so they can react to this cancellation
SetAllUnready();
}

void SetAllUnready()
{
for (int i = 0; i < CharSelectData.LobbyPlayers.Count; ++i)
{
// Set all locked players to active so that they have to confirm their choice again
if (CharSelectData.LobbyPlayers[i].SeatState == CharSelectData.SeatState.LockedIn)
{
CharSelectData.LobbyPlayers[i] = new CharSelectData.LobbyPlayerState(
CharSelectData.LobbyPlayers[i].ClientId,
CharSelectData.LobbyPlayers[i].PlayerName,
CharSelectData.LobbyPlayers[i].PlayerNumber,
CharSelectData.SeatState.Active,
CharSelectData.LobbyPlayers[i].SeatIdx,
CharSelectData.LobbyPlayers[i].LastChangeTime);
}
}
}

void SaveLobbyResults()
Expand Down Expand Up @@ -283,17 +263,10 @@ void OnClientDisconnectCallback(ulong clientId)
}
}


if (CharSelectData.IsLobbyClosed.Value)
{
// If lobby is closing and waiting to start the game, cancel so that other players can react to it, and
// wait for the player coming back if they want to.
CancelCloseLobby();
}
else
if (!CharSelectData.IsLobbyClosed.Value)
{
// If it is not closing, set everyone as unready for the same reason
SetAllUnready();
// If the lobby is not already closing, close if the remaining players are all ready
CloseLobbyIfReady();
}
}
}
Expand Down