示例#1
0
bool GUILobby::OnEnter()
{
	CEGUI::Window* parent = NULL;

	// decide where to attach the console main window
	parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

	// attach this window if parent is valid
	if (parent)
		parent->addChild(d_root);

	Listbox* lbox = static_cast<Listbox*>(d_root->getChild("RoomList"));
	lbox->resetList();

	return true;
}
示例#2
0
bool GUILobby::Notify(BasePacket* pPacket)
{
	switch(pPacket->GetPacketID())
	{
	case CGSF::ChatRes:
		{
			SFProtobufPacket<SFPacketStore::ChatRes>* pChatRes = (SFProtobufPacket<SFPacketStore::ChatRes>*)pPacket;

			std::string name = pChatRes->GetData().sender();
			std::string szMessage = pChatRes->GetData().message();

			// get the text entry editbox
			//Editbox* editbox = static_cast<Editbox*>(d_root->getChild(EntryBoxID));

			// get history window
			//	MultiLineEditbox* history = static_cast<MultiLineEditbox*>(d_root->getChild(HistoryID));
			// append new text to history output
			//history->setText(history->getText() + szMessage);
			// scroll to bottom of history output
			//history->setCaretIndex(static_cast<size_t>(-1));

		}
		break;

	case CGSF::RoomList:
		{
			SFProtobufPacket<SFPacketStore::RoomList>* pRoomList = (SFProtobufPacket<SFPacketStore::RoomList>*)pPacket;

			Listbox* lbox = static_cast<Listbox*>(d_root->getChild("RoomList"));
			lbox->resetList();

			for(int i=0; i < pRoomList->GetData().info_size(); i++)
			{
				const SFPacketStore::RoomList::RoomInfo& info = pRoomList->GetData().info(i);
				//_PeerInfo PeerInfo;
				//SF_GETPACKET_ARG(&PeerInfo, Peer.info(), _PeerInfo);
				MyListItem* item = new MyListItem(info.roomname().c_str());
				item->setSelectionColours(CEGUI::Colour(0.3f, 0.7f, 1.0f, 1.0f));
				item->roomIndex = info.roomindex(); 
				
				lbox->addItem(item);

				if(lbox->getType().compare("WindowsLook/Listbox") == 0)
				{

					item->setTextColours(CEGUI::Colour(0.0f, 0.0f, 0.0f, 1.0f));

				}
			}	

		}
		break;
		
	case CGSF::EnterRoom:
		{
			SFProtobufPacket<SFPacketStore::EnterRoom>* pEnterRoom = (SFProtobufPacket<SFPacketStore::EnterRoom>*)pPacket;		
		}
		break;
	}

	return true;

}
示例#3
-25
  void refreshPageList()
  {
    Window* root = d_guiContext->getRootWindow();
    // Check if the windows exists
    Listbox* lbox = 0;
    TabControl* tc = 0;

    if (root->isChild("Frame/TabControl/Page1/PageList"))
    {
      lbox = static_cast<Listbox*>(root->getChild(
        "Frame/TabControl/Page1/PageList"));
    }

    if (root->isChild("Frame/TabControl"))
    {
      tc = static_cast<TabControl*>(root->getChild(
        "Frame/TabControl"));
    }

    if (lbox && tc)
    {
      lbox->resetList();

      for (size_t i = 0; i < tc->getTabCount(); i++)
      {
        lbox->addItem(new MyListItem(
          tc->getTabContentsAtIndex(i)->getName()));
      }
    }
  }