Пример #1
0
/***********************************************************
remove people online
***********************************************************/
void CommunityBox::RemoveOnline(const std::string & listname, const std::string &_offline)
{
	if(listname == "online")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"));


		std::map<std::string, CEGUI::ListboxItem *>::iterator itmap = _onlines.find(_offline);
		if(itmap != _onlines.end())
		{
			lb->removeItem(itmap->second);
			_onlines.erase(itmap);
		}

		UpdateFriendOnlineStatus(_offline);
	}

	if(listname == "IRC")
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/IRClist"));

		CEGUI::ListboxItem *it = lb->findItemWithText(_offline, NULL);
		if(it != NULL)
			lb->removeItem(it);
	}
}
Пример #2
0
/***********************************************************
handle world selected event
***********************************************************/
bool ChooseWorldGUI::HandleWorldSelected (const CEGUI::EventArgs& e)
{
	try
	{
		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldList"));
		if(lb)
		{
			size_t idx = lb->getItemIndex(lb->getFirstSelectedItem());
			if(idx < _wlist.size())
			{
				CEGUI::MultiLineEditbox * eb = static_cast<CEGUI::MultiLineEditbox *> (
					CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldDescription"));
				if(eb)
				{
					eb->setText(_wlist[idx].Description);
				}

				_selectedworld = _wlist[idx].WorldName;
			}
		}
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init the world list: ") + ex.getMessage().c_str());
		_root = NULL;
	}

	return true;
}
Пример #3
0
/***********************************************************
handle event when add friend clicked
***********************************************************/
bool CommunityBox::HandleAddFriend(const CEGUI::EventArgs& e)
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));

	// check if we accept pending friend
	const CEGUI::ListboxTextItem * it = static_cast<const CEGUI::ListboxTextItem *>(lb->getFirstSelectedItem());
	if(it)
	{
		long fid = (long)it->getID();
		T_friendmap::iterator itm = _friends.find(fid);
		if(itm != _friends.end())
		{
			if(itm->second.first.ToAccept)
			{
				ThreadSafeWorkpile::getInstance()->AcceptFriend(fid);
				return true;
			}
		}
	}

	// if not then we add a new friend
	_myChooseName->show();
	CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
		(CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/edit"));
	bed->activate();
	return true;
}
Пример #4
0
bool GUIManager::handleDSActivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    std::vector<unsigned int> const & dims = dm->getDimensions();
    unsigned int dim = dims[int(sb->getScrollPosition()*(dims.size()-1))];
    float scrollPos = sb->getScrollPosition();
    dm->activate(dim);
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->enable();
    CEGUI::WindowEventArgs w(sb);
    sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
    // Set the global scrollbar to the right position.
    sb->setScrollPosition(scrollPos);
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->show();
  }
  // TODO handle else-error
  return true;
}
Пример #5
0
/***********************************************************
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;
	}
}
Пример #6
0
//新品推荐
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;
}
Пример #7
0
	void MenuState::HandleChatMessage(std::string text)
	{
		CEGUI::Listbox *chatBox = static_cast<CEGUI::Listbox*>(wmgr->getWindow("LIGHTCYCLEMENU/Lobby/ListBox"));
		CEGUI::ListboxTextItem *newItem = 0;
		newItem = new CEGUI::ListboxTextItem(text, CEGUI::HTF_WORDWRAP_LEFT_ALIGNED);
		chatBox->addItem(newItem);
		chatBox->ensureItemIsVisible(newItem);
	}
Пример #8
0
void DeveloperConsole::outputConsoleText(const CEGUI::String& text, CEGUI::Colour color) {
    CEGUI::Listbox* listbox = static_cast<CEGUI::Listbox*>(mConsoleWindow->getChild("History"));
    
    CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(text);
    item->setTextColours(color);
    listbox->addItem(item);
    listbox->ensureItemIsVisible(item);
}
Пример #9
0
bool 
IntroState::changeResolution(const CEGUI::EventArgs &e){
  CEGUI::Listbox* lb = static_cast<CEGUI::Listbox*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("background_options")->getChild("lbRes"));
  string sel=lb->getFirstSelectedItem()->getText().c_str();
  _resWidth=Ogre::StringConverter::parseInt(Ogre::StringUtil::split(sel,"x")[0]);
  _resHeigt=Ogre::StringConverter::parseInt(Ogre::StringUtil::split(sel,"x")[1]);
  cout << _resWidth << endl;
  cout << _resHeigt << endl;
  return true;
}
Пример #10
0
void
MenuState::createGUI()
{
  //Limpiar interfaz del estado anterior-------------------
  CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

  //-------------------------------------------------------
  CEGUI::Window* sheetBG =  CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","backgroundMenu");
  sheetBG->setPosition(CEGUI::UVector2(cegui_reldim(0),cegui_reldim(0)));
  sheetBG->setSize( CEGUI::USize(cegui_reldim(1),cegui_reldim(1)));
  sheetBG->setProperty("Image","BackgroundImageMenu");
  sheetBG->setProperty("FrameEnabled","False");
  sheetBG->setProperty("BackgroundEnabled", "False");


  CEGUI::ListboxTextItem* itm;


  CEGUI::Listbox* editBox = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","listbox"));
  editBox->setSize(CEGUI::USize(CEGUI::UDim(0.6,0),CEGUI::UDim(0.6,0)));
  editBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.20, 0),CEGUI::UDim(0.10, 0)));

  const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush");
  
  std::vector<string> files = listDir("./data/Levels/*"); // ./Para directorio actual ./Carpeta/* para otra carpeta
  for(unsigned int i=0;i<files.size();i++){
    string aux=files[i];
    if(Ogre::StringUtil::endsWith(aux,".txt")){
      cout << "================ File: " << aux <<"================"<< endl;
      _recorridos.push_back(aux);
      string file=Ogre::StringUtil::split(aux,"/")[3];
      cout<<"File: " << file << endl;
      file=Ogre::StringUtil::replaceAll(file,".txt","");
      cout<<"File: " << file << endl;
      itm = new CEGUI::ListboxTextItem(file,0);
      itm->setFont("DickVanDyke-28");
      itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
      itm->setSelectionBrushImage(sel_img);
      editBox->addItem(itm);
    }
    
  }
  //---------------------------------------------------

  CEGUI::Window* playButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","playButton");
  playButton->setText("[font='DickVanDyke'] Start");
  playButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.07,0)));
  playButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.4,0),CEGUI::UDim(0.8,0)));
  playButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&MenuState::playB,this));

  sheetBG->addChild(playButton);
  sheetBG->addChild(editBox);
  sheet->addChild(sheetBG);

}
Пример #11
0
void ConsoleBox::outputText(std::string _msg, bool _leftAligned, unsigned int _timeStamp, unsigned int _colour)
{
  CEGUI::Listbox *outputWindow = dynamic_cast<CEGUI::Listbox*>(window);
  //static_cast<CEGUI::Listbox*>(window->getChildRecursive("ChatBox"));
  assert(outputWindow);

  CEGUI::ListboxTextItem *newItem=0;
  newItem = new CEGUI::ListboxTextItem(Log::getTimeString(_timeStamp) + ' ' + _msg, _leftAligned?CEGUI::HTF_WORDWRAP_LEFT_ALIGNED:CEGUI::HTF_WORDWRAP_RIGHT_ALIGNED);
  newItem->setTextColours(_colour);
  outputWindow->addItem(newItem);
}
Пример #12
0
void GameConsoleWindow::OutputText(CEGUI::String inMsg, CEGUI::Colour colour)
{
	// Get a pointer to the ChatBox so we don't have to use this ugly getChild function every time.
	CEGUI::Listbox *outputWindow = static_cast<CEGUI::Listbox*>(m_ConsoleWindow->getChild(sNamePrefix + "History"));
 
	CEGUI::ListboxTextItem* newItem=0; // This will hold the actual text and will be the listbox segment / item
 
	newItem = ::new CEGUI::ListboxTextItem(inMsg); // instance new item
        newItem->setTextColours(colour); // Set the text color
	outputWindow->addItem(newItem); // Add the new ListBoxTextItem to the ListBox
}
Пример #13
0
/***********************************************************
clear the friend list
***********************************************************/
void CommunityBox::ClearFriends()
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));

	T_friendmap::iterator it = _friends.begin();
	T_friendmap::iterator end = _friends.end();
	for(; it != end; ++it)
		lb->removeItem(it->second.second);

	_friends.clear();
}
Пример #14
0
//双击推荐列表,打开购买页面
bool OnShopCityTwitterMouseDoubleClicked(const CEGUI::EventArgs& e)
{
    CEGUI::Listbox* twitterList = WListBox(WEArgs(e).window);
    CEGUI::ListboxItem* lbi = twitterList->getFirstSelectedItem();
    if(lbi)
    {
        uint index = lbi->getID();//获取索引,索引关联物品索引
        CEGUI::Window* buyPage = GetWindow(SHOPCITY_BUY_PAGE_NAME);
        buyPage->setID(index);//购买界面ID与物品索引关联
        //打开购买界面
        FireUIEvent(SHOPCITY_BUY_PAGE_NAME,EVENT_OPEN);
    }
    return true;
}
Пример #15
0
/***********************************************************
handle GO button pressed
***********************************************************/
bool TeleportBox::HandleGoButton (const CEGUI::EventArgs& e)
{
    CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
        CEGUI::WindowManager::getSingleton().getWindow("TeleportList"));

	MyTeleListItem * it = static_cast<MyTeleListItem *> (lb->getFirstSelectedItem());
	if(it != NULL)
	{
		InternalWorkpile::getInstance()->AddEvent(new TeleportEvent(_tplist[it->getText().c_str()].NewMap, _tplist[it->getText().c_str()].Spawning));
		HandleClose(e);
	}

	return true;
}
Пример #16
0
/***********************************************************
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));
	}
}
Пример #17
0
/***********************************************************
handle event when remove friend clicked
***********************************************************/
bool CommunityBox::HandleRemoveFriend(const CEGUI::EventArgs& e)
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));

	const CEGUI::ListboxTextItem * it = static_cast<const CEGUI::ListboxTextItem *>(lb->getFirstSelectedItem());
	if(it)
	{
		long fid = (long)it->getID();
		//RemoveFriend(fid);
		ThreadSafeWorkpile::getInstance()->RemoveFriend(fid);
	}

	return true;
}
Пример #18
0
	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);
		}
	}
Пример #19
0
/***********************************************************
init function
***********************************************************/
void ChooseWorldGUI::Initialize(void)
{
	try
	{
		_root = CEGUI::WindowManager::getSingleton().loadWindowLayout( "ChooseWorldWindow.layout",
								"", "", &MyPropertyCallback);

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CWGoB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChooseWorldGUI::HandleConnect, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CWCancelB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChooseWorldGUI::HandleCancel, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CWResetB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChooseWorldGUI::HandleReset, this));

		CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("ChooseWorldList"));
		lb->subscribeEvent (CEGUI::Listbox::EventSelectionChanged,
			CEGUI::Event::Subscriber (&ChooseWorldGUI::HandleWorldSelected, this));

		lb->subscribeEvent (CEGUI::Window::EventKeyDown,
			CEGUI::Event::Subscriber (&ChooseWorldGUI::HandleEnterKey, this));

		CEGUI::WindowManager::getSingleton().getWindow("CWLBaNetLogo")->disable();
		CEGUI::WindowManager::getSingleton().getWindow("CWLBaNetLogoCenter")->disable();

		static_cast<CEGUI::FrameWindow *>(
			CEGUI::WindowManager::getSingleton().getWindow("CWWIndowFrame"))->setDragMovingEnabled(false);

		static_cast<CEGUI::FrameWindow *>(
			CEGUI::WindowManager::getSingleton().getWindow("CWWIndowFrame"))->setRollupEnabled(false);



	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init login gui: ") + ex.getMessage().c_str());
		_root = NULL;
	}
}
Пример #20
0
bool GUIManager::handleDSSelection ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
  DataManager *dm = static_cast<DataManager *>(
      lb->getFirstSelectedItem()->getUserData());
  _selectedDM = dm;
  std::vector<unsigned int> const & dim = dm->getDimensions();
  sb->setStepSize(1.0/float(dim.size()-1));
  sb->enable();
  CEGUI::WindowEventArgs w(sb);
  sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
  return true;
}
Пример #21
0
/***********************************************************
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();
	}
}
Пример #22
0
/***********************************************************
add a tab to the chat
***********************************************************/
void ChatBox::AddTab(const std::string & tabName)
{
    CEGUI::TabControl *tc = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow ("Chat/TabControl"));

	CEGUI::FrameWindow* fWnd = static_cast<CEGUI::FrameWindow *>(CEGUI::WindowManager::getSingleton().createWindow( "DefaultGUISheet", "Chat/Tab_"+tabName ));
	fWnd->setProperty("Text", (const unsigned char *)tabName.c_str());


	CEGUI::Listbox* txt = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().createWindow( "TaharezLook/Listbox", "Chat/Tab_"+tabName+"/editMulti" ));
	txt->setProperty("UnifiedMaxSize", "{{1,0},{1,0}}");
	txt->setProperty("UnifiedAreaRect", "{{0,0},{0,1},{1,0},{1,0}}");
	txt->setProperty("ForceVertScrollbar", "True");
	fWnd->addChildWindow(txt);
	tc->addTab (fWnd);

   //txt->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber (&ChatBox::HandleEnterKey, this));
}
Пример #23
0
bool GUIManager::handleScrollbarChanged ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Scrollbar *scrollbar =
    static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  CEGUI::Window *desc = tab->getChild(1);
  DataManager *dm = static_cast<DataManager *>(
      lb->getFirstSelectedItem()->getUserData());
  std::vector<unsigned int> const & dims = dm->getDimensions();
  float f = static_cast<CEGUI::Scrollbar *>(scrollbar)->getScrollPosition();
  unsigned int dim = dims[int(f*(dims.size()-1))];
  std::ostringstream ss; ss << "Dimension: " << dim;
  desc->setText(ss.str());
  return true;
}
Пример #24
0
bool
MenuState::playB(const CEGUI::EventArgs &e)
{
  //Recupero el nivel selecionado-----------------------------------------
  CEGUI::Listbox* slistbox = static_cast<CEGUI::Listbox*>(static_cast<const CEGUI::WindowEventArgs&>(e).window->getRootWindow()->getChild("backgroundMenu")->getChild("listbox"));
  string listboxText=slistbox->getFirstSelectedItem()->getText().c_str();
  listboxText+=".txt";
  cout << listboxText << endl;
  for(unsigned int i=0;i<_recorridos.size();i++){
    string aux=_recorridos[i];
    if(Ogre::StringUtil::endsWith(aux,listboxText)){
      GameManager::getSingletonPtr()->setLevel(aux);
      changeState(PlayState::getSingletonPtr());
    }
  }
  return true;
}
Пример #25
0
bool GUILobby::handleRoomClick( const CEGUI::EventArgs& args )
{
	CEGUI::Listbox* pListBox = static_cast<CEGUI::Listbox*>(d_root->getChild("RoomList"));

	if(pListBox->getFirstSelectedItem())
    {
        MyListItem* pItem = static_cast<MyListItem*>(pListBox->getFirstSelectedItem());
		
		SFProtobufPacket<SFPacketStore::EnterRoom> pktEnterRoom(CGSF::EnterRoom);

		pktEnterRoom.GetData().set_roomindex(pItem->roomIndex);
		pktEnterRoom.GetData().set_gamemode(3);
		g_pCasualGameManager->GetNetwork()->TCPSend(&pktEnterRoom);
	}

	return true;
}
Пример #26
0
/***********************************************************
handle event when list is double clicked
***********************************************************/
bool CommunityBox::HandleConnecteddblClick (const CEGUI::EventArgs& e)
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"));

	const CEGUI::ListboxTextItem * it = static_cast<const CEGUI::ListboxTextItem *>(lb->getFirstSelectedItem());
	if(it)
	{
		std::string name = it->getText().c_str();
		name = name.substr(name.find("]")+1);
		name = name.substr(0, name.find_last_of("(")-1);

		ThreadSafeWorkpile::getInstance()->AddWhisperChannel(name);
		ThreadSafeWorkpile::getInstance()->AddEvent(new FocusChatEvent());
	}

	return true;
}
Пример #27
0
/***********************************************************
add people friend
***********************************************************/
void CommunityBox::UpdateFriend(const LbaNet::FriendInfo & frd)
{
	//RemoveFriend(frd.Name);

	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));


	bool connected = false;
	std::string color = "FF777777";
	std::map<std::string, CEGUI::ListboxItem *>::iterator iton = _onlines.find(frd.Name);
	if(iton != _onlines.end())
	{
		connected = true;
		color = "FF33FF33";
	}

	std::string dis = "[colour='" + color + "']";
	if(frd.ToAccept)
		dis += "(Request) ";

	dis += frd.Name;

	if(frd.Pending)
		dis += " (Pending)";


	//check if already exist just update the text
	T_friendmap::iterator it = _friends.find(frd.Id);
	if(it != _friends.end())
	{
		it->second.second->setText(dis);
		lb->invalidate();
	}
	else
	{
		CEGUI::ListboxItem *item = new MyComListItem(dis);
		item->setID((unsigned int)frd.Id);
		lb->addItem(item);
		_friends[frd.Id] = std::make_pair<LbaNet::FriendInfo, CEGUI::ListboxItem *>(frd, item);

	}
}
Пример #28
0
void GUIManager::setHandlers ()
{
  CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();

  CEGUI::FrameWindow *dsFrame = static_cast<CEGUI::FrameWindow *>(
      wm.getWindow("Sheet/DatasetFrame"));
  dsFrame->hide();
  // Handle behavior of options-button
  CEGUI::PushButton *button = static_cast<CEGUI::PushButton *>(
      wm.getWindow("Sheet/Options"));
  button->subscribeEvent(CEGUI::PushButton::EventClicked,
      CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
  button = dsFrame->getCloseButton();
  button->subscribeEvent(CEGUI::PushButton::EventClicked,
      CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
  // Connect activate buttons on tabs
  auto connectFrames = [=](CEGUI::Window *tab) {
    CEGUI::PushButton *button =
      static_cast<CEGUI::PushButton *>(tab->getChild(3));
    button->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIManager::handleDSActivation, this));
    button = static_cast<CEGUI::PushButton *>(tab->getChild(4));
    button->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIManager::handleDSDeactivation, this));
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
        CEGUI::Event::Subscriber(&GUIManager::handleScrollbarChanged, this));
    CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
    lb->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
        CEGUI::Event::Subscriber(&GUIManager::handleDSSelection, this));
  };
  CEGUI::Window *tab =  wm.getWindow("Sheet/DatasetFrame/TabControl/HTab");
  connectFrames(tab);
  tab = wm.getWindow("Sheet/DatasetFrame/TabControl/PTab");
  connectFrames(tab);
  tab = wm.getWindow("Sheet/DatasetFrame/TabControl/CTab");
  connectFrames(tab);
  CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(
      wm.getWindow("Sheet/DimensionSlider"));
  sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
      CEGUI::Event::Subscriber(&GUIManager::handleBigScrollbarChanged, this));
}
Пример #29
0
bool GUIManager::handleDSDeactivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    dm->deactivate();
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->disable();
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->hide();
  }
  // TODO handle else-error
  return true;
}
Пример #30
0
/***********************************************************
handle event when list is double clicked
***********************************************************/
bool CommunityBox::HandleListdblClick (const CEGUI::EventArgs& e)
{
	CEGUI::Listbox * lb = static_cast<CEGUI::Listbox *> (
		CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"));

	const CEGUI::ListboxTextItem * it = static_cast<const CEGUI::ListboxTextItem *>(lb->getFirstSelectedItem());
	if(it)
	{
		std::string name = it->getText().c_str();
		name = name.substr(name.find("]")+1);
	
		std::map<std::string, CEGUI::ListboxItem *>::iterator iton = _onlines.find(name);
		if(iton != _onlines.end())
		{
			ThreadSafeWorkpile::getInstance()->AddWhisperChannel(name);
			ThreadSafeWorkpile::getInstance()->AddEvent(new FocusChatEvent());
		}
	}

	return true;
}