本文整理汇总了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());
}
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例14: update
void MoveLeft::update(float delta){
CCNode* parent = (CCNode*)getOwner();
if (parent == NULL) return;
if ( ((HelloWorld*)parent->getParent())->GameOver )
{
parent->stopAllActions();
}
}
示例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();
}
}
}