Ejemplo n.º 1
0
        private void OnReadMessage(rdtTcpMessage message)
        {
            if (message is rdtTcpMessageLog)
            {
                rdtTcpMessageLog log = (rdtTcpMessageLog)message;
                switch (log.m_logType)
                {
                case LogType.Error:
                    Debug.LogError(log);
                    break;

                case LogType.Assert:
                    Debug.LogError(log);
                    break;

                case LogType.Warning:
                    Debug.LogWarning(log);
                    break;

                case LogType.Log:
                    Debug.Log(log);
                    break;

                case LogType.Exception:
                    Debug.LogError(log);
                    break;
                }
            }
            if (this.m_messageCallbacks.ContainsKey(message.GetType()))
            {
                this.m_messageCallbacks[message.GetType()](message);
            }
        }
Ejemplo n.º 2
0
 private void OnReadMessage(rdtTcpMessage message)
 {
     if (this.m_messageCallbacks.ContainsKey(message.GetType()))
     {
         this.m_messagesToProcess.Add(message);
     }
 }
Ejemplo n.º 3
0
 private void OnConnected()
 {
     if (this.m_listener.Pending())
     {
         this.m_listener.AcceptTcpClient().Close();
     }
     if ((!this.m_client.Connected || !this.m_readThread.IsConnected) || !this.m_writeThread.IsConnected)
     {
         this.SetState(State.Disconnected);
     }
     else
     {
         this.m_dispatcher.Update();
         bool flag  = false;
         bool flag2 = false;
         for (int i = 0; i < this.m_messagesToProcess.Count; i++)
         {
             System.Type type = this.m_messagesToProcess[i].GetType();
             if (type == typeof(rdtTcpMessageGetGameObjects))
             {
                 if (flag)
                 {
                     this.m_messagesToProcess.RemoveAt(i);
                     i--;
                 }
                 else
                 {
                     flag = true;
                 }
             }
             else if (type == typeof(rdtTcpMessageGetComponents))
             {
                 if (flag2)
                 {
                     this.m_messagesToProcess.RemoveAt(i);
                     i--;
                 }
                 else
                 {
                     flag2 = true;
                 }
             }
         }
         while (this.m_messagesToProcess.Count > 0)
         {
             rdtTcpMessage message2 = this.m_messagesToProcess[0];
             this.m_messagesToProcess.RemoveAt(0);
             this.m_messageCallbacks[message2.GetType()](message2);
         }
     }
 }