예제 #1
0
파일: bonusbox.cpp 프로젝트: Clever-Boy/TSC
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();
}
예제 #2
0
void cRandom_Sound :: Editor_Activate( void )
{
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();

	// filename
	CEGUI::Editbox *editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_filename" ));
	Editor_Add( UTF8_("Filename"), UTF8_("Sound filename"), editbox, 200 );

	editbox->setText( m_filename.c_str() );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Filename_Text_Changed, this ) );

	// continuous
	CEGUI::Checkbox *checkbox = static_cast<CEGUI::Checkbox *>(wmgr.createWindow( "TaharezLook/Checkbox", "editor_sound_continuous" ));
	Editor_Add( UTF8_("Continuous"), UTF8_("Check if the sound should be played continuously instead of randomly"), checkbox, 50 );

	checkbox->setSelected( m_continuous );
	checkbox->subscribeEvent( CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Continuous_Changed, this ) );

	// delay min
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_delay_min" ));
	Editor_Add( UTF8_("Delay Minimum"), UTF8_("Minimal delay until played again"), editbox, 90 );

	editbox->setValidationString( "^[+]?\\d*$" );
	editbox->setText( int_to_string( m_delay_min ) );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Delay_Min_Text_Changed, this ) );

	// delay max
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_delay_max" ));
	Editor_Add( UTF8_("Maximum"), UTF8_("Maximal delay until played again"), editbox, 90, 28, 0 );

	editbox->setValidationString( "^[+]?\\d*$" );
	editbox->setText( int_to_string( m_delay_max ) );
	editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Delay_Max_Text_Changed, this ) );

	// volume min
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_min" ));
	Editor_Add( UTF8_("Volume Minimum"), UTF8_("Minimal random volume for each play"), editbox, 90 );

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

	// volume max
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_max" ));
	Editor_Add( UTF8_("Maximum"), UTF8_("Maximal random volume for each play"), editbox, 90, 28, 0 );

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

	// volume reduction begin
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_reduction_begin" ));
	Editor_Add( UTF8_("Volume Reduction Begin"), UTF8_("Volume reduction begins gradually at this distance"), editbox, 90 );

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

	// volume reduction end
	editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_volume_reduction_end" ));
	Editor_Add( UTF8_("End"), UTF8_("Volume reduction ends at this distance. Sound is not played beyond this."), editbox, 90, 28, 0 );

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

	// init
	Editor_Init();
}