本文整理汇总了C++中ListView::getCurSelectedIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ ListView::getCurSelectedIndex方法的具体用法?C++ ListView::getCurSelectedIndex怎么用?C++ ListView::getCurSelectedIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListView
的用法示例。
在下文中一共展示了ListView::getCurSelectedIndex方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: selectedPhotoEvent
void PhotoSelectSence::selectedPhotoEvent(Ref *pSender, ListViewEventType type)
{
switch (type)
{
case LISTVIEW_ONSELECTEDITEM_START:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
_selectPhotoStarted = true;
_selectPhotoStartIndex = listView->getCurSelectedIndex();
break;
}
case LISTVIEW_ONSELECTEDITEM_END:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
// 点击起始的Index和点击结束的Index一致才能为有效选择
if (_selectPhotoStartIndex == listView->getCurSelectedIndex())
{
// 先原来的照片停止闪
((ImageViewWithSelectBox*)listView->getItem(_selectedPhotoIndex))->stopBlink();
// 再选中的照片开始闪
((ImageViewWithSelectBox*)listView->getItem(_selectPhotoStartIndex))->startBlink();
// 更新索引
_selectedPhotoIndex = _selectPhotoStartIndex;
_selectPhotoStartIndex = -1;
}
break;
}
default:
break;
}
}
示例2: selectedItemEvent
void TrialPanel::selectedItemEvent(Ref *pSender, ListView::EventType type)
{
switch (type)
{
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_START:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
//auto tag = listView->getItem(listView->getCurSelectedIndex())->getTag();
//auto endStatUnit = _endStatsUnit.at(listView->getCurSelectedIndex());
break;
}
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
/*auto unit = listView->getItem(listView->getCurSelectedIndex());
auto achieve = static_cast<Achievement*>(unit->getUserData());*/
break;
}
default:
break;
}
}
示例3: selectedBuffEvent
void HudPanel::selectedBuffEvent(Ref *pSender, ListView::EventType type)
{
switch (type)
{
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_START:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
//auto tag = listView->getItem(listView->getCurSelectedIndex())->getTag();
//auto endStatUnit = _endStatsUnit.at(listView->getCurSelectedIndex());
break;
}
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
auto buffUnit = static_cast<BuffUnit*>(listView->getItem(listView->getCurSelectedIndex()));
auto buffPan = BuffPanel::create("buff");
buffPan->initWithBuff(buffUnit->getBuff());
PopPanel::getInstance()->addPanel(buffPan, 2);
break;
}
default:
break;
}
}
示例4: selectedItemEvent
void ShopPanel::selectedItemEvent(Ref *pSender, ListView::EventType type)
{
switch (type)
{
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_START:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
//auto tag = listView->getItem(listView->getCurSelectedIndex())->getTag();
//auto goodUnit = _goodsUnit.at(listView->getCurSelectedIndex());
break;
}
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
auto goodUnit = _goodsUnit.at(listView->getCurSelectedIndex());
auto good = goodUnit->getGood();
PopPanel::getInstance()->confirm("buy","type:Text---text:"+ a2u("确定要花费 ") + cocos2d::Value(goodUnit->getPrice()).asString() + a2u("元 购买 ") + cocos2d::Value(goodUnit->getNum()).asString() + a2u("个") + good->getNickName() + a2u(" 吗?"),PromptPanel::TYPE_DONE_CANCEL,[=](){
// 加速药水
if(good->getTypeId() == 2003011 && Detect::shareDetect()->getUser()->getBuffByTypeId(4001001) != nullptr)
{
PopPanel::getInstance()->note("treaMap","type:Text---text:"+ a2u("已拥有该效果"),2.0f,false,true);
}
else
{
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//确定购买
JniMethodInfo jmi;
if(JniHelper::getStaticMethodInfo(jmi ,"IAP/IAPJni" ,"orderGood" ,"(I)V"))
{
jmi.env->CallStaticVoidMethod(jmi.classID , jmi.methodID, listView->getCurSelectedIndex());
}
#else
JniTest::getInstance()->orderSuccess(listView->getCurSelectedIndex());
#endif
}
},nullptr,true,true);
break;
}
default:
break;
}
}
示例5: selectedItemEvent
// ListView触摸监听
void TujiLayer::selectedItemEvent(Ref* pSender, ListViewEventType type)//ListView触摸事件
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
// if (m_iBeforeSel == listView->getCurSelectedIndex())
// {
// return;
// }
// String *normalBtn = String::createWithFormat("Cell_%d.png", m_iBeforeSel);
// String *SelctBtn = String::createWithFormat("CellSel_%d.png", listView->getCurSelectedIndex());
m_iBeforeSel = listView->getCurSelectedIndex();
switch (m_iBeforeSel)
{
case 0:
m_pMZ_Pic->setVisible(true);
m_pMZ_Txt->setVisible(true);
m_pMZLabel->setVisible(true);
m_pLion_Pic->setVisible(false);
m_pLionLabel->setVisible(false);
m_pStone_Pic->setVisible(false);
m_pStoneLabel->setVisible(false);
break;
case 1:
m_pMZ_Pic->setVisible(false);
m_pMZLabel->setVisible(false);
m_pMZ_Txt->setVisible(false);
m_pLionLabel->setVisible(true);
m_pLion_Pic->setVisible(true);
m_pStoneLabel->setVisible(false);
m_pStone_Pic->setVisible(false);
break;
case 2:
m_pMZ_Pic->setVisible(false);
m_pMZ_Txt->setVisible(false);
m_pMZLabel->setVisible(false);
m_pLion_Pic->setVisible(false);
m_pLionLabel->setVisible(false);
m_pStone_Pic->setVisible(true);
m_pStoneLabel->setVisible(true);
break;
case 3:
m_pMZ_Pic->setVisible(false);
m_pMZ_Txt->setVisible(false);
m_pLion_Pic->setVisible(false);
m_pStone_Pic->setVisible(false);
m_pLionLabel->setVisible(false);
m_pStoneLabel->setVisible(false);
m_pMZLabel->setVisible(false);
break;
default:
break;
}
}
示例6: selectedItemEvent
void UIListViewTest_Horizontal::selectedItemEvent(Ref *pSender, ListView::EventType type)
{
switch (type)
{
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_START:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
break;
}
case cocos2d::ui::ListView::EventType::ON_SELECTED_ITEM_END:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
break;
}
default:
break;
}
}
示例7: selectedItemEvent
void TodayScene::selectedItemEvent(Ref *pSender, ListViewEventType type)
{
switch (type)
{
case cocos2d::ui::LISTVIEW_ONSELECTEDITEM_START:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child start index = %ld", listView->getCurSelectedIndex());
break;
}
case cocos2d::ui::LISTVIEW_ONSELECTEDITEM_END:
{
ListView* listView = static_cast<ListView*>(pSender);
CC_UNUSED_PARAM(listView);
CCLOG("select child end index = %ld", listView->getCurSelectedIndex());
xSM->forward(SCENE_DETAIL, listView->getCurSelectedIndex(), nullptr);
break;
}
default:
break;
}
}
示例8: titleListEventListener
void TestTitleList::titleListEventListener(Ref* sender, ui::ListView::EventType eventType)
{
ListView* listView = static_cast<ListView*>(sender);
switch (eventType) {
case ListView::EventType::ON_SELECTED_ITEM_START:
{
printf("listView start selectedIdx = %ld\n" , listView->getCurSelectedIndex());
}
break;
case ListView::EventType::ON_SELECTED_ITEM_END:
{
printf("listView end selectedIdx = %ld\n" , listView->getCurSelectedIndex());
Scene* scene = getSceneByModuleName(testmoduleNames.at(listView->getCurSelectedIndex()));
if (scene) {
Director::getInstance()->pushScene(scene);
}
}
break;
default:
break;
}
}