//コールバック void PageViewLayer::pageviewCallBack(Ref* sender, PageViewEventType type) { if (type == PAGEVIEW_EVENT_TURNING) { auto pageView = dynamic_cast<PageView*>(sender); //選択されているページをログに出力 log("%ld", pageView->getCurPageIndex() + 1); if (pageView->getCurPageIndex() == 3) { auto scene = MenuView::create(); TransitionScene* transition = TransitionFade::create(1, scene); Director::getInstance()->replaceScene(transition); } } }
void MainLayer::pageViewEvent(Ref* sender, PageView::EventType type) { if (type != PageView::EventType::TURNING) return; auto pageView = dynamic_cast<PageView*>(sender); if (_focus && _focus->getParent() != pageView->getPage(pageView->getCurPageIndex())) { _isFocusNotOnTab = false; removeFocusAction(); _tabNode->setUserObject(nullptr); } auto node = LsTools::seekNodeByName(_rootNode, "Node_btn"); for (auto& child : node->getChildren()) { auto btn = dynamic_cast<Button*>(child); btn->setBright(true); btn->setScale(1.0f); } auto btn = getCurTabBtn(); btn->setBright(false); if (!_isFocusNotOnTab){ btn->setScale(TAB_BTN_SCALE); _navi_Scelect->stopAllActions(); _navi_Scelect->setPositionX(btn->getPositionX()); } //_navi_Scelect->setPositionX(btn->getPositionX()); //changeTab(pageView->getCurPageIndex()); createSpecRecomend(); }
void TiledMapLayer::loadSource() { auto pSceneManager = SceneManager::getInstance(); auto pageLevelStr = StringUtils::format(GAMESCENEMAP, pSceneManager->getCurPageIndex() + 1, pSceneManager->getCurLevelIndex() + 1) + "BGPath.tmx"; _pTiledMap = TMXTiledMap::create(pageLevelStr); addChild(_pTiledMap); MapUtil::getInstance()->setCurrentLevelTiledMap(_pTiledMap); auto pBg = Sprite::createWithSpriteFrameName("BG1.png"); pBg->setPosition(VisibleRect::center()); addChild(pBg); auto pMapImage = Sprite::createWithSpriteFrameName("Path.png"); pMapImage->setPosition(VisibleRect::center()); addChild(pMapImage); }
void ShopBuyLayer::callFuncViewPage( Ref* ref, PageView::EventType event ) { auto PageViewBuy = (PageView*)GameMainLayer::seekNodeByName(_widgetLayer, "PageViewBuy" ); auto SpritebutOption = (Sprite*)GameMainLayer::seekNodeByName(_widgetLayer, "SpritebutOption" ); auto ButtonGold = (Button*)GameMainLayer::seekNodeByName(_widgetLayer, "ButtonGold" ); auto ButtonGem = (Button*)GameMainLayer::seekNodeByName(_widgetLayer, "ButtonGem" ); auto ButtonWing = (Button*)GameMainLayer::seekNodeByName(_widgetLayer, "ButtonWing" ); switch ( PageViewBuy->getCurPageIndex() ) { case 0: SpritebutOption->setPosition( ButtonGold->getPosition() ); break; case 1: SpritebutOption->setPosition( ButtonGem->getPosition() ); break; case 2: SpritebutOption->setPosition( ButtonWing->getPosition() ); break; default: break; } }