void Send(Dictionary <string, object> newpacket, CWritePacket packet) { System.Text.StringBuilder stringbuilder = Jsontext.WriteData(newpacket); stringbuilder.Append("\0"); string json_s = stringbuilder.ToString(); if (DataDefine.isEFS == 1) { //加密处理 json_s = packet.Compress(json_s, DataDefine.datakey); } packet.WriteString(json_s); // Debug.Log( json_s ); SendPacket(packet, C2SMessageType.Active); }
protected void PacketDictAndSend(UInt32 msgID, Dictionary <string, object> newpacket, C2SMessageType c2sType = C2SMessageType.PASVWait) { CWritePacket packet = new CWritePacket(msgID); System.Text.StringBuilder stringbuilder = Jsontext.WriteData(newpacket); stringbuilder.Append("\0"); string json_s = stringbuilder.ToString(); if (DataDefine.isEFS == 1) { //加密处理 json_s = packet.Compress(json_s, DataDefine.datakey); } packet.WriteString(json_s); if (DataDefine.isLogMsgDetail) { Debug.Log("Send msgDetail: " + json_s); } SendPacket(packet, c2sType); }