private int CheckArraySize(int count) { if (count > maxArraySize) { #if UNITY_EDITOR Logger.LogException("Net::Packet::CheckArraySize: Toooooooooo large array size!! Clamp to {2}. Packet: [ID: {0}, name:{1}], ArraySize: {2}", ID, PacketObject.GetDefinedPacketName(ID), count, maxArraySize); UnityEditor.EditorApplication.isPaused = true; #endif return(maxArraySize); } return(count); }
private bool CheckWrite() { if (!writable) { Logger.LogException("Net::Packet::CheckWrite: Packet not writable!! Packet: [ID: {0}, name: {1}]", ID, PacketObject.GetDefinedPacketName(ID)); #if UNITY_EDITOR UnityEditor.EditorApplication.isPaused = true; #endif return(false); } return(true); }
private int CheckRead(int count) { if (!readable) { Logger.LogException("Net::Packet::CheckRead: Packet not readable!! Packet: [ID: {0}, name: {1}], state: {2}", ID, PacketObject.GetDefinedPacketName(ID), destroyed ? "destroyed" : "normal"); return(0); } if (m_readPos + count > size) { Logger.LogException("Net::Packet::CheckRead: Packet length too short!! Packet: [ID: {0}, name: {1}, curSize: {2}, readPos: {3}, readCount: {4}]", ID, PacketObject.GetDefinedPacketName(ID), size, readPos, count); return(size - m_readPos); } return(count); }