本文整理汇总了C++中CLabel::getString方法的典型用法代码示例。如果您正苦于以下问题:C++ CLabel::getString方法的具体用法?C++ CLabel::getString怎么用?C++ CLabel::getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLabel
的用法示例。
在下文中一共展示了CLabel::getString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkMoney
void CSmeltArmor::checkMoney()
{
CCSprite *coin = (CCSprite *)(m_ui->findWidgetById("coin"));
CCSprite *diamond = (CCSprite *)(m_ui->findWidgetById("diamond"));
CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
if(coin->isVisible())
{
//检查货币数量
if(!CheckCoin(atoi(money->getString())))
{
money->setColor(RGB_RED);
}
else
{
money->setColor(RGB_WHITE);
}
}
if(diamond->isVisible())
{
//检查货币数量
if(!CheckGold(atoi(money->getString())))
{
money->setColor(RGB_RED);
}
else
{
money->setColor(RGB_WHITE);
}
}
}
示例2: updateInfoToUIAndReturnCount
int CSmeltArmor::updateInfoToUIAndReturnCount( CLayout* pLayout[], int iNameId[], int iValue[], const char* sRange[], int iMax, const char* sTitle )
{
int iMaxLineCount = 0;
for(unsigned int i=0; i<iMax; i++)
{
//有值
if(iValue[i] > 0)
{
pLayout[iMaxLineCount]->setVisible(true);
//设置名称
CLabel* pInfoType = (CLabel*)pLayout[iMaxLineCount]->findWidgetById("info_type");
pInfoType->setString(GETLANGSTR(iNameId[i]));
//设置值大小
CLabel* pValue = (CLabel*)pLayout[iMaxLineCount]->findWidgetById("value");
if(atoi(pValue->getString())!=iValue[i])
{
pValue->setString(ToString(iValue[i]));
pValue->runAction(CCRollLabelAction::create(0.3f, 0, iValue[i], pValue));
}
//目标值大小
CLabel* pAimValue = (CLabel*)pLayout[iMaxLineCount]->findWidgetById("aim_value");
pAimValue->setString(sRange[i]);
//存ID
CCheckBox* pCheck = (CCheckBox*)pLayout[iMaxLineCount]->findWidgetById("check");
pCheck->setTag(i+1);
iMaxLineCount++;
}
//找到四个了,退出循环
if(iMaxLineCount>=4)
{
break;
}
}
//隐藏掉没有数据填充的cell
hideNoneValueCell(iMaxLineCount, pLayout);
//如果一个都没有,隐藏标题
if(sTitle != nullptr)
{
CCNode* pNode = (CCNode*)m_ui->findWidgetById(sTitle);
if(pNode)
{
pNode->setVisible(iMaxLineCount != 0);
}
}
return iMaxLineCount;
}
示例3: onRefineItem
void CSmeltArmor::onRefineItem(CCObject* pSender)
{
//检查货币是否足够
CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
int iCost = atoi(money->getString());
if(m_iStrengthType==0)
{
if(!CheckCoin(iCost))
{
//ShowPopTextTip(GETLANGSTR(205));
CShowToBuyResource* pShow = CShowToBuyResource::create();
pShow->showToBuyResourceByType(ShowBuyResourceCoin);
return;
}
}
else
{
if(!CheckGold(iCost))
{
//ShowPopTextTip(GETLANGSTR(203));
CShowToBuyResource* pShow = CShowToBuyResource::create();
pShow->showToBuyResourceByType(ShowBuyResourceGold);
return;
}
}
vector<int> checkVec;
if(m_iStrengthType != 0)
{
for (unsigned int i=0; i<4; ++i)
{
CCheckBox* pCheckBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
if (pCheckBtn->isChecked())
{
checkVec.push_back(pCheckBtn->getTag());
}
}
}
if (m_armor.id>0)
{
CPlayerControl::getInstance().sendSmeltArmor(m_armor.id, checkVec);
}
}
示例4: showTipsOnNextTotalSign
void CSignLayer::showTipsOnNextTotalSign()
{
m_pYellowTip->setVisible(false);
//遍历阶段签到
for (int i = 0; i < m_signData.totalList.size()&&i<4; i++)
{
CSign &sign = m_signData.totalList.at(i);
//未领取
if(sign.status==2)
{
if(sign.day>m_signData.sign)
{
//当前底加高亮
CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString());
//pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderStone));
pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_02.png"));
//pBg->setScale(0.85f);
//拿到当前宝箱
CImageView *mask = (CImageView*)m_ui->findWidgetById(CCString::createWithFormat("mask%d",i+1)->getCString());
//隐藏自己的日期
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setVisible(false);
//加黄标提示
m_pYellowTip->setVisible(true);
m_pYellowTip->setPosition(ccp(mask->getPositionX()+mask->getContentSize().width/2, mask->getPositionY()+mask->getContentSize().height-60));
m_pYellowTipText->setString(day->getString());
break;
}
}
else
{
//当前底加高亮
CCSprite* pBg = (CCSprite*)m_ui->findWidgetById(CCString::createWithFormat("bg%d",i+1)->getCString());
//pBg->setShaderProgram(ShaderDataMgr->getShaderByType(ShaderDefault));
pBg->setTexture(CCTextureCache::sharedTextureCache()->addImage("sign/arrival_01.png"));
//pBg->setScale(1.0f);
//天数
CLabel *day = (CLabel*)(m_ui->findWidgetById(CCString::createWithFormat("day%d",i+1)->getCString()));
day->setVisible(true);
}
}
}
示例5: onCheckAttr
void CSmeltArmor::onCheckAttr(CCObject *pSender, bool bChecked)
{
int checknum =0;
int iShowCount = 0;
for (unsigned int i=0; i<4; ++i)
{
CCheckBox* pCheckBtn = (CCheckBox*)(m_pBaseInfo[i]->findWidgetById("check"));
if (pCheckBtn->isChecked())
{
checknum++;
}
if(m_pBaseInfo[i]->isVisible())
{
iShowCount++;
}
setYellowBgState(pCheckBtn, pCheckBtn->isChecked());
}
//如果选中了四个,则屏蔽掉一个,提示不能全选
if(checknum>=iShowCount && pSender!=nullptr)
{
CCheckBox* pCheck = (CCheckBox*)pSender;
pCheck->setEnabled(false);
pCheck->setChecked(false);
pCheck->setEnabled(true);
setYellowBgState(pCheck, false);
ShowPopTextTip(GETLANGSTR(1182));
return;
}
if (checknum==0)
{
CCSprite *coin = (CCSprite *)(m_ui->findWidgetById("coin"));
coin->setVisible(true);
m_coin = 0;
switch (m_armor.quality)
{
case 1:
m_coin =10000;
break;
case 2:
m_coin =20000;
break;
case 3:
m_coin =40000;
break;
case 4:
m_coin =80000;
break;
case 5:
m_coin =160000;
break;
default:
break;
}
m_diamond = 0;
CCSprite *diamond = (CCSprite *)(m_ui->findWidgetById("diamond"));
diamond->setVisible(false);
CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
money->setString(ToString(m_coin));
//检查货币数量
if(!CheckCoin(atoi(money->getString())))
{
money->setColor(RGB_RED);
}
else
{
money->setColor(RGB_WHITE);
}
showFireWithType(0);
}
else
{
CCSprite *coin = (CCSprite *)(m_ui->findWidgetById("coin"));
coin->setVisible(false);
CCSprite *diamond = (CCSprite *)(m_ui->findWidgetById("diamond"));
diamond->setVisible(true);
CLabel *money = (CLabel *)(m_ui->findWidgetById("money"));
money->setString(ToString(100*checknum));
//检查货币数量
if(!CheckGold(atoi(money->getString())))
{
money->setColor(RGB_RED);
}
else
{
money->setColor(RGB_WHITE);
}
m_coin = 0;
m_diamond = 100*checknum;
showFireWithType(1);
//.........这里部分代码省略.........
示例6: updateRoleProperty
void CTopLayer::updateRoleProperty(const TMessage& tMsg)
{
UserData *user = DataCenter::sharedData()->getUser()->getUserData();
CCScaleTo* sc1 = CCScaleTo::create(0.15f,1.3f);
CCScaleTo* sc2 = CCScaleTo::create(0.35f,1.0f);
CCSequence* sqes = CCSequence::create(sc1,sc2,nullptr);
if (user->getCoin()!=atoi(m_coinLabel->getString()))
{
CProgressLabel *prolab = CProgressLabel::create();
prolab->setLabel(m_coinLabel);
prolab->changeValueTo(user->getCoin(),0.5f);
CCSequence* sqes1 = (CCSequence*)sqes->copy();
m_coinLabel->runAction(sqes1);
this->addChild(prolab);
CLabel *label = (CLabel*)m_ui->getChildByTag(130);
int coin = user->getCoin()-atoi(m_coinLabel->getString());
changeLabel(label, coin);
}
if (user->getRoleGold()!=atoi(m_moneyLabel->getString()))
{
CProgressLabel *prolab = CProgressLabel::create();
prolab->setLabel(m_moneyLabel);
prolab->changeValueTo(user->getRoleGold(),0.5f);
CCSequence* sqes1 = (CCSequence*)sqes->copy();
m_moneyLabel->runAction(sqes1);
this->addChild(prolab);
CLabel *label = (CLabel*)m_ui->getChildByTag(140);
int coin = user->getRoleGold()-atoi(m_moneyLabel->getString());
changeLabel(label, coin);
}
/*
if (user->getRoleFood()!=atoi(m_foodLabel->getString()))
{
CProgressLabel *prolab = CProgressLabel::create();
prolab->setLabel(m_foodLabel);
prolab->changeValueTo(user->getRoleFood(),0.5f);
CCSequence* sqes1 = (CCSequence*)sqes->copy();
m_foodLabel->runAction(sqes1);
this->addChild(prolab);
CLabel *label = (CLabel*)m_ui->getChildByTag(170);
int coin = user->getRoleFood()-atoi(m_foodLabel->getString());
changeLabel(label, coin);
}
*/
if (user->getFriends()!=atoi(m_foodLabel->getString()))
{
CProgressLabel *prolab = CProgressLabel::create();
prolab->setLabel(m_foodLabel);
prolab->changeValueTo(user->getFriends(),0.5f);
CCSequence* sqes1 = (CCSequence*)sqes->copy();
m_foodLabel->runAction(sqes1);
this->addChild(prolab);
CLabel *label = (CLabel*)m_ui->getChildByTag(170);
int coin = user->getFriends()-atoi(m_foodLabel->getString());
changeLabel(label, coin);
}
CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
if (user->getRoleAction()!=atoi(action->getString()))
{
CCSequence* sqes2 = (CCSequence*)sqes->copy();
action->runAction(sqes2);
action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(), user->getActionLimit())->getCString());
}
}