Пример #1
0
void SetInitProShopCity(CEGUI::Window* pageWnd)
{
    CEGUI::TabControl* tbs = WTabControl(pageWnd->getChildRecursive(SHOPCITY_TAB_NAME));
    if(tbs)
    {
        //默认让第一个TabContent可见
        tbs->setSelectedTabAtIndex(0);
        CEGUI::Window* tbs1 = tbs->getTabContentsAtIndex(tbs->getSelectedTabIndex());
#ifdef _DEBUG
        const char* name = tbs1->getName().c_str();
        OutputDebugStr(name);
        OutputDebugStr("\n");
#endif
        tbs1->setVisible(true);
        //将唯一ShopCityChild添加到上面
        CEGUI::TabControl* child = WTabControl(InitShopCityChild());
        //默认让第一tabContent可见
        child->setSelectedTabAtIndex(0);
        tbs1->addChildWindow(child);
    }
    //清空moneyEdboxes
    FireUIEvent(SHOPCITY_PAGE_NAME,SHOPCITY_PAGE_EVENT_CLEARMONEYEDBOXES);
    //moneyEdboxes属性设置
    CEGUI::Editbox* edbox = NULL;
    //星钻
    edbox = WEditBox(pageWnd->getChildRecursive(SHOPCITY_XINGZUAN_EDBOX_NAME));
    if(edbox)
    {
        //只能输入数字
        edbox->setValidationString("[0-9]*");
        //数字宽
        edbox->setMaxTextLength(9);
        //只读
        edbox->setReadOnly(true);
    }
    //点券
    edbox = WEditBox(pageWnd->getChildRecursive(SHOPCITY_DIANJUAN_EDBOX_NAME));
    if(edbox)
    {
        //只能输入数字
        edbox->setValidationString("[0-9]*");
        //数字宽
        edbox->setMaxTextLength(9);
        //只读
        edbox->setReadOnly(true);
    }
    //位面
    edbox = WEditBox(pageWnd->getChildRecursive(SHOPCITY_WEIMIAN_EDBOX_NAME));
    if(edbox)
    {
        //只能输入数字
        edbox->setValidationString("[0-9]*");
        //数字宽
        edbox->setMaxTextLength(9);
        //只读
        edbox->setReadOnly(true);
    }
    //左搜素框
    CEGUI::Combobox* cbboxL = WComboBox(pageWnd->getChildRecursive(SHOPCITY_SEARCH_LEFTWND_NAME));
    if(cbboxL)
    {
        cbboxL->setReadOnly(true);
    }
    //右搜素框
    CEGUI::Combobox* cbboxR = WComboBox(pageWnd->getChildRecursive(SHOPCITY_SEARCH_RIGHTWND_NAME));
    if(cbboxR)
    {
        cbboxR->setReadOnly(true);
    }
}
Пример #2
0
void SetCreateRoleInitProperty(CEGUI::Window* pgWnd)
{
    if(!pgWnd)
        return;
    CEGUI::Combobox* SelCountry = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_COUNTRY_CCB));
    if(SelCountry)
    {
        SelCountry->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnCountryChanged));
        SelCountry->setReadOnly(true);
        CCountryList::MapCountryList* mapCL = CCountryList::GetCountryList();
        for(uint cnt = 0; cnt < mapCL->size(); ++cnt)
        {
            const char* ctName = CCountryList::GetCountryName((BYTE)cnt+1);
            if(ctName)
            {
                CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(ctName));
                lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
                lti->setID(cnt+1);//ID和国家ID关联
                if(cnt == 0)
                    lti->setSelected(true);//设置国家默认值
                SelCountry->addItem(lti);
            }
        }
        //根据国家默认值,设置显示文本
        SelCountry->getEditbox()->setText(ToCEGUIString(CCountryList::GetCountryName(0+1)));//加一是因为data/CountryList.xml配置造成
        /***********************************************************************/
        /* zhaohang fix 2010-9-3
        /***********************************************************************/
        CREvent::SetSelectCountry(1);//逻辑上的国家默认值
    }
    CEGUI::Combobox* selHair = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_HAIR_CCB));
    if(selHair)
    {
        selHair->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnHairChanged));
        selHair->setReadOnly(true);
    }
    CEGUI::Combobox* selHairColor = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_HAIRCOLOR_CCB));
    if(selHairColor)
    {
        selHairColor->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnHairColorChanged));
        selHairColor->setReadOnly(true);
    }
    CEGUI::Combobox* selFac = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_FAC_CCB));
    if(selFac)
    {
        selFac->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnFacChanged));
        selFac->setReadOnly(true);
    }
    CEGUI::Combobox* selSex = WComboBox(pgWnd->getChildRecursive(CREATEROLE_SEL_SEX_CCB));
    if(selSex)
    {
        CEGUI::ListboxTextItem* itm1  = new CEGUI::ListboxTextItem(ToCEGUIString(CREATEROLE_SEX_MALE));
        itm1->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
        itm1->setID(0);//用ID和性别关联
        selSex->addItem(itm1);
        CEGUI::ListboxTextItem* itm2 = new CEGUI::ListboxTextItem(ToCEGUIString(CREATEROLE_SEX_FAMALE));
        itm2->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
        itm2->setID(1);//用ID和性别关联
        selSex->addItem(itm2);
        //注册事件
        selSex->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::SubscriberSlot(OnSexChanged));
        selSex->setReadOnly(true);
    }
}
Пример #3
0
void GameState::enter()
{
	mInput = InputManager::getSingletonPtr();
	mRoot = Ogre::Root::getSingletonPtr();
	if (mRoot != StateManager::getSingletonPtr()->GetRoot())
		return;
	mScenMgr = mRoot->getSceneManager("Scene");
	if (mScenMgr->hasCamera("GameCam"))
		mCam = new Camera("GameCam", mScenMgr, mRoot->getAutoCreatedWindow(), mScenMgr->getCamera("GameCam"));
	else
		mCam = new Camera("GameCam", mScenMgr, mRoot->getAutoCreatedWindow());
	mCam->getOgreCam()->getViewport()->setBackgroundColour(Ogre::ColourValue::Black);
	mGui = GUIManager::getSingleton();
	mPhysics = new Physics(mScenMgr);



	mExit = false;
	if (!CEGUI::FontManager::getSingleton().isDefined("DejaVuSans-10"))
		CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font");
	// set up the GUI
	auto font = &CEGUI::FontManager::getSingleton().get("DejaVuSans-10");
	mGUIRoot = mGui->LoadGUIsheet("GameLayout.layout");
	mGUIRoot->getChild("Quit")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::GoToIntro, this));
	mGUIRoot->getChild("BuildSkeleton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::BuildSkeleton, this));
	CEGUI::ToggleButton* checkbox = static_cast<CEGUI::ToggleButton*> (mGUIRoot->getChild("skeleton Setting/Checkbox"));
	checkbox->setSelected(true);
	mGUIRoot->getChild("skeleton Setting/Checkbox")->subscribeEvent(CEGUI::ToggleButton::EventSelectStateChanged, CEGUI::Event::Subscriber(&GameState::HideSettings, this));
	// add the drop box options
	CEGUI::Combobox* ArmList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Arm Combobox"));
	ArmList->setReadOnly(true);
	ArmList->setSelection(0, 10);
	ArmList->activate();
	
	CEGUI::ListboxTextItem* ArmN = new CEGUI::ListboxTextItem("No Arms", 0);
	ArmN->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	ArmN->setFont(font);
	ArmList->addItem(ArmN);
	auto ArmS = new CEGUI::ListboxTextItem("Short Arms", 1);
	ArmS->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	ArmList->addItem(ArmS);
	auto ArmL = new CEGUI::ListboxTextItem("Long Arms", 2);
	ArmL->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	ArmList->addItem(ArmL);


	CEGUI::Combobox* LegList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Leg Combobox"));
	auto LegU = new CEGUI::ListboxTextItem("Uninverted Legs", 0);
	LegU->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	LegU->setFont(font);
	LegList->addItem(LegU);
	auto LegI = new CEGUI::ListboxTextItem("Inverted Legs", 1);
	LegI->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	LegI->setFont(font);
	LegList->addItem(LegI);

	CEGUI::Combobox* TorsoList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Torso Combobox"));
	auto TorsoU = new CEGUI::ListboxTextItem("Upright", 0);
	TorsoU->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	TorsoU->setFont(font);
	TorsoList->addItem(TorsoU);
	auto TorsoH = new CEGUI::ListboxTextItem("Horizontal", 1);
	TorsoH->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	TorsoH->setFont(font);
	TorsoList->addItem(TorsoH);

	CEGUI::Combobox* NeckList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Neck Combobox"));
	auto NeckL = new CEGUI::ListboxTextItem("Long Neck", 0);
	NeckL->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	NeckL->setFont(font);
	NeckList->addItem(NeckL);
	auto NeckS = new CEGUI::ListboxTextItem("Short Neck", 1);
	NeckS->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	NeckS->setFont(font);
	NeckList->addItem(NeckS);

	CEGUI::Combobox* TailList = static_cast<CEGUI::Combobox*>(mGUIRoot->getChild("Settings Box/Tail Combobox"));
	auto TailN = new CEGUI::ListboxTextItem("No Tail", 0);
	TailN->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	TailN->setFont(font);
	TailList->addItem(TailN);
	auto TailS = new CEGUI::ListboxTextItem("Short Tail", 1);
	TailS->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	TailS->setFont(font);
	TailList->addItem(TailS);
	auto TailL = new CEGUI::ListboxTextItem("Long Tail", 2);
	TailL->setSelectionBrushImage("TaharezLook/MultiListSelectionBrush");
	TailL->setFont(font);
	TailList->addItem(TailL);

	//ArmList->setVisible(true);
	//LegList->setVisible(true);
	//TorsoList->setVisible(true);
	//NeckList->setVisible(true);
	//TailList->setVisible(true);

}