bool CDNormalScene::init(){
bool bRet = false;
do
{
CC_BREAK_IF(! Layer::init());
this->setTouchEnabled(true);
this->setAccelerometerEnabled(true);
this->scheduleUpdate();
m_ui = dynamic_castcocos2d::ui::Layout*(cocostudio::GUIReader::getInstance()->widgetFromJsonFile(“ui/CandyUi/Export/normal/normal.ExportJson”));
this->addChild(m_ui);
boardElm = CDBoardElm::create();
boardElm->setTouchEnabled(true);
boardElm->setPosition(0, 200);
addChild(boardElm);
auto listener = EventListenerTouchAllAtOnce::create();
listener->onTouchesBegan = CC_CALLBACK_2(CDNormalScene::onTouchesBegan, this);
listener->onTouchesMoved = CC_CALLBACK_2(CDNormalScene::onTouchesMoved, this);
listener->onTouchesEnded = CC_CALLBACK_2(CDNormalScene::onTouchesEnded, this);
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
bRet = true;
}while(0);
return bRet;
}
m_ui = dynamic_castcocos2d::ui::Layout*(cocostudio::GUIReader::getInstance()->widgetFromJsonFile(“ui/CandyUi/Export/normal/normal.ExportJson”));
是个全屏的UI,this->addChild(m_ui);之后CDNormalScene::onTouchesxxxx就不会被调用了,何解?
我用的是cocos studio1.5.0 和3.2的代码
求解?