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


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

本文整理汇总了C++中CCNode::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::getParent方法的具体用法?C++ CCNode::getParent怎么用?C++ CCNode::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCNode的用法示例。


在下文中一共展示了CCNode::getParent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initFire

void CSmeltArmor::initFire()
{
	//获取参考位置
	CCNode* pNode = (CCNode*)m_ui->findWidgetById("fire_circle");
	CCPoint pPos = ccp(pNode->getPositionX()+15, pNode->getPositionY()+75);

	if(m_pFire1 == nullptr)
	{
		CCAnimation* pAnimation = AnimationManager::sharedAction()->getAnimation("9010");
		pAnimation->setDelayPerUnit(0.15f);
		m_pFire1 = CCSprite::create("skill/9010.png");
		m_pFire1->setPosition(pPos);
		m_pFire1->runAction(CCRepeatForever::create(CCAnimate::create(pAnimation)));
		m_pFire1->setVisible(false);
		m_pFire1->setScale(1.6f);
		pNode->getParent()->addChild(m_pFire1, pNode->getZOrder());
	}
	if(m_pFire2 == nullptr)
	{
		CCAnimation* pAnimation = AnimationManager::sharedAction()->getAnimation("9011");
		pAnimation->setDelayPerUnit(0.15f);
		m_pFire2 = CCSprite::create("skill/9011.png");
		m_pFire2->setPosition(pPos);
		m_pFire2->runAction(CCRepeatForever::create(CCAnimate::create(pAnimation)));
		m_pFire2->setVisible(false);
		m_pFire2->setScale(1.5f);
		pNode->getParent()->addChild(m_pFire2, pNode->getZOrder());
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:29,代码来源:SmeltArmor.cpp

示例2: onSendGiftClicked

void HallPage::onSendGiftClicked()
{
    if(m_sendGiftDialog != 0){
        m_sendGiftDialog->destroy();
        m_sendGiftDialog = 0;
    }
    CCNode *root = this->getParent();
    while(root->getParent())
        root = root->getParent();
    if(m_sendGiftDialog == 0){
        m_sendGiftDialog = new SendGiftDialog(root,ccc4(0,0,0,128));
        m_sendGiftDialog->setCloseCB(this,callfuncND_selector(HallPage::onSendGiftCloseClicked));
        m_sendGiftDialog->setSendCB(this,callfuncND_selector(HallPage::onSendGiftSendClicked));
        std::string name = m_headNick;
        if(name.empty())
            mailToNickName(m_headMail,name);

        std::vector<UiMsgEv::GiftPropEv> props;
        m_serverIFace->getAllUnzeroProps(m_userId,props);
        std::sort(props.begin(),props.end(),prop_sortbyId);
        for(unsigned int i = 0;i < props.size();i++){
            m_sendGiftDialog->addProp(props[i].m_id,props[i].m_count);
        }
        m_sendGiftDialog->exec();
    }
}
开发者ID:firedragonpzy,项目名称:DirectFire-android,代码行数:26,代码来源:hallpage.cpp

示例3: ccTouchEnded

void IPadSprite::ccTouchEnded(CCTouch* touch, CCEvent* event)
{
	CCNode* pNode = this->getParent();
	CCNode* pNode1 = this;
	while(pNode->getParent() != NULL)
	{
		pNode1 = pNode;
		pNode = pNode->getParent();
	}
	MainScene* pScene = dynamic_cast<MainScene*>(pNode1);
	if(pScene)
	{
		pScene->hideMenu();
	}
	
	MS5Layer* pLayer = dynamic_cast<MS5Layer*>(this->getParent());
	if(pLayer)
		pLayer->hidePopupPanel();
		
	this->setIsVisible(false);
	pNode = this->getParent();
	pNode = pNode->getParent();
	
	if(pNode->getChildByTag(TAG_IPAD_BIG) == NULL)
	{
		ScaleSprite* pSprite = ScaleSprite::scaleSpriteWithFile("ipad_big.png");
		pSprite->setTag(TAG_IPAD_BIG);
		pSprite->setScale(0.24f);
		pSprite->setPosition( ccp(855, 420) );
		pNode->addChild(pSprite, 2);
		pSprite->startScale();
	}
} 
开发者ID:chenyufeng,项目名称:QATDemo-chinese,代码行数:33,代码来源:IPadSprite.cpp

示例4: isParentAllVisible

bool LsTouch::isParentAllVisible(LsTouchEvent* lsTe)
{
    bool bRef = true;
    CCNode* nLsTe = dynamic_cast<CCNode*>(lsTe);
    CCNode* parent = getParent();
    do
    {
        if (!parent)
        {
            bRef = false;
            break;
        }
        if (nLsTe == parent)
        {
            break;
        }
        if (!parent->isVisible())
        {
            bRef = false;
            break;
        }
        parent = parent->getParent();
    } while (1);

    return bRef;
}
开发者ID:duongbadu,项目名称:cocos2dx_klotski,代码行数:26,代码来源:GameSelectLayer.cpp

示例5: ccTouchBegan

bool NewMenuDevice::ccTouchBegan(cocos2d::CCTouch *touch, cocos2d::CCEvent *event) {
    //    CCPoint pouchT = map->transScreenToMap(ccp(pTouch->locationInView().x,pTouch->locationInView().y));
    //    CCPoint posiT = map->transMapToTiled(this->getPosition());
    //        
    //    CCPoint tiled = map->transMapToTiled(pouchT);
    //    if(Mathlib::inBound(tiled.x, posiT.x+contentSizeByTiled.width/2, posiT.x-contentSizeByTiled.width/2) &&
    //           Mathlib::inBound(tiled.y, posiT.y+contentSizeByTiled.height/2, posiT.y-contentSizeByTiled.height/2)) {
    //        isMoved = true;
    //    }
    //    return CCMenu::ccTouchBegan(pTouch, pEvent);
    
    CC_UNUSED_PARAM(event);
    if (m_eState != kCCMenuStateWaiting || ! m_bVisible || !isEnabled())
    {
        return false;
    }
    
    for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
    {
        if (c->isVisible() == false)
        {
            return false;
        }
    }
    
    m_pSelectedItem = this->itemForTouch(touch);
    if (m_pSelectedItem)
    {
        m_eState = kCCMenuStateTrackingTouch;
        m_pSelectedItem->selected();
        return true;
    }
    return false;
    
}
开发者ID:itita,项目名称:2-z-q-x-,代码行数:35,代码来源:NewMenuDevice.cpp

示例6: ccTouchBegan

bool GameMenu::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
	/// 把传进来的这个参数强转下,免得编译器报参数未使用的警告。
	CC_UNUSED_PARAM(pEvent);  
	if (m_eState != kCCMenuStateWaiting || ! m_bIsVisible)  
	{  
		return false;  
	}  

	for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())  
	{  
		if (c->getIsVisible() == false)  
		{  
			return false;  
		}  
	}  

	m_pSelectedItem = this->itemForTouch(pTouch);  
	if (m_pSelectedItem)  
	{  
		m_eState = kCCMenuStateTrackingTouch;  
		m_pSelectedItem->selected();  
		///这里加入自己想要的效果。。。。。。。。。。。。。。。。  
		return true;  
	}  
	return false;  
}
开发者ID:DionysosLai,项目名称:Coco2d-xRes,代码行数:27,代码来源:GameMenu.cpp

示例7: 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

示例8: getViewRect

CCRect LotteryRotateView::getViewRect()
{
    CCSize size = getPanelChild()->getContentSize();
    CCPoint screenPos = this->convertToWorldSpace(CCPointZero);
    
    float scaleX = this->getScaleX();
    float scaleY = this->getScaleY();
    
    for (CCNode *p = _parent; p != NULL; p = p->getParent()) {
        scaleX *= p->getScaleX();
        scaleY *= p->getScaleY();
    }
    
    if(scaleX<0.f) {
        screenPos.x += size.width*scaleX;
        scaleX = -scaleX;
    }
    
    if(scaleY<0.f) {
        screenPos.y += size.height*scaleY;
        scaleY = -scaleY;
    }

    return CCRectMake(getPanelChild()->getPositionX() - size.width/2, getPanelChild()->getPositionY() - size.height/2, size.width, size.height);
}
开发者ID:ourgames,项目名称:dc208,代码行数:25,代码来源:LotteryRotateView.cpp

示例9: ccTouchBegan

bool MDragDownView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    if (isVisible() == false)
    {
        return false;
    }
    
    for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
    {
        if (c->isVisible() == false)
        {
            return false;
        }
    }

    updateRect();
    m_touchBeginPosition = pTouch->getLocation();
    
    if (m_viewRect.containsPoint(m_touchBeginPosition) == false)
    {
        return false;
    }
    
    
    if (m_eState != State::NONE)
    {
        return true;
    }
    
    m_isTouchDragBar = m_pDragBar ? m_dragBarRect.containsPoint(m_touchBeginPosition) : false;
    m_viewOldSize = m_viewSize;
    
    return true;
}
开发者ID:xu561865,项目名称:demo_2,代码行数:34,代码来源:MDragDownView.cpp

示例10: ccTouchBegan

	bool CCMenu::ccTouchBegan(CCTouch* touch, CCEvent* event)
	{
        CC_UNUSED_PARAM(event);
		if (m_eState != kCCMenuStateWaiting || ! m_bIsVisible)
		{
			return false;
		}

		for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
		{
			if (c->getIsVisible() == false)
			{
				return false;
			}
		}

		m_pSelectedItem = this->itemForTouch(touch);
		if (m_pSelectedItem)
		{
			m_eState = kCCMenuStateTrackingTouch;
			m_pSelectedItem->selected();
			return true;
		}
		return false;
	}
开发者ID:Bahamut,项目名称:cocos2d-x,代码行数:25,代码来源:CCMenu.cpp

示例11: isParentAllVisible

bool LsTouch::isParentAllVisible(LsTouchEvent* lsTe) {
	bool bRef = true;
	// 向父类转型,以便获取地址比较对象,LsTouchEvent 的对象必须同时直接或者简介继承 CCNode
	CCNode* nLsTe = dynamic_cast<CCNode*>(lsTe);

	CCNode* parent = getParent();
	do {
		// 如果遍历完毕,说明 LsTouch 不再 LsTouchEvent 之内
		if (!parent) {
			bRef = false;
			break;
		}
		// 如果 LsTouch 在 LsTouchEvent 之内,返回 true
		// 注意:如果想让LsTouchEvent 处理 不在其 CCNode 结构之内的元素,则取消此处判断
		if (nLsTe == parent) {
			break;
		}
		if (!parent->isVisible()) {
			bRef = false;
			break;
		}
		parent = parent->getParent();
	} while (1);
	return bRef;
}
开发者ID:a1l9e8x6,项目名称:Hello,代码行数:25,代码来源:LsTouch.cpp

示例12: onAddFriendClicked

void HallPage::onAddFriendClicked()
{
    if(m_sendGiftDialog != 0){
        m_sendGiftDialog->destroy();
        m_sendGiftDialog = 0;
    }
    CCNode *root = this->getParent();
    while(root->getParent())
        root = root->getParent();
    if(m_addFriendDialog == 0){
        m_addFriendDialog = new AddFriendDialog(root,ccc4(0,0,0,128));
        m_addFriendDialog->setCloseCB(this,callfuncND_selector(HallPage::onAddFriendCloseClicked));
        m_addFriendDialog->setAddCB(this,callfuncND_selector(HallPage::onAddFriendAddClicked));
        m_addFriendDialog->setAddId(m_headId);
        m_addFriendDialog->exec();
    }
}
开发者ID:firedragonpzy,项目名称:DirectFire-android,代码行数:17,代码来源:hallpage.cpp

示例13: nodeToWorldTransform

CCAffineTransform CCNode::nodeToWorldTransform()
{
	CCAffineTransform t = this->nodeToParentTransform();

	for (CCNode *p = m_pParent; p != NULL; p = p->getParent())
		t = CCAffineTransformConcat(t, p->nodeToParentTransform());

	return t;
}
开发者ID:BigHand,项目名称:cocos2d-x,代码行数:9,代码来源:CCNode_mobile.cpp

示例14: update

void MoveLeft::update(float delta){
    CCNode* parent = (CCNode*)getOwner();
    if (parent == NULL) return;
    
    if ( ((HelloWorld*)parent->getParent())->GameOver )
    {
        parent->stopAllActions();
    }
}
开发者ID:FreeDao,项目名称:FaceBook-Working--FlappyBird,代码行数:9,代码来源:MoveLeft.cpp

示例15: onSendMsgSendClicked

void HallPage::onSendMsgSendClicked(CCNode *node,void *data)
{
    SoundMgr::getInstance()->playEffect(SoundEnum::BTN_EFFECT_NORMAL);
    if(m_sendMsgDialog){
        std::string title,word;
        m_sendMsgDialog->getSendMsg(title,word);
        m_sendMsgDialog->destroy();
        m_sendMsgDialog = 0;
        if(word.size() != 0){
            ServerInterface::getInstance()->sendMail(m_headId,title,word);
            CCNode *root = this->getParent();
            while(root->getParent())
                root = root->getParent();
            CCSize winSize = CCDirector::sharedDirector()->getWinSize();
            SendMsgAnim *anim = new SendMsgAnim(root,ccp(winSize.width / 2,winSize.height / 2));
            anim->exec();
        }
    }
}
开发者ID:firedragonpzy,项目名称:DirectFire-android,代码行数:19,代码来源:hallpage.cpp


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