本文整理汇总了C++中MainScene::removeChildByName方法的典型用法代码示例。如果您正苦于以下问题:C++ MainScene::removeChildByName方法的具体用法?C++ MainScene::removeChildByName怎么用?C++ MainScene::removeChildByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainScene
的用法示例。
在下文中一共展示了MainScene::removeChildByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
void ForwardLayer::onEnter(){
Layer::onEnter();
Size size = Director::getInstance()->getVisibleSize();
Vec2 origen = Director::getInstance()->getVisibleOrigin();
showsorce = cursorce;
label = Label::createWithBMFont("futura-48.fnt",StringUtils::format("%dkb/s",showsorce));
label->setColor(cocos2d::Color3B::YELLOW);
label->setPosition(size.width-100,size.height-20);
this->addChild(label);
///////////////////////////
MainScene *scene = dynamic_cast<MainScene *>(Director::getInstance()->getRunningScene());
auto layer = dynamic_cast<TouchLayer *>(scene->getChildByName("touchlayer"));
////////////////////暂停VS开始///////////////////////
auto item1 = MenuItemImage::create();
item1->setName("itme1");
item1->setNormalImage(Sprite::create("qianlei.png"));
auto item2 = MenuItemImage::create();
item2->setName("itme2");
item2->setNormalImage(Sprite::create("light_skill.png"));
MenuItemToggle*tog = MenuItemToggle::createWithCallback([=](Ref *sender){
auto m = dynamic_cast<MenuItemToggle*>(sender);
auto n = m->getSelectedItem();
auto im = dynamic_cast<MenuItemImage*>(n);
if (im->getName()=="itme2")
{
layer->setTouchStop(true);
Director::getInstance()->pause();
///暂停音效//////////////////////////////////////////////////////////////////////////////////
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
auto menulayer = MemuLayer::create();
menulayer->setName("layer");
scene->addChild(menulayer,100);
}
if (im->getName()=="itme1")
{
//开始
Director::getInstance()->resume();
//回复触摸
layer->setTouchStop(false);
//开始音效///////////////////////////////////////////////////////////////////////////////////
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
//移除菜单
scene->removeChildByName("layer");
/*layer->setTouchStop(true);
Director::getInstance()->pause();
///暂停音效//////////////////////////////////////////////////////////////////////////////////
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
MainScene *sne = dynamic_cast<MainScene *>(Director::getInstance()->getRunningScene());
auto menulayer = MemuLayer::create();
menulayer->setName("layer");
sne->addChild(menulayer);*/
}
},item1,item2,NULL);
Menu *mu = Menu::create(tog,NULL);
mu->setPosition(size.width-110,origen.y+30);
this->addChild(mu);
}