Esempio n. 1
0
//更新左搜索(导购)菜单
bool OnSearchLeftMenuUpdate(const CEGUI::EventArgs& e)
{
    CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window);
    cbbox->clearAllSelections();
    cbbox->resetList();
    cbbox->getEditbox()->setText("");
    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapGuideDataA& mapGuide = dt->GetGuideList();
    //根据索引获取导购数据
    SCGData::MapStrGGDTPA& mapGuideDTA = mapGuide[eCityType];
    CEGUI::Combobox* cbboxRight = WComboBox(GetWndMgr().getWindow(SHOPCITY_SEARCH_RIGHTWND_NAME));
    if(cbboxRight)
    {
        CEGUI::ListboxItem* lbi = cbboxRight->getSelectedItem();
        size_t idx = 0;
        if(lbi)
            idx = cbboxRight->getItemIndex(lbi);
        SCGData::MapStrGGDTPA::iterator iter = mapGuideDTA.begin();
        for(; iter != mapGuideDTA.end() ; ++iter)
        {
            //添加导购菜单
            string menuStr = iter->first;
            //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(menuStr.c_str());
            CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(menuStr.c_str()));
            lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            if(iter == mapGuideDTA.begin())//默认让第一个为选中
                lbi->setSelected(true);
            cbbox->addItem(lbi);
        }
    }
    return true;
}
Esempio n. 2
0
 bool onListSelectionChanged(const CEGUI::EventArgs &args) {
   int id = -1;
   if (m_pCombobox->getSelectedItem()) {
     id = m_pCombobox->getItemIndex(m_pCombobox->getSelectedItem());
     m_Exit.setExitType(static_cast<EExitTypes>(id));
   }
   m_pContentId->setVisible(id == EXIT_ENEMY_DEATH);
   m_pContentRegion->setVisible(id == EXIT_REGION);
   return true;
 }