private void ReceivedPickedTurnOrder(int connectionID, LobbyPickedTurnOrderMessage picked)
 {
     if (info.IsHost(connectionID))
     {
         pickedTurnOrder = picked.choice;
     }
     if (info.IsConnected(connectionID))
     {
         NetworkTracker.ServerSendLobbyPickedTurnOrder(info.OtherConnectionID(connectionID), picked);
     }
 }
Beispiel #2
0
        private bool CheckNowReady(int newlyReady, bool hasExtraData)
        {
            //UnityEngine.Debug.Log("Player notified ready " + newlyReady);

            ConnectionData newConnection = GetData(newlyReady);

            if (newConnection != null)
            {
                //UnityEngine.Debug.LogError("Player notified ready to exit lobby twice: " + newlyReady);
                return(false);
            }
            if (newConnection == null && enforceExtraData && !hasExtraData)
            {
                return(false);
            }
            if (connections.Count >= 2)
            {
                UnityEngine.Debug.LogError("More than two players notified ready: " + newlyReady);
                //return false;
            }

            newConnection = new ConnectionData()
            {
                connectionID = newlyReady,
                timer        = 0,
                extraData    = null,
            };
            connections.Add(newConnection);
            if (connections.Count < 2)
            {
                return(false);
            }

            bool hostReady   = false;
            bool clientReady = false;

            foreach (var connectionData in connections)
            {
                if (serverInfo.IsHost(connectionData.connectionID))
                {
                    hostReady = true;
                }
                else if (serverInfo.ClientConnectionID == connectionData.connectionID)
                {
                    clientReady = true;
                }
            }

            return(hostReady && clientReady);
        }