本文整理汇总了C++中CCLabelAtlas::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelAtlas::getString方法的具体用法?C++ CCLabelAtlas::getString怎么用?C++ CCLabelAtlas::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelAtlas
的用法示例。
在下文中一共展示了CCLabelAtlas::getString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menuCallbackBuy
void LayerGoods::menuCallbackBuy(CCObject* pSender)
{
if (pSender)
{
Topwo::getInstance()->getTopwoAudio()->playEffect(1);
}
if (!pSender)
{
return;
}
TopwoTools *tl = Topwo::getInstance()->getTopwoTools();
UserInfo *user_info = Topwo::getInstance()->getTopwoData()->getUserInfo();
CCMenuItemSprite* item = static_cast<CCMenuItemSprite*>(pSender);
int tag = item->getTag();
CCSprite* sprite = static_cast<CCSprite*>(this->getChildByTag(tag));
CCLabelAtlas* la = static_cast<CCLabelAtlas*>(sprite->getChildByTag(2));
int need_gold = atoi(la->getString());
int cur_gold = user_info->getCurrentGold();
if (need_gold > cur_gold)
{//金币不足
this->addChild(LayerHint::createWith(CCLabelTTF::create(CCString::createWithFormat("%s%s", tl->getXmlString("Gold")->getCString(), tl->getXmlString("HintNotEnough")->getCString())->getCString(), "", 30), 2, this, callfuncN_selector(LayerGoods::hintCallbackWork)), 10);
return;
}
user_info->setCurrentGold(cur_gold - need_gold);
if (tag == 1)
{
user_info->setCurrentGoodsLevelTiPo(user_info->getCurrentGoodsLevelTiPo() + 1);
user_info->setCurrentTiPoBonus(getGoodsBonus(user_info->getCurrentGoodsLevelTiPo()) * 0.01f);
}
else if (tag == 2)
{
user_info->setCurrentGoodsLevelMeiLi(user_info->getCurrentGoodsLevelMeiLi() + 1);
user_info->setCurrentMeiLiBonus(getGoodsBonus(user_info->getCurrentGoodsLevelMeiLi()) * 0.01f);
}
else if (tag == 3)
{
user_info->setCurrentGoodsLevelZhiLi(user_info->getCurrentGoodsLevelZhiLi() + 1);
user_info->setCurrentZhiLiBonus(getGoodsBonus(user_info->getCurrentGoodsLevelZhiLi()) * 0.01f);
}
else if (tag == 4)
{
user_info->setCurrentGoodsLevelEQ(user_info->getCurrentGoodsLevelEQ() + 1);
user_info->setCurrentEQBonus(getGoodsBonus(user_info->getCurrentGoodsLevelEQ()) * 0.01f);
}
else if (tag == 5)
{
user_info->setCurrentGoodsLevelGanXing(user_info->getCurrentGoodsLevelGanXing() + 1);
user_info->setCurrentGanXingBonus(getGoodsBonus(user_info->getCurrentGoodsLevelGanXing()) * 0.01f);
}
updateMe();
}