//新品推荐 bool OnUpdateTwitter(const CEGUI::EventArgs& e) { CEGUI::Window* twitter = WEArgs(e).window; CEGUI::Listbox* lb = WListBox(twitter->getChildRecursive(SHOPCITY_TWITTER_CHILDLISTBOX_NAME)); #ifdef _DEBUG OutputDebugStr(lb->getName().c_str()); OutputDebugStr("\n"); OutputDebugStr(twitter->getChildAtIdx(0)->getName().c_str()); OutputDebugStr("n"); #endif //清空 lb->resetList(); //由索引关联商城类型 SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex(); SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData(); //新品推荐显示 SCGData::MapNewestA& resdta = dt->GetNewestVec(); SCGData::VecGDPTA& vecDTA = resdta[eCityType]; for(uint i = 0 ; i < vecDTA.size() ; ++i) { CGoodsList::tagGoods2* ptg2 = CGoodsList::GetProperty(vecDTA[i].index); if(ptg2) { string str = ptg2->BaseProperty.strName.c_str(); //CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(str.c_str(),vecDTA[i].index);//索引关联Item ID CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()),vecDTA[i].index);//索引关联Item ID lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME); lb->addItem(lti); } } return true; }
/*********************************************************** set the list of available worlds ***********************************************************/ void ChooseWorldGUI::SetWorldList(const std::vector<LbaNet::WorldDesc> &list) { _wlist = list; try { CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> ( CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldList")); if(lb) { lb->resetList(); std::vector<LbaNet::WorldDesc>::const_iterator it = _wlist.begin(); std::vector<LbaNet::WorldDesc>::const_iterator end = _wlist.end(); for(int cc=0; it != end; ++it, ++cc) { MyListItemCW * item = new MyListItemCW(it->WorldName); lb->addItem(item); if(cc == _selectedworld) lb->setItemSelectState(item, true); } } } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception init the world list: ") + ex.getMessage().c_str()); _root = NULL; } }
/*********************************************************** clear the list ***********************************************************/ void CommunityBox::ClearList(const std::string & listname) { if(listname == "online") { CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> ( CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist")); lb->resetList(); _onlines.clear(); } if(listname == "IRC") { CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> ( CEGUI::WindowManager::getSingleton().getWindow("Community/IRClist")); lb->resetList(); } }
bool MenuState::ReturnButton(const CEGUI::EventArgs &e) { wmgr->getWindow("LIGHTCYCLEMENU/MainMenu")->show(); wmgr->getWindow("LIGHTCYCLEMENU/Lobby")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/Credits")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/ReturnButton")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/Name/Text")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/Name/EditBox")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/IP/Text")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/IP/EditBox")->hide(); wmgr->getWindow("LIGHTCYCLEMENU/ContinueButton")->hide(); CEGUI::Listbox *chatBox = static_cast<CEGUI::Listbox*>(wmgr->getWindow("LIGHTCYCLEMENU/Lobby/ListBox")); chatBox->resetList(); CEGUI::Listbox *nameBox = static_cast<CEGUI::Listbox*>(wmgr->getWindow("LIGHTCYCLEMENU/Lobby/Participants")); nameBox->resetList(); wmgr->getWindow("LIGHTCYCLEMENU/Lobby/EditBox")->setText(""); if(LC::Client::getSingletonPtr()->is_connected()) { boost::shared_ptr<boost::asio::io_service::strand> strand( new boost::asio::io_service::strand(*TheApplication.getIOService())); if(m_IsHost) { strand->post(boost::bind(&Server::write_server_close_message, LC::Server::getSingletonPtr())); } strand->post(boost::bind(&Client::write_disconnect_message, LC::Client::getSingletonPtr())); // Need to make sure these ^ messages are sent before any call to TheApplication.ResetIOService() // is made. } m_IsHost = TheApplication.setHost(false); return true; }
/*********************************************************** set the list of people begin online ***********************************************************/ void TeleportBox::SetTeleportList(const std::map<std::string, TPInfo> &_lists) { CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> ( CEGUI::WindowManager::getSingleton().getWindow("TeleportList")); lb->resetList(); _tplist = _lists; std::map<std::string, TPInfo>::const_iterator it = _lists.begin(); std::map<std::string, TPInfo>::const_iterator end = _lists.end(); for(; it != end; ++it) { lb->addItem(new MyTeleListItem(it->first)); } }
void MenuState::UpdateParticipants(std::vector<std::string> participants) { CEGUI::Listbox *participantsBox = static_cast<CEGUI::Listbox*>(wmgr->getWindow("LIGHTCYCLEMENU/Lobby/Participants")); participantsBox->resetList(); std::string scores = ("LIGHTCYCLEGAME/Score/"); std::vector<std::string>::iterator itr = participants.begin(); int i = 1; for(itr, i; itr != participants.end(); ++itr, i++) { CEGUI::ListboxTextItem *newItem = 0; newItem = new CEGUI::ListboxTextItem(*itr, CEGUI::HTF_WORDWRAP_LEFT_ALIGNED); participantsBox->addItem(newItem); } }
bool MainGameScreen::RunSuitePressed(const CEGUI::EventArgs& pEventArgs) { CEGUI::Spinner* SystemSpinner = static_cast<CEGUI::Spinner*> (GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/SystemSpinner")); CEGUI::Spinner* SeedSpinner = static_cast<CEGUI::Spinner*> (GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/SeedSpinner")); CEGUI::Spinner* SizeSpinner = static_cast<CEGUI::Spinner*> (GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/SizeSpinner")); vector<int> Systems; Systems.push_back(SystemSpinner->getCurrentValue()); GAME->getPath()->getTester()->CreateTestSuite(SeedSpinner->getCurrentValue(), SizeSpinner->getCurrentValue()); GAME->getPath()->getTester()->RunPathTestSuites(Systems); GroupProfile* TestResults = GAME->getPath()->getTester()->getCurrentGroupProfile(); CEGUI::Window* RawWindow = GUI->getWindowManager()->getWindow("MainGameScreen/PathProfileWindow/DataList"); CEGUI::Listbox* DataListbox = (CEGUI::Listbox*) RawWindow; DataListbox->resetList(); char buffer[64] ; CEGUI::ListboxTextItem* newItem; sprintf(buffer, "TotalPathSteps %i", TestResults->TotalPathSteps); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "TotalPathLength %f", TestResults->TotalPathLength); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "TotalGraphReads %i", TestResults->TotalGraphReads); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "TotalNodesExpanded %i", TestResults->TotalNodesExpanded); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "TotalCacheHits %i", TestResults->TotalCacheHits); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "TotalTimeCost %i", TestResults->TotalTimeCost); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "GraphReadEfficency %f", TestResults->GraphReadEfficency); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "NodeSearchEfficency %f", TestResults->NodeSearchEfficency); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "CacheEfficency %f", TestResults->CacheEfficency); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); sprintf(buffer, "TimeCostEfficency %f", TestResults->TimeCostEfficency); newItem = new CEGUI::ListboxTextItem(buffer); DataListbox->addItem(newItem); }