示例#1
0
文件: rokko.cpp 项目: Clever-Boy/TSC
void cRokko::Editor_Activate(void)
{
    CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

    // direction
    CEGUI::Combobox* combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_rokko_direction"));
    Editor_Add(UTF8_("Direction"), UTF8_("Direction it moves into."), combobox, 100, 110);

    combobox->addItem(new CEGUI::ListboxTextItem("left"));
    combobox->addItem(new CEGUI::ListboxTextItem("right"));
    combobox->addItem(new CEGUI::ListboxTextItem("up"));
    combobox->addItem(new CEGUI::ListboxTextItem("down"));

    combobox->setText(Get_Direction_Name(m_start_direction));
    combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cRokko::Editor_Direction_Select, this));

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

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

    // init
    Editor_Init();
}
  void SettingComboBox::initialiseComponents()
  {
    CEGUI::Combobox* box = getComboBoxW();

    // internal event wiring
    box->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&SettingComboBox::onSelectionAccepted, this));

    // put components in their initial positions
    performChildWindowLayout();
  }
示例#3
0
void OgreSample13App::createGUI()
{
	CEGUI::WindowManager& windowMgr = CEGUI::WindowManager::getSingleton();
	CEGUI::FontManager::getSingleton().create("chinese-15.font");

	mRootWindow->addChildWindow(windowMgr.loadWindowLayout("OgreSample13.layout"));

	CEGUI::Combobox * cb = (CEGUI::Combobox * )windowMgr.getWindow("OgreSample13/select1");
	cb->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::Event::Subscriber(&OgreSample13App::handleSelected,this));
	cb->addItem(new CEGUI::ListboxTextItem("Instancing",0));
	cb->addItem(new CEGUI::ListboxTextItem("Static Geometry",1));
	cb->addItem(new CEGUI::ListboxTextItem("Independent Entities",2));

	cb = (CEGUI::Combobox * )windowMgr.getWindow("OgreSample13/select2");
	cb->addItem(new CEGUI::ListboxTextItem(meshes[0],0));
	cb->addItem(new CEGUI::ListboxTextItem(meshes[1],1));
	cb->addItem(new CEGUI::ListboxTextItem(meshes[2],2));
	cb->addItem(new CEGUI::ListboxTextItem(meshes[3],3));
	cb->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted,CEGUI::Event::Subscriber(&OgreSample13App::handleSelected,this));
	windowMgr.getWindow("OgreSample13/slider1")->subscribeEvent(CEGUI::Slider::EventValueChanged,CEGUI::Event::Subscriber(&OgreSample13App::handleSliders,this));
	windowMgr.getWindow("OgreSample13/slider2")->subscribeEvent(CEGUI::Slider::EventValueChanged,CEGUI::Event::Subscriber(&OgreSample13App::handleSliders,this));
	windowMgr.getWindow("OgreSample13/checkbox1")->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged,CEGUI::Event::Subscriber(&OgreSample13App::handleCheckboxs,this));
	windowMgr.getWindow("OgreSample13/checkbox2")->subscribeEvent(CEGUI::Checkbox::EventCheckStateChanged,CEGUI::Event::Subscriber(&OgreSample13App::handleCheckboxs,this));
}
示例#4
0
文件: spikeball.cpp 项目: sKabYY/SMC
void cSpikeball :: Editor_Activate( void )
{
	// get window manager
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();

	// direction
	CEGUI::Combobox *combobox = static_cast<CEGUI::Combobox *>(wmgr.createWindow( "TaharezLook/Combobox", "editor_spikeball_direction" ));
	Editor_Add( UTF8_("Direction"), UTF8_("Starting direction."), combobox, 100, 75 );

	combobox->addItem( new CEGUI::ListboxTextItem( "left" ) );
	combobox->addItem( new CEGUI::ListboxTextItem( "right" ) );

	combobox->setText( Get_Direction_Name( m_start_direction ) );
	combobox->subscribeEvent( CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber( &cSpikeball::Editor_Direction_Select, this ) );

	// init
	Editor_Init();
}
示例#5
0
文件: flyon.cpp 项目: Clever-Boy/TSC
void cFlyon::Editor_Activate(void)
{
    // get window manager
    CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

    // direction
    CEGUI::Combobox* combobox = static_cast<CEGUI::Combobox*>(wmgr.createWindow("TaharezLook/Combobox", "editor_flyon_direction"));
    Editor_Add(UTF8_("Direction"), UTF8_("Direction it moves into."), combobox, 100, 110);

    combobox->addItem(new CEGUI::ListboxTextItem("up"));
    combobox->addItem(new CEGUI::ListboxTextItem("down"));
    combobox->addItem(new CEGUI::ListboxTextItem("left"));
    combobox->addItem(new CEGUI::ListboxTextItem("right"));

    combobox->setText(Get_Direction_Name(m_start_direction));
    combobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, CEGUI::Event::Subscriber(&cFlyon::Editor_Direction_Select, this));

    // image dir
    CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_flyon_image_dir"));
    Editor_Add(UTF8_("Image directory"), UTF8_("Directory containing the images"), editbox, 200);

    editbox->setText(path_to_utf8(m_img_dir).c_str());
    editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cFlyon::Editor_Image_Dir_Text_Changed, this));

    // max distance
    editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_flyon_max_distance"));
    Editor_Add(UTF8_("Distance"), _("Movable Distance into its direction"), editbox, 90);

    editbox->setValidationString("^[+]?\\d*$");
    editbox->setText(int_to_string(static_cast<int>(m_max_distance)));
    editbox->subscribeEvent(CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber(&cFlyon::Editor_Max_Distance_Text_Changed, this));

    // speed
    editbox = static_cast<CEGUI::Editbox*>(wmgr.createWindow("TaharezLook/Editbox", "editor_flyon_speed"));
    Editor_Add(UTF8_("Speed"), UTF8_("Initial speed when jumping out"), editbox, 120);

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

    // init
    Editor_Init();
}
示例#6
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);
    }
}
示例#7
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();
}
示例#8
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();
}