public static function decode_goods_info(CodeEngine &$buf) { $gi = new GoodsInfo(); $len = $buf->DecodeInt16(); # 首先获得整个数组有多少个byte $gi->setGoodsID($buf->DecodeInt32()); $gi->setCount($buf->DecodeInt32()); $gi->setPrice($buf->DecodeInt32()); return $gi; }
public function Decode($buf = '') { $this->buffer = new CodeEngine($buf); $this->RealUIN = $this->buffer->DecodeInt32(); $this->RealAccount = $this->buffer->DecodeString(); $this->ActorUIN = $this->buffer->DecodeInt32(); $this->ActorAccount = $this->buffer->DecodeString(); $this->ServiceTag = $this->buffer->DecodeInt32(); $this->SourceTag = $this->buffer->DecodeInt32(); $this->IP = $this->buffer->DecodeInt32(); $this->ItemCount = $this->buffer->DecodeInt16(); for ($i = 0; $i < $this->ItemCount; $i++) { $this->ItemInfos[] = ItemInfo::decode_item_info($this->buffer); } $this->GoodsCount = $this->buffer->DecodeInt16(); for ($i = 0; $i < $this->GoodsCount; $i++) { $this->GoodsInfo[] = GoodsInfo::decode_goods_info($this->buffer); } $this->TransparentDataSize = $this->buffer->DecodeInt16(); if ($this->TransparentDataSize > 0) { $this->TransparentData = $this->buffer->DecodeMemory($this->TransparentDataSize); } $this->OperateDescription = $this->buffer->DecodeString(); $this->TransTag = $this->buffer->DecodeString(); $this->NofifyTransparentDataSize = $this->buffer->DecodeInt16(); if ($this->NofifyTransparentDataSize > 0) { $this->NofifyTransparentData = $this->buffer->DecodeMemory($this->NofifyTransparentDataSize); } return $this; }