public static AutoTurret Deserialize(Stream stream, AutoTurret instance, bool isDelta) { if (!isDelta && instance.users == null) { instance.users = Pool.Get <List <PlayerNameID> >(); } while (true) { int num = stream.ReadByte(); if (num == -1) { break; } if (num <= 18) { if (num == 10) { Vector3Serialized.DeserializeLengthDelimited(stream, ref instance.aimPos, isDelta); continue; } else if (num == 18) { Vector3Serialized.DeserializeLengthDelimited(stream, ref instance.aimDir, isDelta); continue; } } else if (num == 24) { instance.targetID = ProtocolParser.ReadUInt32(stream); continue; } else if (num == 34) { instance.users.Add(PlayerNameID.DeserializeLengthDelimited(stream)); continue; } Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } return(instance); }
public static BuildingPrivilege Deserialize(Stream stream, BuildingPrivilege instance, bool isDelta) { if (!isDelta && instance.users == null) { instance.users = Pool.Get <List <PlayerNameID> >(); } while (true) { int num = stream.ReadByte(); if (num == -1) { break; } if (num <= 21) { if (num == 10) { instance.users.Add(PlayerNameID.DeserializeLengthDelimited(stream)); continue; } else if (num == 21) { instance.upkeepPeriodMinutes = ProtocolParser.ReadSingle(stream); continue; } } else if (num == 29) { instance.costFraction = ProtocolParser.ReadSingle(stream); continue; } else if (num == 37) { instance.protectedMinutes = ProtocolParser.ReadSingle(stream); continue; } Key key = ProtocolParser.ReadKey((byte)num, stream); if (key.Field == 0) { throw new ProtocolBufferException("Invalid field id: 0, something went wrong in the stream"); } ProtocolParser.SkipKey(stream, key); } return(instance); }