void CArmor::read(const Armor& armor) { this->armorType = armor.armortype(); this->baseHp = armor.basehp(); this->baseDef = armor.basedef(); this->baseAtk = armor.baseatk(); this->strenLv = armor.strenlv(); // this->baptize = armor.baptize(); this->addHp = armor.addhp(); this->addDef = armor.adddef(); this->addAtk = armor.addatk(); this->hero = armor.hero(); // for (int i = 0; i < armor.attr_size(); i++) // { // const ExtAttr& attr = armor.attr(i); // CExtAttr ext; // ext.read(attr); // this->attrList.push_back(ext); // } this->baseDex = armor.basedex(); this->baseHit = armor.basehit(); this->baseCrit = armor.basecrit(); this->baseRenew = armor.baserenew(); this->baseDodge = armor.basedodge(); this->addDex = armor.adddex(); this->addHit = armor.addhit(); this->addCrit = armor.addcrit(); this->addRenew = armor.addrenew(); this->addDodge = armor.adddodge(); this->atkRange = armor.atkrange(); this->hpRange = armor.hprange(); this->defRange = armor.defrange(); this->IntRange = armor.dexrange(); this->hitRange = armor.hitrange(); this->critRange = armor.critrange(); this->renewRange = armor.renewrange(); this->dodgeRange = armor.dodgerange(); this->nextAtk = armor.nextatk(); this->nextHp = armor.nexthp(); this->nextDef = armor.nextdef(); this->nextDex = armor.nextdex(); this->nextHit = armor.nexthit(); this->nextCrit = armor.nextcrit(); this->nextRenew = armor.nextrenew(); this->nextDodge = armor.nextdodge(); this->combat = armor.combat(); this->armor_skill = armor.armor_skill(); }
void CSmeltArmor::proceesMessage(int type, google::protobuf::Message *msg) { this->setVisible(true); switch (type) { //洗练数据 case SmeltDataRequestMsg: { Armor *res = (Armor*)msg; if(res) { m_armor.armor.atkRange = res->atkrange(); m_armor.armor.hpRange = res->hprange(); m_armor.armor.defRange = res->defrange(); m_armor.armor.IntRange = res->dexrange(); m_armor.armor.hitRange = res->hitrange(); m_armor.armor.critRange = res->critrange(); m_armor.armor.renewRange = res->renewrange(); m_armor.armor.dodgeRange = res->dodgerange(); showSmeltDataToUI(); } }break; //洗练 case SmeltArmorMsg: { SmeltResponse *res = (SmeltResponse*)msg; //1 成功,2 金币不足,3 元宝不足,4 数据错误 if (res->reslut()==1) { //1 攻击addAtk,2 防御addDef,3 血量addHp,4 敏捷addDex,5 命中addHit,6 暴击addCrit,7 回复addRenew,8 闪避addDodge) m_armor.armor.addAtk = res->armor().armor().addatk(); m_armor.armor.addDef = res->armor().armor().adddef(); m_armor.armor.addHp = res->armor().armor().addhp(); m_armor.armor.addDex = res->armor().armor().adddex(); m_armor.armor.addHit = res->armor().armor().addhit(); m_armor.armor.addCrit = res->armor().armor().addcrit(); m_armor.armor.addRenew = res->armor().armor().addrenew(); m_armor.armor.addDodge = res->armor().armor().adddodge(); //更新金钱 UserData *data = DataCenter::sharedData()->getUser()->getUserData(); data->setCoin(data->getCoin() - m_coin); data->setRoleGold(data->getRoleGold() - m_diamond); CSceneManager::sharedSceneManager()->PostMessageA(UPDATE_HERO,0,nullptr,nullptr); CSceneManager::sharedSceneManager()->PostMessageA(UPDATE_ITEM_DATA, 2, nullptr, &m_armor); //播放效果 float fTime = showStrengthEffect(); this->runAction(CCSequence::createWithTwoActions(CCDelayTime::create(fTime), CCCallFunc::create(this, callfunc_selector(CSmeltArmor::showArmorAttr)))); } else if (res->reslut()==2) { //ShowPopTextTip(GETLANGSTR(205)); CShowToBuyResource* pShow = CShowToBuyResource::create(); pShow->showToBuyResourceByType(ShowBuyResourceCoin); } else if (res->reslut()==3) { //ShowPopTextTip(GETLANGSTR(203)); CShowToBuyResource* pShow = CShowToBuyResource::create(); pShow->showToBuyResourceByType(ShowBuyResourceGold); } else if (res->reslut()==4) { ShowPopTextTip(GETLANGSTR(170)); } }break; default: break; } }