Beispiel #1
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;
	}
}
Beispiel #2
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));
}
Beispiel #3
0
void SubEventShopCity(CEGUI::Window* pageWnd)
{
    //删除试装的物品
    CEGUI::Window* flDel = pageWnd->getChildRecursive(SHOPCITY_FILLTERROOM_NAME);
    if(flDel)
    {
        flDel->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::SubscriberSlot(OnShopCityTryOnRoomDel));
    }
    //充值
    CEGUI::Window* saveMoney = pageWnd->getChildRecursive(SHOPCITY_SAVEMONEY_NAME);
    if(saveMoney)
    {
        saveMoney->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::SubscriberSlot(OnShopCitySaveMoney));
    }
    //最近购买记录
    CEGUI::Window* latesBuy = pageWnd->getChildRecursive(SHOPCITY_LATESTBUY_NAME);
    if(latesBuy)
        latesBuy->subscribeEvent(SHOPCITY_PAGE_EVENT_UPDATE_LATESTBUY,CEGUI::SubscriberSlot(OnUpdateLatestBuy));
    //清空三种money显示
    pageWnd->subscribeEvent(SHOPCITY_PAGE_EVENT_CLEARMONEYEDBOXES,CEGUI::SubscriberSlot(OnClearMoneyEdboxes));
    //更新三种付费money显示
    pageWnd->subscribeEvent(SHOPCITY_PAGE_EVENT_UPDATEMONEYEDBOXES,CEGUI::SubscriberSlot(OnShopCityUpdateMoneyEdboxes));
    //推荐
    CEGUI::Window* twitter = pageWnd->getChildRecursive(SHOPCITY_TWITTER_NAME);
    if(twitter)
    {
        twitter->subscribeEvent(SHOPCITY_TWITTER_EVENT_NAME,CEGUI::SubscriberSlot(OnUpdateTwitter));
    }
    //推荐双击
    CEGUI::Listbox* ltb = WListBox(GetWindow(SHOPCITY_TWITTER_CHILDLISTBOX_NAME));
    ltb->subscribeEvent(CEGUI::Listbox::EventMouseDoubleClick,CEGUI::SubscriberSlot(OnShopCityTwitterMouseDoubleClicked));
    CEGUI::TabControl* tbs = WTabControl(pageWnd->getChildRecursive(SHOPCITY_TAB_NAME));
    {
        if (tbs)
        {
            tbs->subscribeEvent(CEGUI::TabControl::EventSelectionChanged,CEGUI::SubscriberSlot(OnShopCityContentSelChanged));
        }
    }
    //搜索事件
    CEGUI::Window* search = pageWnd->getChildRecursive(SHOPCITY_SEARCH_NAME);
    if(search) {
        search->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::SubscriberSlot(OnShopCitySearch));
    }
    //搜索左边的ccboxItemchange事件
    CEGUI::Window* searchL = pageWnd->getChildRecursive(SHOPCITY_SEARCH_LEFTWND_NAME);
    if (searchL)
    {
        searchL->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnSearchLeftccboxItemChange));
        //搜索按钮左边的菜单(导购)更新事件
        searchL->subscribeEvent(SHOPCITY_SEARCHLEFT_EVENT_MENUUPDATE_NAME,CEGUI::SubscriberSlot(OnSearchLeftMenuUpdate));
    }
    //搜素右边的ccboxItemchange事件
    CEGUI::Window* searchR = pageWnd->getChildRecursive(SHOPCITY_SEARCH_RIGHTWND_NAME);
    if(searchR)
    {
        searchR->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnSearchRightccboxItemChange));
        //搜索按钮右边的(筛选)菜单更新事件
        searchR->subscribeEvent(SHOPCITY_SEARCHRIGHT_EVENT_MENUUPDATE_NAME,CEGUI::SubscriberSlot(OnSearchRightMenuUpdate));
    }

    //打开时候,就更新界面UI显示
    pageWnd->subscribeEvent(EVENT_OPEN,CEGUI::SubscriberSlot(OnShopCityUpdate));
    //关闭时候
    pageWnd->subscribeEvent(EVENT_CLOSE,CEGUI::SubscriberSlot(OnShopCityClosed));
    pageWnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::SubscriberSlot(OnShopCityClosed));
}
Beispiel #4
0
bool
IntroState::options(const CEGUI::EventArgs &e)
{
  CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();
  _credits=false;
  _options=true;
  _info=false;

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

  CEGUI::Window* backButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","back");
  backButton->setText("[font='DickVanDyke'] Back ");
  backButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
  backButton->setXPosition(UDim(0.66f, 0.0f));
  backButton->setYPosition(UDim(0.85f, 0.0f));
  backButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::back,this));
  
  CEGUI::Window* applyButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","apply");
  applyButton->setText("[font='DickVanDyke'] apply ");
  applyButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
  applyButton->setXPosition(UDim(0.66f, 0.0f));
  applyButton->setYPosition(UDim(0.77f, 0.0f));
  applyButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::apply,this));

  CEGUI::Window* text = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","text");
  text->setText("[font='DickVanDyke'] Mouse Speed");
  text->setSize(CEGUI::USize(CEGUI::UDim(0.15,0),CEGUI::UDim(0.1,0)));
  text->setPosition(CEGUI::UVector2(CEGUI::UDim(0.12,0),CEGUI::UDim(0.32,0)));
  text->setProperty("FrameEnabled","False");
  text->setProperty("BackgroundEnabled", "False");
  text->setProperty("HorzFormatting", "RightAligned");

  CEGUI::Slider* sb = static_cast<CEGUI::Slider*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Slider","SliderSpeed"));
  sb->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.4,0)));
  sb->setMaxValue(40.0f);
  sb->setClickStep(1.0f);
  sb->setCurrentValue(20.0f); 
  sb->subscribeEvent(Slider::EventValueChanged, Event::Subscriber(&IntroState::onSliderValueChanged, this));

  CEGUI::Window* sbText = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","textSliderSpeed");
  sbText->setText("[font='DickVanDyke']20");
  sbText->setSize(CEGUI::USize(CEGUI::UDim(0.05,0),CEGUI::UDim(0.08,0)));
  sbText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.36,0),CEGUI::UDim(0.38,0)));
  sbText->setProperty("FrameEnabled","False");
  sbText->setProperty("BackgroundEnabled", "False");
  sbText->setProperty("HorzFormatting", "RightAligned");

  CEGUI::Window* text2 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","text2");
  text2->setText("[font='DickVanDyke'] Auto-Reload Arrows");
  text2->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0)));
  text2->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.46,0)));
  text2->setProperty("FrameEnabled","False");
  text2->setProperty("BackgroundEnabled", "False");
  text2->setProperty("HorzFormatting", "LeftAligned");

  CEGUI::ToggleButton* cb = static_cast<CEGUI::ToggleButton*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Checkbox","CBAutoReload"));
  cb->setPosition(CEGUI::UVector2(CEGUI::UDim(0.08,0),CEGUI::UDim(0.52,0)));

  CEGUI::Window* resetButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","resetButton");
  resetButton->setText("[font='DickVanDyke'] Reset Records ");
  resetButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
  resetButton->setXPosition(UDim(0.40f, 0.0f));
  resetButton->setYPosition(UDim(0.85f, 0.0f));
  resetButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::resetRecords,this));

  CEGUI::Window* configButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","configButton");
  configButton->setText("[font='DickVanDyke'] Restore Config ");
  configButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
  configButton->setXPosition(UDim(0.40f, 0.0f));
  configButton->setYPosition(UDim(0.77f, 0.0f));
  configButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::resetConfig,this));

  CEGUI::Window* text3 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","FullscreenText");
  text3->setText("[font='DickVanDyke'] Fullscreen");
  text3->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0)));
  text3->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15,0),CEGUI::UDim(0.57,0)));
  text3->setProperty("FrameEnabled","False");
  text3->setProperty("BackgroundEnabled", "False");
  text3->setProperty("HorzFormatting", "LeftAligned");

  CEGUI::ToggleButton* cbFullscreen = static_cast<CEGUI::ToggleButton*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Checkbox","CBFullscreen"));
  cbFullscreen->setPosition(CEGUI::UVector2(CEGUI::UDim(0.08,0),CEGUI::UDim(0.62,0)));
  cbFullscreen->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged,CEGUI::Event::Subscriber(&IntroState::tbFullscreenChanged,this));

  CEGUI::Window* text4 = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText","ResolutionText");
  text4->setText("[font='DickVanDyke'] Resolution");
  text4->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.06,0)));
  text4->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0),CEGUI::UDim(0.35,0)));
  text4->setProperty("FrameEnabled","False");
  text4->setProperty("BackgroundEnabled", "False");
  text4->setProperty("HorzFormatting", "LeftAligned");

  


  CEGUI::Listbox* lbRes = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","lbRes"));
  lbRes->setSize(CEGUI::USize(CEGUI::UDim(0.3,0),CEGUI::UDim(0.3,0)));
  lbRes->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5, 0),CEGUI::UDim(0.40, 0)));
  lbRes->subscribeEvent(Listbox::EventSelectionChanged,CEGUI::Event::Subscriber(&IntroState::changeResolution,this));
  
  const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush");
  
  CEGUI::ListboxTextItem* itm;
  itm = new CEGUI::ListboxTextItem("800x600",0);
  itm->setFont("DickVanDyke-28");
  itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
  itm->setSelectionBrushImage(sel_img);
  lbRes->addItem(itm);
  
  CEGUI::ListboxTextItem* itm2;
  itm2 = new CEGUI::ListboxTextItem("1200x800",1);
  itm2->setFont("DickVanDyke-28");
  itm2->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
  itm2->setSelectionBrushImage(sel_img);
  lbRes->addItem(itm2);

  CEGUI::ListboxTextItem* itm3;
  itm3 = new CEGUI::ListboxTextItem("1920x1020",2);
  itm3->setFont("DickVanDyke-28");
  itm3->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
  itm3->setSelectionBrushImage(sel_img);
  lbRes->addItem(itm3);
    
  

  sheetBG->addChild(text4);
  sheetBG->addChild(lbRes);
  sheetBG->addChild(cb);
  sheetBG->addChild(text2);
  sheetBG->addChild(cbFullscreen);
  sheetBG->addChild(text3);
  sheetBG->addChild(sbText);
  sheetBG->addChild(sb);
  sheetBG->addChild(applyButton);
  sheetBG->addChild(backButton);
  sheetBG->addChild(resetButton);
  sheetBG->addChild(configButton);
  sheetBG->addChild(text);
  sheet->addChild(sheetBG);
    

  if(_fullscreen){
    cbFullscreen->setSelected(true);
  }else{
    cbFullscreen->setSelected(false);
  }

  return true;
}