private void OnSendPacketMessageRecv(NetBuffer msg) { var recvMsg = new SendPacketMessageRecv(); recvMsg.Read(msg); var UniqueIdentifier = recvMsg.UniqueIdentifier; var MessageRacketId = recvMsg.MessagePacketId; if (PacketMessageDictionary.ContainsKey(UniqueIdentifier)) { NetOutgoingMessage packetMsg = null; lock (PacketMessageDictionaryLocker) { if (PacketMessageDictionary.ContainsKey(UniqueIdentifier)) { packetMsg = PacketMessageDictionary[UniqueIdentifier]; PacketMessageDictionary.Remove(UniqueIdentifier); } } if (packetMsg != null) { int n = (packetMsg.LengthBytes + MaxPacketSize - 1) / MaxPacketSize; for (int i = 0; i < n; ++i) { int l = packetMsg.LengthBytes - i * MaxPacketSize; int length = l < MaxPacketSize ? l : MaxPacketSize; if (length > 0) { NetOutgoingMessage om = client.CreateMessage(); var pm = new PacketMessage() { Number = i, MessagePacketId = MessageRacketId, Bytes = new byte[length], }; Array.Copy(packetMsg.Data, i * MaxPacketSize, pm.Bytes, 0, length); om.Write(pm.Id); pm.Write(om); client.SendMessage(om, NetDeliveryMethod.Unreliable); } } } } }