本文整理汇总了C++中CCNode::removeFromParentAndCleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::removeFromParentAndCleanup方法的具体用法?C++ CCNode::removeFromParentAndCleanup怎么用?C++ CCNode::removeFromParentAndCleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCNode
的用法示例。
在下文中一共展示了CCNode::removeFromParentAndCleanup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setState
void CCButton::setState(CCControlState mState)
{
////set background node
CCNode * bgNode = backgroundImageForState(mState);
if (bgNode != NULL) {
bgNode->setTag(CCButtonBgTag);
CCNode * mTepNode = this->getChildByTag(CCButtonBgTag);
if (mTepNode != NULL) {
mTepNode->removeFromParentAndCleanup(true);
}
this->addChild(bgNode, CCButtonZorder0);
}
//set touch node
CCNode * stateNode = imageForState(mState);
if (stateNode != NULL) {
stateNode->setTag(CCButtonTouchedTag);
CCNode * mTepNode = this->getChildByTag(CCButtonTouchedTag);
if (mTepNode != NULL) {
mTepNode->removeFromParentAndCleanup(true);
}
this->addChild(stateNode, CCButtonZorder1);
}
//set title node
const char* titleForState = this->titleForState(mState);
if (titleForState != NULL) {
this->setTitleForState(titleForState,mState);
}
}
示例2: ccTouchEnded
void GameScene::ccTouchEnded(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent){
CCDirector* pDirector = CCDirector::sharedDirector();
CCPoint touchPoint = pDirector->convertToGL(pTouch->getLocationInView());
CCNode* pCard = this->getChildByTag(nextNumber);
if (!pCard)
{
return;
}
CCRect cardRect = pCard->boundingBox();
if (cardRect.containsPoint(touchPoint)) {
CCSprite* pNewCard = CCSprite::create("card_backside.png");
pNewCard->setPosition(pCard->getPosition());
this->addChild(pNewCard);
pCard->removeFromParentAndCleanup(true);
if (nextNumber >= 25)
{
this->unschedule(schedule_selector(GameScene::measureGametime));
showHighScoreLabel();
return;
}
nextNumber++;
}
//CCLog("x: %f, y:%f", touchPoint.x, touchPoint.y);
}
示例3: update
void DamageValueEffect::update(float dt)
{
map<CCNode*,float>::iterator it= m_pDamageLabels->begin();
while(it != m_pDamageLabels->end())
{
float time = it->second;
time -= dt;
if(time <= 0)
{
CCNode* label = it->first;
if(label)
{
label->stopAllActions();
label->removeFromParentAndCleanup(true);
m_pDamageLabels->erase(it++);
label = NULL;
}
}
else
{
it->second = time;
it++;
}
}
}
示例4: reloadData
void ListViewLayer::reloadData(ListViewDataSource source)
{
// 容器不能为空
CCAssert(source.listViewContainer != NULL,"");
// 目前已经有的容器
CCNode* container = getChildByTag(TAG_LIST_CONTAINER);
if (source.listViewContainer != container)
{
// 把旧的移除
if (container)
container->removeFromParentAndCleanup(true);
// 添加新的
mSource = source;
addChild(mSource.listViewContainer,0,TAG_LIST_CONTAINER);
mTableView = CCTableView::create(this, mSource.listViewContainer->getContentSize());
mTableView->setDirection(mSource.dir);
mTableView->setPosition(ccp(0,0));
mTableView->setDelegate(this);
mSource.listViewContainer->addChild(mTableView);
}
mSource = source;
mTableView->reloadData();
}
示例5: restoreAllPriorities
CCObject *HTouchEnabledLayerColor::dismissNodeEx(int command, HEndDismissNode *notify) {
CCNode *node = notify->getNode();
do {
if (node->getParent() != this) break;
HBakNodeInfo *info = NULL;
for (int i = m_pBakNodeList->count() - 1; i >= 0; --i) {
info = (HBakNodeInfo *)m_pBakNodeList->objectAtIndex(i);
if (node == info->m_pNode) {
break;
}
info = NULL;
}
if (!info) break;
node->retain();
node->removeFromParentAndCleanup(false);
info->m_pParent->addChild(node, info->m_iIndex);
node->setScaleX(info->m_fScaleX);
node->setScaleY(info->m_fScaleY);
node->setPosition(info->m_ptPos);
node->release();
restoreAllPriorities(info);
m_pBakNodeList->removeObject(info);
} while (false);
if (notify->getTarget() && notify->getAction()) {
(notify->getTarget()->*notify->getAction())(node);
}
return NULL;
}
示例6: setNoCancel
void CommDlg::setNoCancel()
{
CCNode *cancelBtn = getChildByTag(kCommBtnTagCancel);
CCNode *cancelTxt = getChildByTag(kCommTextTagCancel);
CCNode *okBtn = getChildByTag(kCommBtnTagOk);
CCNode *okTxt = getChildByTag(kCommTextTagOk);
//没有Ok按钮,就不要删cancel按钮了,否则没按钮了
if (okBtn == NULL) {
return;
}
if(cancelBtn)
{
cancelBtn->setIsVisible(false);
cancelBtn->removeFromParentAndCleanup(true);
cancelBtn=NULL;
}
if(cancelTxt)
cancelTxt->setIsVisible(false);
if(okBtn)
okBtn->setPosition(CCPointMake(0, -78));
if(okTxt)
okTxt->setPosition(CCPointMake(-4, -74));
}
示例7: releaseMembers
void CCBProxy::releaseMembers(){
CCDictElement *e;
CCNode *n;
CCDICT_FOREACH(_memVars, e){
n = (CCNode *)e->getObject();
n->removeFromParentAndCleanup(true);
n->autorelease();
}
示例8: stop
void CartoonMoveAction::stop(void)
{
CCNode *tempTarget = m_pTarget;
CCMoveTo::stop();
cartoonInfo.release();
if (isTempTarget)
{
tempTarget->removeFromParentAndCleanup(true);
}
}
示例9: removeAll
// remove objects
void LCWordCloudLayer::removeAll()
{
for (int i=0; i<m_pNodeArray->count(); i++) {
CCNode* node = (CCNode*) m_pNodeArray->objectAtIndex(i);
if (node->getParent()) {
node->removeFromParentAndCleanup(true);
}
}
this->m_pNodeArray->removeAllObjects();
this->resetNodesPosition();
}
示例10: onMenuItemClicked
void HeroHeadView::onMenuItemClicked(cocos2d::CCObject *pTarget)
{
cocos2d::CCNode *p = static_cast<cocos2d::CCNode *>(pTarget);
printf("tag %d\n",p->getTag());
if(p->getTag() == 1){
CCNode *pNode = this->getChildByTag(TAG_PLAYER_INFO);
if (!pNode)
{
PlayerInfoView *pInfo = PlayerInfoView::create(this);
this->addChild(pInfo);
pInfo->setTag(TAG_PLAYER_INFO);
}
else {
pNode->removeFromParentAndCleanup(true);
}
}
}
示例11: onProgressEnded
void TitleNode::onProgressEnded(CCObject* sender) {
CCLog("TitleNode::onProgressEnded");
CCNode* node = dynamic_cast<CCNode*>(sender);
node->removeFromParentAndCleanup(true);
CCSize designResoulutionSize = CCEGLView::sharedOpenGLView()->getDesignResolutionSize();
CCLabelTTF* touchToStart = CCLabelTTF::create("Touch to Start!", "Arial", 15);
touchToStart->setAnchorPoint(ccp(0.5f, 1));
touchToStart->setPosition(ccp(designResoulutionSize.width/2, designResoulutionSize.height/2-100));
touchToStart->setColor(ccRED);
this->addChild(touchToStart);
FiniteStateMachine::getInstance()->setState(CommonEnum::eStateStages);
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}
示例12: playUpgradeEffect
void EquipmentUpgradeUILayer::playUpgradeEffect()
{
if(m_choosedEquipmentPic && m_choosedEquipmentPic->getCurrentNode())
{
CCNode* particle = ParticleManagerX::sharedManager()->getParticles_uieffect("particle_effect_upgradesuccess");
if(particle != NULL)
{
CCNode* child = m_choosedEquipmentPic->getCurrentNode()->getChildByTag(100);
if(child)
{
child->removeFromParentAndCleanup(true);
child = NULL;
}
m_choosedEquipmentPic->getCurrentNode()->addChild(particle,100,100);
particle->setPosition(ccp(m_choosedEquipmentPic->getCurrentNode()->getContentSize().width * 0.5,m_choosedEquipmentPic->getCurrentNode()->getContentSize().height * 0.5));
}
}
}
示例13: onLoadOrderSucssful
void QimiAlipayView::onLoadOrderSucssful(cocos2d::extension::CCHttpClient *sender, cocos2d::extension::CCHttpResponse *response)
{
CCNode* node = this->getChildByTag(100000);
if (node!=NULL)
{
node->removeFromParentAndCleanup(true);
}
Json::Value root = GameUtils::getResponseData(response);
if (root == NULL)
{
QimiPlatform::shareQimiPlatform()->openAlertDailog("系统提示", "服务器异常,请稍后再试");
return;
}
if (!root.isNull())
{
m_oderId= root["data"].asString();
}
loadAlixPay();
}
示例14: hideStageLogo
void GameScene::hideStageLogo()
{
CCNode* stageLogo = this->getChildByTag(kTagStageLogo);
stageLogo->removeFromParentAndCleanup(true);
}
示例15: removeNode
void TutorialNode::removeNode(void *obj) {
CCNode* node = (CCNode*)obj;
node->removeFromParentAndCleanup(true);
}