/**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->wild_pokemon !== null) {
         $innerSize = $this->wild_pokemon->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->background !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->background->value());
     }
     if ($this->status !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->status->value());
     }
     if ($this->capture_probability !== null) {
         $innerSize = $this->capture_probability->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
예제 #2
0
 /**
  * @param ProtoWildPokemon $proto
  */
 public function __construct(ProtoWildPokemon $proto)
 {
     $this->pokemonId = $proto->getPokemonData()->getPokemonId()->value();
     $this->encounterId = $proto->getEncounterId();
     $this->spawnPointId = $proto->getSpawnPointId();
     $this->timeTillHiddenMs = $proto->getTimeTillHiddenMs();
     $this->location = new Location($proto->getLatitude(), $proto->getLongitude());
 }
 /**
  * CatchablePokemon constructor.
  * @param PokemonGoAPI $pokemonGoAPI
  * @param MapPokemon|null $MapPokemon
  * @param WildPokemon|null $wildPokemon
  */
 function __construct(PokemonGoAPI $pokemonGoAPI, MapPokemon $MapPokemon = null, WildPokemon $wildPokemon = null)
 {
     $this->pokemonGoAPI = $pokemonGoAPI;
     if ($MapPokemon == null) {
         if ($wildPokemon != null) {
             $this->spawnPointId = $wildPokemon->getSpawnPointId();
             $this->encounterId = $wildPokemon->getEncounterId();
             $this->pokemonId = $wildPokemon->getPokemonData()->getPokemonId();
             $this->expirationTimestampMs = $wildPokemon->getTimeTillHiddenMs();
             $this->latitude = $wildPokemon->getLatitude();
             $this->longitude = $wildPokemon->getLongitude();
         }
     } else {
         if ($wildPokemon == null) {
             $this->spawnPointId = $MapPokemon->getSpawnPointId();
             $this->encounterId = $MapPokemon->getEncounterId();
             $this->pokemonId = $MapPokemon->getPokemonId();
             $this->expirationTimestampMs = $MapPokemon->getExpirationTimestampMs();
             $this->latitude = $MapPokemon->getLatitude();
             $this->longitude = $MapPokemon->getLongitude();
         }
     }
 }