bool Game::init() { if (!Layer::init()){ return false; } step = 0; starEndFrame[0] = 18; starEndFrame[1] = 33; starEndFrame[2] = 60; swallowNode = Node::create(); swallowNode->setContentSize(Director::getInstance()->getVisibleSize()); this->addChild(swallowNode, 0); gameNode = CSLoader::createNode("bg6_Secene.csb"); this->addChild(gameNode); //UI gameUIMgr = new GameUIMgr(gameNode->getChildByTag(354), this); //GAME gameArea = GameArea::create(gameUIMgr, guanQiaName[step]); gameNode->addChild(gameArea, Game::ZORDER_AREA, Game::TAG_AREA); //STAR Node* starNode = gameNode->getChildByTag(962); starNode->setZOrder(2); starAtl = dynamic_cast<ActionTimeline*>(starNode->getActionByTag(starNode->getTag())); starAtl->gotoFrameAndPause(0); initTouch(); return true; }
bool AlertBox::init(Settings* settings) { if ( !Layer::init() ) { return false; } _settings = settings; _dead = false; _size = Size(1040,648); _moved = false; _yPosition = 0; //create fon fon = Sprite::create(PATH_INTERFACE "AlertBox.png"); this->addChild(fon); closeButton = Sprite::create(PATH_INTERFACE "CloseAlertBox.png"); closeButton->setPosition( Point(520, 324) ); this->addChild(closeButton); _scroll = Layer::create(); _scroll->setPosition( Point(0, _size.height/2) ); createMask(); _layerMask->addChild(_scroll); this->addChild(_layerMask); initTouch(); return true; }
bool GameScene::init() { if (!Layer::init()) { return false; } initGame(); initValues(); initControls(); return initTouch(); }
bool Achievement::init() { if(!Layer::init()){ return false; } winSize = Director::getInstance()->getVisibleSize(); swallowNode = Node::create(); swallowNode->setContentSize(winSize); this->addChild(swallowNode,0); achievementNode = CSLoader::createNode("bg9Scene.csb"); this->addChild(achievementNode,1); initTouch(); return true; }
bool First::init() { if ( !Layer::init() ) { return false; } winSize = Director::getInstance()->getVisibleSize(); SqlMath::getInstance(); //userInfoStruct a; //SqlMath::getInstance()->getUserInfo(nullptr,0,a); //vector<itemInfoStruct*> b; //vector<DBcolumn>* dbcolumn = new vector<DBcolumn>; //DBcolumn a = {"itemId","1"}; //dbcolumn->push_back(a); //SqlMath::getInstance()->getItemInfo(dbcolumn,b); firstNode = CSLoader::createNode("MainScene.csb"); this->addChild(firstNode); actNode = firstNode->getChildByTag(108); //获取动画对象,这个动画相当于这个节点在时间轴里的所有动画内容。且这个节点需要是导入的csd文件类型节点 actAtl = dynamic_cast<ActionTimeline*>(actNode->getActionByTag(actNode->getTag())); actAtl->gotoFrameAndPlay(0, false);//设定不要循环 playGameBtn = dynamic_cast<Button*>(actNode->getChildByTag(370)->getChildByTag(58)); lockBtn = dynamic_cast<Button*>(actNode->getChildByTag(370)->getChildByTag(60)); highScoreBtn = dynamic_cast<Button*>(actNode->getChildByTag(370)->getChildByTag(59)); settingBtn = dynamic_cast<Button*>(actNode->getChildByTag(370)->getChildByTag(61)); playGameBtn->addTouchEventListener(CC_CALLBACK_2(First::touchEvent, this)); lockBtn->addTouchEventListener(CC_CALLBACK_2(First::touchEvent, this)); highScoreBtn->addTouchEventListener(CC_CALLBACK_2(First::touchEvent, this)); settingBtn->addTouchEventListener(CC_CALLBACK_2(First::touchEvent, this)); NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(First::backToFirst), "backToFirst", NULL); initTouch(); return true; }
bool QWindowsContext::initTouch() { return initTouch(QWindowsIntegration::instance()->options()); }