Exemplo n.º 1
0
 public function Encode(CodeEngine &$buf)
 {
     $buf->EncodeInt8($this->DataType);
     switch ($this->DataType) {
         case PlayCommandDataType::PCD_Charming:
             $buf->EncodeInt32($this->DataValue->Charming);
             break;
         case PlayCommandDataType::PCD_Achievement:
             $buf->EncodeInt32($this->DataValue->Achievement);
             break;
         case PlayCommandDataType::PCD_PunishMethod:
             $buf->EncodeString($this->DataValue->Punish->ValidDate)->EncodeInt8($this->DataValue->Punish->BlackLevel)->EncodeInt16($this->DataValue->Punish->PunishMethod)->EncodeString($this->DataValue->Punish->DescString);
             break;
         case PlayCommandDataType::PCD_OtherData:
             $buf->EncodeInt8($this->DataValue->OtherData->OtherDataIndex)->EncodeInt8($this->DataValue->OtherData->UpdateMode)->EncodeInt8($this->DataValue->OtherData->OtherDataValue);
             break;
         case PlayCommandDataType::PCD_LoginCount:
             $buf->EncodeInt32($this->DataValue->LoginCount);
             break;
         case PlayCommandDataType::PCD_LastLoginTime:
             $buf->EncodeInt32($this->DataValue->LastLoginTime);
             break;
         case PlayCommandDataType::PCD_LastLoginIP:
             $buf->EncodeInt32($this->DataValue->LastLoginIP);
             break;
         case PlayCommandDataType::PCD_WebQunData:
             $buf->EncodeInt32($this->DataValue->WebQunData->DataSize)->EncodeMemory($this->DataValue->WebQunData->WebQunInfo, $this->DataValue->WebQunData->DataSize);
             break;
         case PlayCommandDataType::PCD_VipData:
             $this->DataValue->VipData->Encode($buf);
             break;
         case PlayCommandDataType::PCD_IdCard:
             $buf->EncodeString($this->DataValue->IDCard);
             break;
         case PlayCommandDataType::PCD_Sex:
             $buf->EncodeInt8($this->DataValue->Sex);
             break;
         case PlayCommandDataType::PCD_Birthday:
             $buf->EncodeInt16($this->DataValue->BirThday->Year)->EncodeInt16($this->DataValue->BirThday->Month)->EncodeInt16($this->DataValue->BirThday->Day);
             break;
         default:
             break;
     }
     return $buf;
 }