本文整理汇总了C++中TextNode::setString方法的典型用法代码示例。如果您正苦于以下问题:C++ TextNode::setString方法的具体用法?C++ TextNode::setString怎么用?C++ TextNode::setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextNode
的用法示例。
在下文中一共展示了TextNode::setString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fengYinUpdate
void Card::fengYinUpdate(int cd)
{
m_FengYinCD -= cd;
if (m_FengYinCD <= 0)
{
m_FengYinCD = 0;
setCardState(EN_CARD_STATE_NORMAL);
}
else
{
char buf[10];
sprintf(buf, "%d",m_FengYinCD);
TextNode* tempText = (TextNode*)getChildByTag(FENGYINPNGTAG+1);
tempText->setString(buf);
}
}
示例2: setCardState
//setstate
void Card::setCardState(int state, int param1)
{
switch (state)
{
case EN_CARD_STATE_FNEGYIN:
{
if (param1 > 0)
{
Player* pPlayer = (Player*)getParent();
int iOccurOdds = getCanUseNumByAwakeId(enAwakeSkill_16) * 50;
if (SaveData::Inst()->getrand()%100+1 <= iOccurOdds || pPlayer->haveAwakeSkill_33()){ //新增
char fileName[100];
CCSprite* spAnim = CCSprite::spriteWithSpriteFrameName("blank.png");
addChild(spAnim,100,FENGYINDEFENSETAG);
spAnim->setPosition(getCardPos());
CCAnimation *animation1 = CCAnimation::animation();
for(int i=1;i<=9;i++)
{
sprintf(fileName, "dikang00%02d.png",i);
animation1->addFrameWithFileName(fileName);
}
animation1->setDelay(1.0/20.0);
CCAnimate* animate1 = CCAnimate::actionWithAnimation(animation1);
spAnim->runAction(animate1);
return;
}
}
m_FengYinCD += param1;
if (m_state == state)
{
char buf[10];
sprintf(buf, "%d",m_FengYinCD);
TextNode* tempText = (TextNode*)getChildByTag(FENGYINPNGTAG+1);
tempText->setString(buf);
}
else
{
if (param1 > 0)
{
if (m_idx == 0 || m_idx == 5)
{
Player* pPlayer = (Player*)getParent();
pPlayer->fengYinAutoSkill(m_idx);
}
}
CCSprite* cardLock = CCSprite::spriteWithSpriteFrameName("cardlock.png");
addChild(cardLock,100,FENGYINPNGTAG);
cardLock->setPosition(getCardPos());
cardLock->runAction(CCRepeatForever::actionWithAction((CCActionInterval *)CCSequence::actions(CCFadeIn::actionWithDuration(1.0),CCFadeOut::actionWithDuration(1.0),NULL)));
char buf[10];
sprintf(buf, "%d",m_FengYinCD);
TextNode* textCD = TextNode::textWithString(buf,55);
addChild(textCD,101,FENGYINPNGTAG+1);
textCD->setPosition(getCardPos());
textCD->setShadowColor(ccBLACK);
textCD->setColor(ccWHITE);
m_spCard->setColor(ccc3(60, 60, 60));
}
}
break;
case EN_CARD_STATE_NORMAL:
if (m_state == EN_CARD_STATE_FNEGYIN)
{
m_FengYinCD = 0;
removeChildByTag(FENGYINPNGTAG, true);
removeChildByTag(FENGYINPNGTAG+1, true);
removeChildByTag(FENGYINDEFENSETAG, true);
if (m_idx == 0 || m_idx == 5)
{
Player* pPlayer = (Player*)getParent();
pPlayer->unFengYinAutoSkill(m_idx);
}
}
m_spCard->setColor(ccWHITE);
break;
default:
break;
}
if (state!=m_state)
{
m_state = state;
if (Player *pPlayer = dynamic_cast<Player*>(getParent()))
{
pPlayer->updateNumByAwakeId();
}
if (EN_CARD_STATE_NORMAL==state)
{
//.........这里部分代码省略.........