示例#1
0
文件: bonusbox.cpp 项目: sKabYY/SMC
bool cBonusBox :: Editor_Item_Select( const CEGUI::EventArgs &event )
{
	const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
	CEGUI::ListboxItem *item = static_cast<CEGUI::Combobox *>( windowEventArgs.window )->getSelectedItem();

	if( item->getText().compare( UTF8_("Mushroom") ) == 0 )
	{
		Set_Bonus_Type( TYPE_MUSHROOM_DEFAULT );
	}
	else if( item->getText().compare( UTF8_("Fireplant") ) == 0 )
	{
		Set_Bonus_Type( TYPE_FIREPLANT );
	}
	else if( item->getText().compare( UTF8_("Mushroom Blue") ) == 0 )
	{
		Set_Bonus_Type( TYPE_MUSHROOM_BLUE );
	}
	else if( item->getText().compare( UTF8_("Mushroom Ghost") ) == 0 )
	{
		Set_Bonus_Type( TYPE_MUSHROOM_GHOST );
	}
	else if( item->getText().compare( UTF8_("Mushroom 1-UP") ) == 0 )
	{
		Set_Bonus_Type( TYPE_MUSHROOM_LIVE_1 );
	}
	else if( item->getText().compare( UTF8_("Star") ) == 0 )
	{
		Set_Bonus_Type( TYPE_STAR );
	}
	else if( item->getText().compare( UTF8_("Goldpiece") ) == 0 )
	{
		Set_Bonus_Type( TYPE_GOLDPIECE );
	}
	else if( item->getText().compare( UTF8_("Mushroom Poison") ) == 0 )
	{
		Set_Bonus_Type( TYPE_MUSHROOM_POISON );
	}
	else if( item->getText().compare( UTF8_("Random") ) == 0 )
	{
		Set_Bonus_Type( TYPE_POWERUP );
	}
	else
	{
		Set_Bonus_Type( TYPE_UNDEFINED );
	}

	Editor_State_Update();

	return 1;
}
示例#2
0
void cBonusBox::Load_From_XML(XmlAttributes& attributes)
{
    cBaseBox::Load_From_XML(attributes);

    // item
    Set_Bonus_Type(static_cast<SpriteType>(string_to_int(attributes["item"])));
    // force best possible item
    Set_Force_Best_Item(string_to_int(attributes["force_best_item"]));
    // gold color
    if (box_type == TYPE_GOLDPIECE)
        Set_Goldcolor(Get_Color_Id(attributes.fetch("gold_color", Get_Color_Name(m_gold_color))));
}
示例#3
0
文件: bonusbox.cpp 项目: sKabYY/SMC
void cBonusBox :: Create_From_Stream( CEGUI::XMLAttributes &attributes )
{
	cBaseBox::Create_From_Stream( attributes );

	// item
	Set_Bonus_Type( static_cast<SpriteType>(attributes.getValueAsInteger( "item" )) );
	// force best possible item
	Set_Force_Best_Item( attributes.getValueAsBool( "force_best_item" ) );
	// gold color
	if( box_type == TYPE_GOLDPIECE )
	{
		Set_Goldcolor( Get_Color_Id( attributes.getValueAsString( "gold_color", Get_Color_Name( m_gold_color ) ).c_str() ) );
	}
}