当前位置: 首页>>代码示例>>C++>>正文


C++ CCNode::removeFromParentAndCleanup方法代码示例

本文整理汇总了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);
    }
}
开发者ID:1901,项目名称:cocos2d-x-extensions,代码行数:30,代码来源:CCButton.cpp

示例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);
}
开发者ID:Yarimizu14,项目名称:nyan25,代码行数:30,代码来源:GameScene.cpp

示例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++;
		}
	}

}
开发者ID:JamShan,项目名称:xcode_jifengyongzhezhuan,代码行数:26,代码来源:DamageValueEffect.cpp

示例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();
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:28,代码来源:ListViewLayer.cpp

示例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;
}
开发者ID:hyizsg,项目名称:mytest1st,代码行数:30,代码来源:RootLayer.cpp

示例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));
    
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:27,代码来源:CommDlg.cpp

示例7: releaseMembers

void CCBProxy::releaseMembers(){
	CCDictElement *e;
	CCNode *n;
	CCDICT_FOREACH(_memVars, e){
		n = (CCNode *)e->getObject();
		n->removeFromParentAndCleanup(true);
		n->autorelease();
	}
开发者ID:Zhangzhiyi,项目名称:cocos2dx-LuaProxy,代码行数:8,代码来源:CCBProxy.cpp

示例8: stop

void CartoonMoveAction::stop(void)
{
	CCNode *tempTarget = m_pTarget; 
	CCMoveTo::stop();
	cartoonInfo.release();
	if (isTempTarget)
	{
		tempTarget->removeFromParentAndCleanup(true);
	}
}
开发者ID:coderHsc,项目名称:sygame,代码行数:10,代码来源:Cartoon.cpp

示例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();
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例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);
        }
    }
}
开发者ID:CommonSenseLies,项目名称:LuckyCat,代码行数:18,代码来源:HeroHeadView.cpp

示例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);
}
开发者ID:GoodMorningCody,项目名称:ThreeMatchPuzzleX,代码行数:18,代码来源:TitleNode.cpp

示例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));
		}
	}
}
开发者ID:niuzb,项目名称:hellopetclient,代码行数:18,代码来源:EquipmentUpgradeUILayer.cpp

示例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();
}
开发者ID:BenVim,项目名称:IsmoleSDK,代码行数:22,代码来源:QimiAlipayView.cpp

示例14: hideStageLogo

void GameScene::hideStageLogo()
{
	CCNode* stageLogo = this->getChildByTag(kTagStageLogo);
	stageLogo->removeFromParentAndCleanup(true);
}
开发者ID:yoroyorokun,项目名称:SpaceShoot,代码行数:5,代码来源:GameScene.cpp

示例15: removeNode

void TutorialNode::removeNode(void *obj) {
  CCNode* node = (CCNode*)obj;
  node->removeFromParentAndCleanup(true);
}
开发者ID:nkostelnik,项目名称:WonderPants,代码行数:4,代码来源:TutorialNode.cpp


注:本文中的CCNode::removeFromParentAndCleanup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。