private void onPlayerModelReceived(ServerPlayerModel serverPlayerModel)
        {
            // Unready all players
            for (int i = 0; i < activeServerPlayerModels.Count; i++)
            {
                SendPlayerUnreadyEventSCMD.Execute(activeServerPlayerModels[i].ClientConnection, activeServerPlayerModels);
            }

            serverPlayerModel.ClientConnection = playerIDToConnection[serverPlayerModel.PlayerID];
            activeServerPlayerModels.Add(serverPlayerModel);

            serverPlayerModel.ClientConnection.AddOperationRequestListener(PlayerReadyOpRequest.OP_CODE, onPlayerReady);
            serverPlayerModel.ClientConnection.AddOperationRequestListener(PlayerUnreadyOpRequest.OP_CODE, onPlayerUnready);

            SendPlayerJoinedLobbyEventsSCMD.Execute(serverPlayerModel, activeServerPlayerModels);

            Log.Info("LobbyController listening for player ready/unready");
        }
        private void onClientDisconnected(IClientConnection clientConnection)
        {
            clientConnection.Disconnected -= onClientDisconnected;
            string disconnectedPlayerID = clientPeerConnectionToPlayerID[clientConnection];

            for (int i = activeServerPlayerModels.Count - 1; i >= 0; i--)
            {
                if (activeServerPlayerModels[i].PlayerID == disconnectedPlayerID)
                {
                    activeServerPlayerModels.RemoveAt(i);
                }
                else
                {
                    // unready all players
                    SendPlayerUnreadyEventSCMD.Execute(activeServerPlayerModels[i].ClientConnection, activeServerPlayerModels);
                }
            }

            playerIDToConnection.Remove(disconnectedPlayerID);
            clientPeerConnectionToPlayerID.Remove(clientConnection);

            SendPlayerDisconnectedEventSCMD.Execute(disconnectedPlayerID, activeServerPlayerModels);
        }
 private void onPlayerUnready(OperationRequest opRequest, IClientConnection clientConnection, SendParameters sendParameters)
 {
     SendPlayerUnreadyEventSCMD.Execute(clientConnection, activeServerPlayerModels);
 }