本文整理汇总了C++中Equipment::setWeapon方法的典型用法代码示例。如果您正苦于以下问题:C++ Equipment::setWeapon方法的具体用法?C++ Equipment::setWeapon怎么用?C++ Equipment::setWeapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Equipment
的用法示例。
在下文中一共展示了Equipment::setWeapon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clickLogInto
void LogIntoLayer::clickLogInto(CCObject* pSender)
{
map<string,string> post;
post["api"] = "login";
post["username"]=usernameText->getString();
post["password"]=passwordText->getString();
std::string jsonStr = POST(post);
JsonBox::Value data;
CCLOG(jsonStr.c_str());
data.loadFromString(jsonStr);
if(data["result"].getString()=="OK"){
CCLOG("Login Successfully!");
USER->setUserID(atoi(data["0"]["user_id"].getString().c_str()));
USER->setUsername(data["0"]["username"].getString());
USER->setPassword(data["0"]["password"].getString());
USER->setLevel(atoi(data["0"]["level"].getString().c_str()));
USER->setExp(atoi(data["0"]["exp"].getString().c_str()));
USER->setBasicAGI(atoi(data["0"]["basic_agi"].getString().c_str()));
USER->setBasicSTR(atoi(data["0"]["basic_str"].getString().c_str()));
USER->setBasicDEF(atoi(data["0"]["basic_def"].getString().c_str()));
Equipment* equipment = new Equipment();
equipment->setWeapon(Weapon(atoi(data["0"]["current_weapon"].getString().c_str())));
equipment->setBase(Base(atoi(data["0"]["current_base"].getString().c_str())));
equipment->setPlate(Plate(atoi(data["0"]["current_plate"].getString().c_str())));//
USER->setOpenChaptersNumber(atoi(data["0"]["open_chapters_number"].getString().c_str()));
USER->setWinOnlineGamesNumber(atoi(data["0"]["win_online_game_number"].getString().c_str()));
USER->setPlayOnlineGamesNumber(atoi(data["0"]["play_online_game_number"].getString().c_str()));
USER->setMoney(atoi(data["0"]["money"].getString().c_str()));
CCLOG(data["0"]["money"].getString().c_str());
USER->setHonor(atoi(data["0"]["honor"].getString().c_str()));
USER->setHasSignin(true);
USER->setIsBeginner(false);
USER->flush();
CCNode* parent = this->getParent();
this->removeFromParentAndCleanup();
INFORMATION_BOX("Login successfully!",parent);
}
else{
PopWindowsLayer::createInfomationBox("Login failed!",this);
}
}