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; } }
private void LogSend(byte[] bytes) { var networkReader = new QNetworkReader(bytes); var num = networkReader.ReadUInt16(); var num2 = networkReader.ReadUInt16(); var stringBuilder = new StringBuilder(); for (var i = 4; i < 4 + num; i++) { stringBuilder.AppendFormat("{0:X2}", bytes[i]); if (i > 150) { break; } } QLog.Log( $"ConnectionSend con:{connectionId} bytes:{num} msgId:{num2} {stringBuilder}"); }
public override void Deserialize(QNetworkReader reader) { var num = (int)reader.ReadUInt16(); scripts = new QCRCMessageEntry[num]; for (var i = 0; i < scripts.Length; i++) { var crcmessageEntry = default(QCRCMessageEntry); crcmessageEntry.name = reader.ReadString(); crcmessageEntry.channel = reader.ReadByte(); scripts[i] = crcmessageEntry; } }
public override void Deserialize(QNetworkReader reader) => PlayerControllerId = (short)reader.ReadUInt16();
public override void Deserialize(QNetworkReader reader) => errorCode = reader.ReadUInt16();