本文整理汇总了C++中PageView::getCurPageIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ PageView::getCurPageIndex方法的具体用法?C++ PageView::getCurPageIndex怎么用?C++ PageView::getCurPageIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageView
的用法示例。
在下文中一共展示了PageView::getCurPageIndex方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pageViewEvent
void GateSelect::pageViewEvent(Ref *pSender, PageView::EventType type)
{
switch (type)
{
case PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
this->txtGroup->setString(StringUtils::format("卡组%d",int(pageView->getCurPageIndex()+1)));
tabBar->setIndex(int(pageView->getCurPageIndex()));
// Layout* subPage=pageView->getPage(int(pageView->getCurPageIndex()));
// for(int i=0;i<5;i++)
// {
// ImageView* img=static_cast<ImageView*>(subPage->getChildByName("img_"+Value((i+1)).asString()));
// ImageView* icon=(ImageView*)img->getChildByName("icon");
// if (i<pGroup.npcid_size() && pGroup.npcid(i)!=0) {
// PNpc* pNpc=Manager::getInstance()->getNpc(pGroup.npcid(j));
// XRole* xRole=XRole::record(Value(pNpc->spriteid()));
// icon->loadTexture("face_"+Value(xRole->getId()).asString()+".png");
// img->loadTexture("frame_"+Value(Manager::getInstance()->Qualitys[pNpc->quality()].color).asString()+".png");
// }
// icon->setVisible(j<pGroup.npcid_size() && pGroup.npcid(j)!=0);
//
// }
}
break;
default:
break;
}
}
示例2: pageViewEvent
void EventBoard::pageViewEvent(Ref *pSender, PageViewEventType type)
{
auto btnBtn1 = dynamic_cast<Button*>(_UINode->getChildByName(EVENTBOARD_BUTTON1));
auto btnBtn2 = dynamic_cast<Button*>(_UINode->getChildByName(EVENTBOARD_BUTTON2));
auto btnBtn3 = dynamic_cast<Button*>(_UINode->getChildByName(EVENTBOARD_BUTTON3));
switch (type)
{
case cocos2d::ui::PAGEVIEW_EVENT_TURNING:
{
PageView* pageView = dynamic_cast<PageView*> (pSender);
int iPage=pageView->getCurPageIndex();
if (iPage >= MAXPAGE) break;
if (iPage == 0)
{
btnBtn1->loadTextures(EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON);
btnBtn2->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn3->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
int iNews1 = atoi(DataAccess::getParamValue("NewsTweebotRead", "0").c_str());
if (iNews1 == 0)
{
playAni();
}
else disableAni();
}
else if (iPage==1)
{
btnBtn1->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn2->loadTextures(EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON);
btnBtn3->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
int iNews2 = atoi(DataAccess::getParamValue("NewsSlotRead", "0").c_str());
if (iNews2 == 0)
{
playAni();
}
else disableAni();
}
else if (iPage == 2)
{
btnBtn1->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn2->loadTextures(EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF, EVENTBOARD_BTN_OFF);
btnBtn3->loadTextures(EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON, EVENTBOARD_BTN_ON);
int iNews3 = atoi(DataAccess::getParamValue("News10000Read", "0").c_str());
if (iNews3 == 0)
{
playAni();
}
else disableAni();
}
}
break;
default:
break;
}
}
示例3: pageViewEvent
void TeachingLayer::pageViewEvent(Ref* sender,PageView::EventType type)
{
switch (type)
{
case cocos2d::ui::PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(sender);
CCLOG("curpage:%d",pageView->getCurPageIndex());
for (int i = 0;i<4;i++)
{
dynamic_cast<MenuItemSprite*>(this->getChildByTag(kTagRadioMenu)->getChildByTag(i))->unselected();
}
curPage = pageView->getCurPageIndex();
dynamic_cast<MenuItemSprite*>(this->getChildByTag(kTagRadioMenu)->getChildByTag(curPage))->selected();
}
break;
default:
break;
}
}
示例4: init
bool LevelManager::init()
{
if (!Layer::init())
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
_selectedLevelIndex = 0;
auto pageView = PageView::create();
pageView->setContentSize(Size(480.0f,320.0f));
pageView->setAnchorPoint(Vec2(0.5,0.5));
pageView->setPosition(Vec2(visibleSize.width/2,visibleSize.height/2));
for (int i = 0; i < 3;++i)
{
Layout* layout = Layout::create();
layout->setContentSize(Size(480.0f,320.0f));
ImageView* _imageView = ImageView::create(StringUtils::format("preview%d.png",i+1));
_imageView->setContentSize(Size(480.0f,320.0f));
_imageView->setPosition(Vec2(layout->getContentSize().width/2.f,layout->getContentSize().height/2.f));
layout->addChild(_imageView);
pageView->insertPage(layout,i);
}
pageView->addEventListener([=](Ref* pSender,PageView::EventType type){
switch (type)
{
case PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_selectedLevelIndex = pageView->getCurPageIndex();
}
break;
default:
break;
}
});
this->addChild(pageView,1);
auto start_button = Button::create("btn-start.png");
start_button->setPosition(Vec2(visibleSize.width/2,visibleSize.height*0.2));
start_button->addTouchEventListener([=](Ref* pSender, Widget::TouchEventType type)
{
if (type==Widget::TouchEventType::ENDED)
{
auto transition = TransitionSlideInR::create(1.5,GameScene::createSceneWithLevel(++_selectedLevelIndex));
Director::getInstance()->pushScene(transition);
}
});
this->addChild(start_button, 1);
return true;
}
示例5: pageViewEvent
//the response function of the pageView mobile
void SelectUI::pageViewEvent(Ref *target, PageViewEventType type)
{
if (type== PAGEVIEW_EVENT_TURNING)
{
PageView * pPageView = dynamic_cast<PageView*>(target);
int m_pPage_num=pPageView->getCurPageIndex();
if (m_pPage_num==0)
{
g_Senior = false;
g_Primary = true;
g_Middle = false;
m_pPrimary->loadTextures("./res/PictureRes/VisibleBg.png","./res/PictureRes/VisibleBg.png");
m_pMiddle->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pSenior->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pPrimary->setTitleColor(Color3B(181,178,111));
m_pSenior->setTitleColor(Color3B(227,224,163));
m_pMiddle->setTitleColor(Color3B(227,224,163));
}
if (m_pPage_num==1)
{
g_Senior = false;
g_Primary = false;
g_Middle = true;
m_pPagetView->getPage(1)->setVisible(true);
m_pMiddle->loadTextures("./res/PictureRes/VisibleBg.png","./res/PictureRes/VisibleBg.png");
m_pPrimary->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pSenior->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pMiddle->setTitleColor(Color3B(181,178,111));
m_pSenior->setTitleColor(Color3B(227,224,163));
m_pPrimary->setTitleColor(Color3B(227,224,163));
}
if (m_pPage_num==2)
{
g_Senior = true;
g_Primary = false;
g_Middle = false;
m_pSenior->loadTextures("./res/PictureRes/VisibleBg.png","./res/PictureRes/VisibleBg.png");
m_pPrimary->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pMiddle->loadTextureNormal("./res/PictureRes/IconCover.png");
m_pSenior->setTitleColor(Color3B(181,178,111));
m_pMiddle->setTitleColor(Color3B(227,224,163));
m_pPrimary->setTitleColor(Color3B(227,224,163));
}
}
}
示例6: pageViewEvent
void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type)
{
switch (type)
{
case PageView::EventType::TURNING:
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
_displayValueLabel->setString(CCString::createWithFormat("page = %ld", pageView->getCurPageIndex() + 1)->getCString());
}
break;
default:
break;
}
}
示例7: pageViewEvent
void CocosGUIExamplesPageScene::pageViewEvent(Ref *pSender, PageViewEventType type)
{
PageView* pageView = dynamic_cast<PageView*>(pSender);
int page = pageView->getCurPageIndex() + 1;
// set current page number for text
Text* page_alert_label = dynamic_cast<Text*>(Helper::seekWidgetByName(_root, "page_alert_label"));
page_alert_label->setText(CCString::createWithFormat("page %d", page)->getCString());
// set current page for image
Layout* page_alert_bottom_layout = dynamic_cast<Layout*>(Helper::seekWidgetByName(_root, "page_alert_bottom_panel"));
int count = page_alert_bottom_layout->getChildren().size();
for (int i = count / 2; i < count; ++i)
{
Widget* child = dynamic_cast<Widget*>(page_alert_bottom_layout->getChildren().at(i));
child->setVisible(false);
}
ImageView* page_imageview = dynamic_cast<ImageView*>(Helper::seekWidgetByName(_root, CCString::createWithFormat("page_%d_imageview", page)->getCString()));
page_imageview->setVisible(true);
}