本文整理汇总了C++中UILayer::setTouchEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ UILayer::setTouchEnabled方法的具体用法?C++ UILayer::setTouchEnabled怎么用?C++ UILayer::setTouchEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UILayer
的用法示例。
在下文中一共展示了UILayer::setTouchEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onEnter
void Scene_GameItem::onEnter()
{
CCLayer::onEnter();
this->initData();
//隐藏pk界面
this->setPkView(false);
CCSprite* pSpriteBG = (CCSprite*)getChildByTag(eGameItemTagBg);
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
//pSpriteBG->setPosition(ccp(visibleSize.width/2 , pSpriteBG->getContentSize().height/2 + origin.y));
char str1[100]={0};
switch(GameShare_Global::shareGlobal()->gameType)
{
case 1:
sprintf(str1,"GameSceneBg1.json");
break;
case Game_Jelly:
sprintf(str1,"GameSceneBg2.json");
break;
case Game_Fruit:
sprintf(str1,"GameSceneBg3.json");
break;
case Game_Link:
sprintf(str1,"GameSceneBg4.json");
break;
case Game_TaiKo:
sprintf(str1,"GameSceneBg5.json");
break;
case Game_Cir:
sprintf(str1,"GameSceneBg1.json");
break;
default:
break;
}
UILayer* ul = UILayer::create();
auto myLayout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile(CStringUtil::convertToUIResPath(str1).c_str()));
ul->addWidget(myLayout);
this->addChild(ul, 0, 100);
ul->setTouchEnabled(false);
int nGameType = GameShare_Global::shareGlobal()->gameType;
if (nGameType==1)
{
UIImageView* pHill = dynamic_cast<UIImageView*>(ul->getWidgetByName("san"));
UIImageView* pHill2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("san2"));
//CCActionInterval* actionTo = CCScaleTo::create(2.0f, 0.5f);
CCActionInterval* actionBy = CCScaleBy::create(1.0f, 1.0f, 1.1f);
CCActionInterval* actionBy2 = CCScaleBy::create(1.0f, 1.1f, 1.0f);
CCFiniteTimeAction* seq = CCSequence::create(actionBy, actionBy->reverse(),NULL);
CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
pHill->runAction(repeatForever);
pHill2->runAction(repeatForever2);
}
else if (nGameType==2)
{
UIImageView* pCloud = dynamic_cast<UIImageView*>(ul->getWidgetByName("yun2"));
UIImageView* pCloud2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("yun3"));
CCActionInterval* actionBy = CCScaleBy::create(1.5f, 1.2f, 1.0f);
CCActionInterval* actionBy2 = CCScaleBy::create(1.5f, 1.2f, 1.0f);
CCFiniteTimeAction* seq1 = CCSequence::create(actionBy, actionBy->reverse(),NULL);
CCFiniteTimeAction* seq2 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
CCActionInterval * repeatForever1 =CCRepeatForever::create((CCActionInterval* )seq1);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq2);
pCloud->runAction(repeatForever1);
pCloud2->runAction(repeatForever2);
}
else if (nGameType==3)
{
UIImageView* pSugar = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_15"));
UIImageView* pSugar1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_20"));
CCRotateBy* actionBy2 = CCRotateBy::create(1.5f, -25.0f, -25.0f);
CCRotateBy* actionBy1 = CCRotateBy::create(1.5f, -25.0f, -25.0f);
CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(), NULL);
CCFiniteTimeAction* seq2 = CCSequence::create(actionBy1, actionBy1->reverse(), NULL);
CCActionInterval * repeatForever1 =CCRepeatForever::create((CCActionInterval* )seq1);
CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq2);
pSugar->runAction(repeatForever1);
pSugar1->runAction(repeatForever2);
//星星
UIImageView* pXx1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_23"));
UIImageView* pXx2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_32"));
UIImageView* pXx3 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_35"));
UIImageView* pXx4 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_39"));
CCActionInterval* actionBy3 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCActionInterval* actionBy4 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCActionInterval* actionBy5 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCActionInterval* actionBy6 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
CCFiniteTimeAction* seq3 = CCSequence::create(actionBy3, actionBy3->reverse(),NULL);
CCFiniteTimeAction* seq4 = CCSequence::create(actionBy4, actionBy4->reverse(),NULL);
CCFiniteTimeAction* seq5 = CCSequence::create(actionBy5, actionBy5->reverse(),NULL);
CCFiniteTimeAction* seq6 = CCSequence::create(actionBy6, actionBy6->reverse(),NULL);
//.........这里部分代码省略.........