本文整理汇总了C++中CCNode::getUserData方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::getUserData方法的具体用法?C++ CCNode::getUserData怎么用?C++ CCNode::getUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCNode
的用法示例。
在下文中一共展示了CCNode::getUserData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CCRichLabelTTF::~CCRichLabelTTF()
{
CC_SAFE_DELETE(m_pFontName);
// release callfunc
CCMenu* menu = (CCMenu*)getChildByTag(TAG_MENU);
if(menu) {
CCObject* obj;
const auto& children = menu->getChildren();
for (const auto& child : children)
{
CCNode* item = (CCNode*)child;
CCObject* data = (CCObject*)item->getUserData();
CC_SAFE_RELEASE(data);
}
// CCARRAY_FOREACH(menu->getChildren(), obj) {
// CCNode* item = (CCNode*)obj;
// CCObject* data = (CCObject*)item->getUserData();
// CC_SAFE_RELEASE(data);
// }
}
// release other
m_stateListener->release();
}
示例2: btnJoinCallback
void GameRankLayer::btnJoinCallback(CCObject* pSender)
{
SoundPlayer::play(SNDI_CLICK);
CCNode* sender = dynamic_cast<CCNode*>(pSender);
if(sender)
{
PokerPlayerRankInfo* ptrInfo = static_cast<PokerPlayerRankInfo*>(sender->getUserData());
if(ptrInfo)
{
TableLayer* tableLayer = (TableLayer*)getParent();
tableLayer->sendGotoTableCmd(ptrInfo->account_id);
}
}
}
示例3: failCallBackFun
//失败回调
void GameStage::failCallBackFun(CCObject* data)
{
this->updateCombo();
this->updateScore();
this->updateHighScore();
this->layoutScoreNum(this->highScoreList, 2);
//this->newHighScore->stopAllActions();
CCNode* nNode = (CCNode*) data;
CCString* str = (CCString*)nNode->getUserData();
CCString* newRecordStr = new CCString(NEW_RECORD);
//判断2个字符串相等
if(str->isEqual(newRecordStr))
{
Cookie::getShareUserData()->setIntegerForKey("highScore", this->pukaManCore->highScore);
Cookie::getShareUserData()->flush();
this->newHighScore->stopAllActions();
this->newHighScore->setScale(0.0f);
CCActionInterval* scaleTo1 = CCScaleTo::create(0.5f, 1.0f);
CCDelayTime* delayTime = CCDelayTime::create(1.0f);
CCActionInterval* scaleTo2 = CCScaleTo::create(0.5f, 0.0f);
CCSequence* sequence = CCSequence::create(scaleTo1, delayTime, scaleTo2, NULL);
this->newHighScore->runAction(sequence);
}
}