private static float ReadAngle(QNetworkReader reader, CompressionSyncMode compression)
        {
            float result;

            if (compression != CompressionSyncMode.None)
            {
                if (compression != CompressionSyncMode.Low)
                {
                    if (compression != CompressionSyncMode.High)
                    {
                        result = 0f;
                    }
                    else
                    {
                        result = reader.ReadInt16();
                    }
                }
                else
                {
                    result = reader.ReadInt16();
                }
            }
            else
            {
                result = reader.ReadSingle();
            }
            return(result);
        }
示例#2
0
 internal void HandleFragment(QNetworkReader reader, int channelId)
 {
     if (channelId >= 0 && channelId < m_Channels.Length)
     {
         var channelBuffer = m_Channels[channelId];
         if (channelBuffer.HandleFragment(reader))
         {
             var networkReader = new QNetworkReader(channelBuffer._fragmentBuffer.AsArraySegment().Array);
             networkReader.ReadInt16();
             var msgType = networkReader.ReadInt16();
             InvokeHandler(msgType, networkReader, channelId);
         }
     }
 }
示例#3
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;
     }
 }
示例#4
0
 public override void Deserialize(QNetworkReader reader)
 {
     playerControllerId = reader.ReadInt16();
     msgData            = reader.ReadBytesAndSize();
     msgSize            = msgData?.Length ?? 0;
 }
 public override void Deserialize(QNetworkReader reader)
 {
     base.Deserialize(reader);
     ServerTime = reader.ReadSingle();
     LoopCount  = reader.ReadInt16();
 }