コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function writeTo(\Protobuf\WriteContext $context)
 {
     $stream = $context->getStream();
     $writer = $context->getWriter();
     $sizeContext = $context->getComputeSizeContext();
     if ($this->active_pokemon !== null) {
         $writer->writeVarint($stream, 10);
         $writer->writeVarint($stream, $this->active_pokemon->serializedSize($sizeContext));
         $this->active_pokemon->writeTo($context);
     }
     if ($this->trainer_public_profile !== null) {
         $writer->writeVarint($stream, 18);
         $writer->writeVarint($stream, $this->trainer_public_profile->serializedSize($sizeContext));
         $this->trainer_public_profile->writeTo($context);
     }
     if ($this->reverse_pokemon !== null) {
         foreach ($this->reverse_pokemon as $val) {
             $writer->writeVarint($stream, 26);
             $writer->writeVarint($stream, $val->serializedSize($sizeContext));
             $val->writeTo($context);
         }
     }
     if ($this->defeated_pokemon !== null) {
         foreach ($this->defeated_pokemon as $val) {
             $writer->writeVarint($stream, 34);
             $writer->writeVarint($stream, $val->serializedSize($sizeContext));
             $val->writeTo($context);
         }
     }
     if ($this->extensions !== null) {
         $this->extensions->writeTo($context);
     }
     return $stream;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function writeTo(\Protobuf\WriteContext $context)
 {
     $stream = $context->getStream();
     $writer = $context->getWriter();
     $sizeContext = $context->getComputeSizeContext();
     if ($this->result !== null) {
         $writer->writeVarint($stream, 8);
         $writer->writeVarint($stream, $this->result->value());
     }
     if ($this->battle_log !== null) {
         $writer->writeVarint($stream, 18);
         $writer->writeVarint($stream, $this->battle_log->serializedSize($sizeContext));
         $this->battle_log->writeTo($context);
     }
     if ($this->battle_id !== null) {
         $writer->writeVarint($stream, 26);
         $writer->writeString($stream, $this->battle_id);
     }
     if ($this->active_defender !== null) {
         $writer->writeVarint($stream, 34);
         $writer->writeVarint($stream, $this->active_defender->serializedSize($sizeContext));
         $this->active_defender->writeTo($context);
     }
     if ($this->active_attacker !== null) {
         $writer->writeVarint($stream, 42);
         $writer->writeVarint($stream, $this->active_attacker->serializedSize($sizeContext));
         $this->active_attacker->writeTo($context);
     }
     if ($this->extensions !== null) {
         $this->extensions->writeTo($context);
     }
     return $stream;
 }