bool cBonusBox::Editor_Animation_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(); Set_Animation_Type(item->getText().c_str()); return 1; }
void cBonusBox :: Init( void ) { m_type = TYPE_BONUS_BOX; m_force_best_item = 0; m_camera_range = 5000; m_can_be_on_ground = 0; Set_Animation_Type( "Bonus" ); m_gold_color = COL_DEFAULT; Set_Goldcolor( COL_YELLOW ); Create_Name(); }
void cBonusBox::Init(void) { m_type = TYPE_BONUS_BOX; m_force_best_item = 0; m_camera_range = 5000; m_can_be_on_ground = 0; Set_Animation_Type("Bonus"); m_gold_color = COL_DEFAULT; Set_Goldcolor(COL_YELLOW); box_type = TYPE_UNDEFINED; m_name = _("Bonusbox Empty"); }
void cText_Box::Init(void) { m_type = TYPE_TEXT_BOX; box_type = m_type; m_can_be_on_ground = 0; m_name = _("Text Box"); // default is infinite times activate-able Set_Useable_Count(-1, 1); // Spinbox Animation Set_Animation_Type("Default"); // todo : editor image needed //item_image = NULL; }
void cBaseBox::Create_From_Stream(XMLElement* attributes) { int _posx, _posy; std::string _animation = anim_type; int _invisible; int _useable_count = start_useable_count; for (XMLElement* node = attributes->FirstChildElement(); node; node = node->NextSiblingElement()) { const char* name = node->Attribute("name"); const char* value = node->Attribute("value"); if (!strcmp(name, "posx")) { _posx = atoi(value); } else if (!strcmp(name, "posy")) { _posy = atoi(value); } else if (!strcmp(name, "animation")) { _animation = value; } else if (!strcmp(name, "invisible")) { _invisible = atoi(value); } else if (!strcmp(name, "useable_count")) { _useable_count = atoi(value); } } Set_Pos(static_cast<float>(_posx), static_cast<float>(_posy), 1); if (box_type != TYPE_SPINBOX && box_type != TYPE_TEXT_BOX) { Set_Animation_Type(_animation.c_str()); } Set_Invisible(static_cast<Box_Invisible_Type>(_invisible)); Set_Useable_Count(_useable_count, 1); }
void cSpinBox :: Init( void ) { m_type = TYPE_SPIN_BOX; box_type = m_type; m_camera_range = 5000; m_can_be_on_ground = 0; m_spin_counter = 0.0f; m_spin = 0; // default is infinite times activate-able Set_Useable_Count( -1, 1 ); // Spinbox Animation Set_Animation_Type( "Spin" ); // editor image m_item_image = pVideo->Get_Surface( "game/arrow/small/white/up.png" ); Create_Name(); }
void cBaseBox::Set_Animation_Type(const std::string& new_anim_type) { if (anim_type.compare(new_anim_type) == 0) { return; } Clear_Images(); anim_type = new_anim_type; if (anim_type.compare("Bonus") == 0) { Add_Image(pVideo->Get_Surface("game/box/brown1_1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/2.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/3.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/4.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/5.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/bonus/6.png")); Set_Animation(1); Set_Animation_Image_Range(1, 6); Set_Time_All(90, 1); } else if (anim_type.compare("Default") == 0) { Add_Image(pVideo->Get_Surface("game/box/brown1_1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/default.png")); Set_Animation(0); Set_Animation_Image_Range(1, 1); } else if (anim_type.compare("Power") == 0) { Add_Image(pVideo->Get_Surface("game/box/brown1_1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/power_1.png")); Set_Animation(0); Set_Animation_Image_Range(1, 1); } else if (anim_type.compare("Spin") == 0) { Add_Image(pVideo->Get_Surface("game/box/yellow/spin/disabled.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/default.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/1.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/2.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/3.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/4.png")); Add_Image(pVideo->Get_Surface("game/box/yellow/spin/5.png")); Set_Animation(0); Set_Animation_Image_Range(1, 6); Set_Time_All(80, 1); } else { printf("Warning : Unknown Box Animation Type %s\n", anim_type.c_str()); Set_Animation_Type("Bonus"); } Reset_Animation(); Set_Image_Num(m_anim_img_start, 1, 0); }