本文整理汇总了C++中cegui::XMLAttributes::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ XMLAttributes::exists方法的具体用法?C++ XMLAttributes::exists怎么用?C++ XMLAttributes::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::XMLAttributes
的用法示例。
在下文中一共展示了XMLAttributes::exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Handle_Generic_Game_Events
void Handle_Generic_Game_Events(const CEGUI::XMLAttributes& action_data)
{
if (action_data.exists("music_fadeout")) {
pAudio->Fadeout_Music(action_data.getValueAsInteger("music_fadeout"));
}
if (action_data.getValueAsBool("reset_save")) {
pLevel_Player->Reset_Save();
}
if (action_data.getValueAsBool("unload_levels")) {
pLevel_Manager->Unload();
}
if (action_data.getValueAsBool("unload_menu")) {
pMenuCore->Unload();
}
if (action_data.exists("load_menu")) {
MenuID menu = static_cast<MenuID>(action_data.getValueAsInteger("load_menu"));
pMenuCore->Load(menu, static_cast<GameMode>(action_data.getValueAsInteger("menu_exit_back_to")));
if (menu == MENU_START && action_data.exists("menu_start_current_level")) {
cMenu_Start* menu_start = static_cast<cMenu_Start*>(pMenuCore->m_menu_data);
menu_start->Highlight_Level(action_data.getValueAsString("menu_start_current_level").c_str());
}
}
// set active world
if (action_data.exists("enter_world")) {
pOverworld_Manager->Set_Active(action_data.getValueAsString("enter_world").c_str());
}
// set player waypoint
if (action_data.exists("world_player_waypoint")) {
// get world waypoint
int waypoint_num = pActive_Overworld->Get_Waypoint_Num(action_data.getValueAsString("world_player_waypoint").c_str());
// waypoint available
if (waypoint_num >= 0) {
// set the previous waypoints accessible
pActive_Overworld->Set_Progress(waypoint_num, 0);
pOverworld_Player->Set_Waypoint(waypoint_num);
}
}
if (action_data.exists("new_level")) {
std::string str_level = action_data.getValueAsString("new_level").c_str();
// new level
cLevel* level = pLevel_Manager->New(str_level);
if (level) {
pLevel_Manager->Set_Active(level);
level->Init();
}
}
if (action_data.exists("load_level")) {
bool loading_sublevel = action_data.exists("load_level_sublevel");
std::string str_level = action_data.getValueAsString("load_level").c_str();
// load the level
cLevel* level = pLevel_Manager->Load(str_level, loading_sublevel);
if (level) {
pLevel_Manager->Set_Active(level);
level->Init();
if (action_data.exists("load_level_entry")) {
std::string str_entry = action_data.getValueAsString("load_level_entry").c_str();
cLevel_Entry* entry = level->Get_Entry(str_entry);
// set camera position to show the entry
if (entry) {
// set position
pLevel_Player->Set_Pos(entry->Get_Player_Pos_X(), entry->Get_Player_Pos_Y());
// center camera position
pActive_Camera->Center();
// set invisible for warp animation
pLevel_Player->Set_Active(0);
}
else if (!str_entry.empty()) {
printf("Warning : Level entry %s not found\n", str_entry.c_str());
}
}
}
// loading failed
else {
printf("Error : Level not found %s\n", str_level.c_str());
pHud_Debug->Set_Text(_("Loading Level failed : ") + str_level);
pLevel_Manager->Finish_Level();
}
}
if (action_data.exists("load_savegame")) {
pSavegame->Load_Game(action_data.getValueAsInteger("load_savegame"));
}
if (action_data.exists("play_music")) {
pAudio->Play_Music(action_data.getValueAsString("play_music").c_str(), action_data.getValueAsInteger("music_loops"), action_data.getValueAsBool("music_force", 1), action_data.getValueAsInteger("music_fadein"));
}
if (action_data.exists("screen_fadeout")) {
Draw_Effect_Out(static_cast<Effect_Fadeout>(action_data.getValueAsInteger("screen_fadeout")), action_data.getValueAsFloat("screen_fadeout_speed", 1));
}
if (action_data.exists("screen_fadein")) {
Draw_Effect_In(static_cast<Effect_Fadein>(action_data.getValueAsInteger("screen_fadein")), action_data.getValueAsFloat("screen_fadein_speed", 1));
}
if (action_data.exists("activate_level_entry")) {
std::string str_entry = action_data.getValueAsString("activate_level_entry").c_str();
cLevel_Entry* entry = pActive_Level->Get_Entry(str_entry);
//.........这里部分代码省略.........