public static UserUdpRequest Decode(byte[] src, int offset, int length) { var msg = GenMessage.ParseFrom(ByteString.CopyFrom(src, offset, length)); return(new UserUdpRequest(msg.MsgType, msg.PId) { msg = msg }); }
void OnMessageReceived(byte[] bytes) { #if TEST if (!GameStarted) { GameStarted = true; startTime = Time.realtimeSinceStartup; } if (packSize < bytes.Length) { packSize = bytes.Length; } bytesReceived += bytes.Length; #endif GenMessage msg = GenMessage.ParseFrom(bytes); actionDict[msg.MsgType](msg.Frame, msg.PIdx, msg.Buf); }