コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->item_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->item_id->value());
     }
     if ($this->item_type !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->item_type->value());
     }
     if ($this->expire_ms !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->expire_ms);
     }
     if ($this->applied_ms !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->applied_ms);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function serializedSize(\Protobuf\ComputeSizeContext $context)
 {
     $calculator = $context->getSizeCalculator();
     $size = 0;
     if ($this->item_id !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->item_id->value());
     }
     if ($this->item_type !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->item_type->value());
     }
     if ($this->category !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->category->value());
     }
     if ($this->drop_freq !== null) {
         $size += 1;
         $size += 4;
     }
     if ($this->drop_trainer_level !== null) {
         $size += 1;
         $size += $calculator->computeVarintSize($this->drop_trainer_level);
     }
     if ($this->pokeball !== null) {
         $innerSize = $this->pokeball->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->potion !== null) {
         $innerSize = $this->potion->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->revive !== null) {
         $innerSize = $this->revive->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->battle !== null) {
         $innerSize = $this->battle->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->food !== null) {
         $innerSize = $this->food->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->inventory_upgrade !== null) {
         $innerSize = $this->inventory_upgrade->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->xp_boost !== null) {
         $innerSize = $this->xp_boost->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->incense !== null) {
         $innerSize = $this->incense->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->egg_incubator !== null) {
         $innerSize = $this->egg_incubator->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->fort_modifier !== null) {
         $innerSize = $this->fort_modifier->serializedSize($context);
         $size += 1;
         $size += $innerSize;
         $size += $calculator->computeVarintSize($innerSize);
     }
     if ($this->extensions !== null) {
         $size += $this->extensions->serializedSize($context);
     }
     return $size;
 }