本文整理汇总了C++中CCMenu::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenu::getParent方法的具体用法?C++ CCMenu::getParent怎么用?C++ CCMenu::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenu
的用法示例。
在下文中一共展示了CCMenu::getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onPressCityBtn
void CityListLayer::onPressCityBtn(CCObject* sender)
{
if (playerMoving)
{
return;
}
CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(sender);
if(menuItem)
{
CCNode* node = menuItem->getParent();
CCMenu* menu = dynamic_cast<CCMenu*>(node);
if(menu)
{
CCNode* parent = menu->getParent();
IconButton* button = dynamic_cast<IconButton*>(parent);
if(button)
{
playerMoving = true;
int index = button->GetButtonIndex();
targetCityId = cityInfoList[index - 1].cityId;
moveToCity(targetCityId, 0);
}
}
}
}
示例2: onClickedOneSever
void FrontCoverLayer::onClickedOneSever(CCObject* pSender)
{
CCMenuItem* menuItem = dynamic_cast<CCMenuItem*>(pSender);
if(menuItem)
{
CCNode* node = menuItem->getParent();
CCMenu* menu = dynamic_cast<CCMenu*>(node);
if(menu)
{
CCNode* parent = menu->getParent();
IconButton* button = dynamic_cast<IconButton*>(parent);
if(button)
{
int buttonIndex = button->GetButtonIndex();
// to do
SeverInfo* info = m_severList[buttonIndex];
if(info)
{
USERINFO data = UserData::GetUserInfo();
sprintf(data.ip,"%s",info->severIp);
sprintf(data.lastServerName,"%s",info->name);
data.port = info->port;
UserData::SetUserInfo(data);
//onCLickedSeverCloseBt(pSender);
XLogicManager::sharedManager()->logIn();
}
}
}
}
}
示例3: menuItemClicked_JieFenHeroSelect
void TanSuoLayer::menuItemClicked_JieFenHeroSelect(CCObject *pSender)
{
CCMenuItem *item = (CCMenuItem*)pSender;
int tag = item->getTag();
for (vector<CCMenuItem*>::iterator iter = m_lMenuItemList.begin() ; iter != m_lMenuItemList.end() ; iter ++)
{
if ((*iter)->getTag() == tag)
{
(*iter)->setEnabled(false);
}
else
{
(*iter)->setEnabled(true);
}
}
if (m_nSelectProId == -1)
{
CCMenu *menu = (CCMenu*)(item->getParent());
CCMenuItemImage* menuItemOk = CCMenuItemImage::create(
"shangpin_goumai_queren.png",
"shangpin_goumai_queren_select.png",
this,SEL_MenuHandler(&TanSuoLayer::selectJieFengHero));
CCNode *node = menu->getParent()->getParent()->getParent()->getParent();
CCNode *diaoLogMenu = node->getChildByTag(0);
menuItemOk->setPosition(ccp(node->getContentSize().width/2,0));
diaoLogMenu->addChild(menuItemOk);
}
m_nSelectProId = tag;
/*
CCDirector::sharedDirector()->getRunningScene()->removeChildByTag(TAG_AwardDisplayer_Layer);
Profession profId = (Profession)tag;
addObserver(callfuncO_selector(TanSuoLayer::rsp_jiefen), MSG_unlockDiscoverSealRsp_F);
mCmdHlp->cmdUnlockDiscoverSeal(profId);*/
}