Example #1
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);
    }
}
Example #2
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);

}
Example #3
0
void cStaticEnemy :: Editor_Activate( void )
{
	// get window manager
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();

	// image
	CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_static_enemy_image" ));
	Editor_Add( UTF8_("Image"), UTF8_("Image filename"), editbox, 200 );

	editbox->setText( m_img_filename.c_str() );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cStaticEnemy::Editor_Image_Text_Changed, this ) );

	// rotation speed
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_static_enemy_rotation_speed" ));
	Editor_Add( UTF8_("Rotation Speed"), UTF8_("Rotation Speed"), editbox, 120 );

	editbox->setValidationString( "[-+]?[0-9]*\\.?[0-9]*" );
	editbox->setText( float_to_string( m_rotation_speed ) );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cStaticEnemy::Editor_Rotation_Speed_Text_Changed, this ) );

	// path
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_static_enemy_path_identifier" ));
	Editor_Add( UTF8_("Path Identifier"), UTF8_("Name of the Path to move along."), editbox, 120 );

	editbox->setText( m_path_state.m_path_identifier.c_str() );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cStaticEnemy::Editor_Path_Identifier_Text_Changed, this ) );

	// speed
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_static_enemy_speed" ));
	Editor_Add( UTF8_("Speed"), UTF8_("Maximum speed"), editbox, 120 );

	editbox->setValidationString( "[-+]?[0-9]*\\.?[0-9]*" );
	editbox->setText( float_to_string( m_speed ) );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cStaticEnemy::Editor_Speed_Text_Changed, this ) );

	// fire resistant
	CEGUI::Combobox *combobox = static_cast<CEGUI::Combobox *>(wmgr.createWindow( "TaharezLook/Combobox", "editor_static_enemy_fire_resistant" ));
	Editor_Add( UTF8_("Fire Resistant"), UTF8_("If it is resistant against fire"), combobox, 120, 80 );

	combobox->addItem( new CEGUI::ListboxTextItem( UTF8_("Enabled") ) );
	combobox->addItem( new CEGUI::ListboxTextItem( UTF8_("Disabled") ) );

	if( m_fire_resistant )
	{
		combobox->setText( UTF8_("Enabled") );
	}
	else
	{
		combobox->setText( UTF8_("Disabled") );
	}

	combobox->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cStaticEnemy::Editor_Fire_Resistant_Select, this ) );

	// ice resistance
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_static_enemy_ice_resistance" ));
	Editor_Add( UTF8_("Ice Resistance"), UTF8_("Resistance against Ice (0.0-1.0)"), editbox, 120 );

	editbox->setValidationString( "[+]?[0-9]*\\.?[0-9]*" );
	editbox->setText( float_to_string( m_ice_resistance ) );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cStaticEnemy::Editor_Ice_Resistance_Text_Changed, this ) );
    
	// init
	Editor_Init();
}
Example #4
0
void cBonusBox::Editor_Activate(void)
{
    // BaseBox Settings first
    cBaseBox::Editor_Activate();

    // get window manager
    CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

    // Animation
    CEGUI::Combobox* combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_animation"));
    Editor_Add(UTF8_("Animation"), UTF8_("Use the Power animation if the box has a good or needed item for this level"), combobox, 120, 100);

    combobox->addItem(new CEGUI::ListboxTextItem("Default"));
    combobox->addItem(new CEGUI::ListboxTextItem("Bonus"));
    combobox->addItem(new CEGUI::ListboxTextItem("Power"));

    combobox->setText(reinterpret_cast<const CEGUI::utf8*>(m_anim_type.c_str()));

    combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Animation_Select, this));

    // Item
    combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_item"));
    Editor_Add(UTF8_("Item"), UTF8_("The item that gets spawned"), combobox, 160, 140);

    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Empty")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Random")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Berry")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Fire berry")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Ice berry")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Ghost berry")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("1-UP berry")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Lemon")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Jewel")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Poisonous berry")));

    if (box_type == TYPE_MUSHROOM_DEFAULT) {
        combobox->setText(UTF8_("Berry"));
    }
    else if (box_type == TYPE_FIREPLANT) {
        combobox->setText(UTF8_("Fire berry"));
    }
    else if (box_type == TYPE_MUSHROOM_BLUE) {
        combobox->setText(UTF8_("Ice berry"));
    }
    else if (box_type == TYPE_MUSHROOM_GHOST) {
        combobox->setText(UTF8_("Ghost berry"));
    }
    else if (box_type == TYPE_MUSHROOM_LIVE_1) {
        combobox->setText(UTF8_("1-UP berry"));
    }
    else if (box_type == TYPE_STAR) {
        combobox->setText(UTF8_("Lemon"));
    }
    else if (box_type == TYPE_GOLDPIECE) {
        combobox->setText(UTF8_("Jewel"));
    }
    else if (box_type == TYPE_MUSHROOM_POISON) {
        combobox->setText(UTF8_("Poisonous berry"));
    }
    else if (box_type == TYPE_POWERUP) {
        combobox->setText(UTF8_("Random"));
    }
    else {
        combobox->setText(UTF8_("Empty"));
    }

    combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Item_Select, this));

    // Force best item
    combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_force_best_item"));
    Editor_Add(UTF8_("Force item"), UTF8_("Force best available item when activated"), combobox, 120, 80);

    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Enabled")));
    combobox->addItem(new CEGUI::ListboxTextItem(UTF8_("Disabled")));

    if (m_force_best_item) {
        combobox->setText(UTF8_("Enabled"));
    }
    else {
        combobox->setText(UTF8_("Disabled"));
    }

    combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Force_best_item_Select, this));

    // gold color
    combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_bonusbox_gold_color"));
    Editor_Add(UTF8_("Jewel color"), UTF8_("Jewel color if the item is a jewel"), combobox, 100, 80);

    combobox->addItem(new CEGUI::ListboxTextItem("yellow"));
    combobox->addItem(new CEGUI::ListboxTextItem("red"));
    combobox->setText(Get_Color_Name(m_gold_color));

    combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cBonusBox::Editor_Gold_Color_Select, this));

    // init
    Editor_Init();
}