Exemplo n.º 1
0
 protected void HandleReader(QNetworkReader reader, int receivedSize, int channelId)
 {
     while (reader.Position < receivedSize)
     {
         var num     = reader.ReadUInt16();
         var num2    = reader.ReadInt16();
         var array   = reader.ReadBytes(num);
         var reader2 = new QNetworkReader(array);
         QNetworkMessageDelegate networkMessageDelegate = null;
         if (m_MessageHandlersDict.ContainsKey(num2))
         {
             networkMessageDelegate = m_MessageHandlersDict[num2];
         }
         if (networkMessageDelegate == null)
         {
             QLog.Error($"Unknown message ID {num2} connId:{connectionId}");
             break;
         }
         m_NetMsg.MsgType    = num2;
         m_NetMsg.Reader     = reader2;
         m_NetMsg.Connection = this;
         m_NetMsg.ChannelId  = channelId;
         networkMessageDelegate(m_NetMsg);
         lastMessageTime = Time.time;
     }
 }