protected override void OnSerializeStringHeader(PacketStringStream stream, CoopPacketHeader header) { int user_token_len = (!(version == "00")) ? 1 : 11; string empty = string.Empty; empty += ConvertUserToken(header.from, user_token_len); empty += ConvertUserToken(header.to, user_token_len); empty += ((!header.promise) ? "0" : "1"); empty += header.sequenceNo.ToString().PadLeft(16); string str = empty.Length.ToString("X4"); stream.Write(str); stream.Write(empty); }
protected override void OnSerializeStringModel(PacketStringStream stream, Coop_Model_Base model) { Type modelType = ((PACKET_TYPE)model.c).GetModelType(); string str = JSONSerializer.Serialize(model, modelType); stream.Write(str); }
protected override void OnSerializeStringPrefix(PacketStringStream stream) { version = "10"; stream.Write(version); }