void CUIChatWnd::Init(CUIXml& uiXml) { UIPrefix = UIHelper::CreateTextWnd(uiXml, "chat_prefix", this); inprogress_prefix_rect = UIPrefix->GetWndRect(); UIEditBox = UIHelper::CreateEditBox(uiXml, "chat_edit_box", this); inprogress_edit_rect = UIEditBox->GetWndRect(); UIEditBox->SetWindowName ("chat_edit_box"); pendingGameMode = false; R_ASSERT( uiXml.NavigateToNode(CHAT_PREFIX_PENDING)); R_ASSERT( uiXml.NavigateToNode(CHAT_EDITBOX_PENDING)); pending_prefix_rect.x1 = uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "x"); pending_prefix_rect.y1 = uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "y"); pending_prefix_rect.x2 = uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "width"); pending_prefix_rect.y2 = uiXml.ReadAttribFlt(CHAT_PREFIX_PENDING, 0, "height"); pending_prefix_rect.rb.add (pending_prefix_rect.lt); pending_edit_rect.x1 = uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "x"); pending_edit_rect.y1 = uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "y"); pending_edit_rect.x2 = uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "width"); pending_edit_rect.y2 = uiXml.ReadAttribFlt(CHAT_EDITBOX_PENDING, 0, "height"); pending_edit_rect.rb.add (pending_edit_rect.lt); Register (UIEditBox); AddCallback (UIEditBox, EDIT_TEXT_COMMIT, CUIWndCallback::void_function( this, &CUIChatWnd::OnChatCommit ) ); AddCallback (UIEditBox, EDIT_TEXT_CANCEL, CUIWndCallback::void_function( this, &CUIChatWnd::OnChatCancel ) ); }
void CUIActorInfoWnd::FillPointsDetail(const shared_str& id) { UIDetailList->Clear (); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH,ACTOR_STATISTIC_XML); uiXml.SetLocalRoot (uiXml.NavigateToNode("actor_stats_wnd",0)); string512 path; sprintf_s (path,"detail_part_%s",id.c_str()); XML_NODE* n = uiXml.NavigateToNode(path,0); if(!n) sprintf_s (path,"detail_part_def"); #pragma todo("implement this") /* string256 str; sprintf_s (str,"st_detail_list_for_%s", id.c_str()); UIInfoHeader->GetTitleStatic()->SetTextST (str); */ SStatSectionData& section = Actor()-> StatisticMgr().GetSection(id); vStatDetailData::const_iterator it = section.data.begin(); vStatDetailData::const_iterator it_e = section.data.end(); int _cntr = 0; string64 buff; for(;it!=it_e;++it,++_cntr) { CUIActorStaticticDetail* itm = xr_new<CUIActorStaticticDetail>(); itm->Init (&uiXml, path, 0); sprintf_s (buff,"%d.",_cntr); itm->m_text0->SetText (buff); itm->m_text1->SetTextST (*CStringTable().translate((*it).key)); itm->m_text1->AdjustHeightToText (); if( 0==(*it).str_value.size() ) { sprintf_s (buff,"x%d", (*it).int_count); itm->m_text2->SetTextST (buff); sprintf_s (buff,"%d", (*it).int_points); itm->m_text3->SetTextST (buff); }else { itm->m_text2->SetTextST ((*it).str_value.c_str()); itm->m_text3->SetTextST (""); } Fvector2 sz = itm->GetWndSize(); float _height; _height = _max(sz.y, itm->m_text1->GetWndPos().y+itm->m_text1->GetWndSize().y+3); sz.y = _height; itm->SetWndSize (sz); UIDetailList->AddWindow (itm, true); } }
void CUIStatsListItem::XmlInit(const char *path, CUIXml &uiXml) { CUIXmlInit xml_init; // CUIStatic *pStatic; CUIButton *pButton; string256 buf; strconcat(sizeof(buf),buf, path, ":static"); int tabsCount = uiXml.GetNodesNum(path, 0, "static"); XML_NODE* tab_node = uiXml.NavigateToNode(path,0); uiXml.SetLocalRoot(tab_node); for (int i = 0; i < tabsCount; ++i) { pButton = new CUIButton(); pButton->SetAutoDelete(true); xml_init.InitStatic(uiXml, "static", i, pButton); pButton->SetTextAlignment(CGameFont::alLeft); AttachChild(pButton); FieldsVector.push_back(pButton); } FieldsVector[0]->SetEllipsis(1, 0); }
void CUIConditionParams::InitFromXml(CUIXml& xml_doc) { if (!xml_doc.NavigateToNode("condition_params", 0)) return; CUIXmlInit::InitWindow (xml_doc, "condition_params", 0, this); CUIXmlInit::InitStatic ( xml_doc, "condition_params:caption", 0, &m_text ); m_progress.InitFromXml ( xml_doc, "condition_params:progress_state" ); }
void UITaskListWnd::init_from_xml( CUIXml& xml, LPCSTR path ) { VERIFY( hint_wnd ); CUIXmlInit::InitWindow( xml, path, 0, this ); XML_NODE* stored_root = xml.GetLocalRoot(); XML_NODE* tmpl_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( tmpl_root ); m_background = UIHelper::CreateFrameWindow( xml, "background_frame", this ); m_caption = UIHelper::CreateStatic( xml, "t_caption", this ); // m_counter = UIHelper::CreateStatic( xml, "t_counter", this ); m_bt_close = UIHelper::Create3tButton( xml, "btn_close", this ); Register( m_bt_close ); AddCallback( m_bt_close, BUTTON_DOWN, CUIWndCallback::void_function( this, &UITaskListWnd::OnBtnClose ) ); m_list = xr_new<CUIScrollView>(); m_list->SetAutoDelete( true ); AttachChild( m_list ); CUIXmlInit::InitScrollView( xml, "task_list", 0, m_list ); m_orig_h = GetHeight(); m_list->SetWindowName("---second_task_list"); m_list->m_sort_function = fastdelegate::MakeDelegate( this, &UITaskListWnd::SortingLessFunction ); xml.SetLocalRoot( stored_root ); }
void CUIWpnParams::InitFromXml(CUIXml& xml_doc) { if (!xml_doc.NavigateToNode("wpn_params", 0)) return; CUIXmlInit::InitWindow (xml_doc, "wpn_params", 0, this); CUIXmlInit::InitStatic (xml_doc, "wpn_params:prop_line", 0, &m_Prop_line); CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_accuracy", 0, &m_icon_acc); CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_damage", 0, &m_icon_dam); CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_handling", 0, &m_icon_han); CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_rpm", 0, &m_icon_rpm); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_accuracy", 0, &m_textAccuracy); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_damage", 0, &m_textDamage); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_handling", 0, &m_textHandling); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_rpm", 0, &m_textRPM); m_progressAccuracy.InitFromXml ( xml_doc, "wpn_params:progress_accuracy" ); m_progressDamage.InitFromXml ( xml_doc, "wpn_params:progress_damage" ); m_progressHandling.InitFromXml ( xml_doc, "wpn_params:progress_handling" ); m_progressRPM.InitFromXml ( xml_doc, "wpn_params:progress_rpm" ); if(IsGameTypeSingle()) { CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_ammo", 0, &m_stAmmo); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_ammo_count", 0, &m_textAmmoCount); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_ammo_count2", 0, &m_textAmmoCount2); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_ammo_types", 0, &m_textAmmoTypes); CUIXmlInit::InitTextWnd (xml_doc, "wpn_params:cap_ammo_used_type", 0, &m_textAmmoUsedType); CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_ammo_type1", 0, &m_stAmmoType1); CUIXmlInit::InitStatic (xml_doc, "wpn_params:static_ammo_type2", 0, &m_stAmmoType2); } }
void CUIStalkersRankingWnd::FillList() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH,STALKERS_RANKING_XML); UIList->Clear (); uiXml.SetLocalRoot (uiXml.NavigateToNode("stalkers_list",0)); if(g_all_statistic_humans.size()) { CSE_ALifeTraderAbstract* pActorAbstract = ch_info_get_from_id(Actor()->ID()); int actor_place = get_actor_ranking(); int sz = _min(g_all_statistic_humans.size(),20); for(int i=0; i<sz; ++i){ CSE_ALifeTraderAbstract* pT = (g_all_statistic_humans[i]).trader; if(pT==pActorAbstract || (i==19&&actor_place>19) ){ AddActorItem (&uiXml, actor_place+1, pActorAbstract); }else{ AddStalkerItem (&uiXml, i+1, pT); } } UIList->SetSelected (UIList->GetItem(0) ); }else{ CUIStalkerRankingInfoItem* itm = xr_new<CUIStalkerRankingInfoItem>(this); itm->Init (&uiXml, "no_items", 0); UIList->AddWindow (itm, true); } }
void ui_actor_state_wnd::init_from_xml( CUIXml& xml, LPCSTR path ) { XML_NODE* stored_root = xml.GetLocalRoot(); CUIXmlInit::InitWindow( xml, path, 0, this ); XML_NODE* new_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( new_root ); m_hint_wnd = UIHelper::CreateHint( xml, "hint_wnd" ); for ( int i = 0; i < stt_count; ++i ) { m_state[i] = xr_new<ui_actor_state_item>(); m_state[i]->SetAutoDelete( true ); AttachChild( m_state[i] ); m_state[i]->set_hint_wnd( m_hint_wnd ); } // m_state[stt_stamina]->init_from_xml( xml, "stamina_state" ); m_state[stt_health]->init_from_xml( xml, "health_state"); m_state[stt_bleeding]->init_from_xml( xml, "bleeding_state"); m_state[stt_radiation]->init_from_xml( xml, "radiation_state"); // m_state[stt_armor]->init_from_xml( xml, "armor_state"); // m_state[stt_main]->init_from_xml( xml, "main_sensor"); m_state[stt_fire]->init_from_xml( xml, "fire_sensor"); m_state[stt_radia]->init_from_xml( xml, "radia_sensor"); m_state[stt_acid ]->init_from_xml( xml, "acid_sensor"); m_state[stt_psi]->init_from_xml( xml, "psi_sensor"); m_state[stt_wound]->init_from_xml( xml, "wound_sensor"); m_state[stt_fire_wound]->init_from_xml( xml, "fire_wound_sensor"); m_state[stt_shock]->init_from_xml( xml, "shock_sensor"); m_state[stt_power]->init_from_xml( xml, "power_sensor"); xml.SetLocalRoot( stored_root ); }
void ui_actor_state_item::init_from_xml( CUIXml& xml, LPCSTR path ) { CUIXmlInit::InitWindow( xml, path, 0, this); XML_NODE* stored_root = xml.GetLocalRoot(); XML_NODE* new_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( new_root ); LPCSTR hint_text = xml.Read( "hint_text", 0, "no hint" ); set_hint_text_ST( hint_text ); set_hint_delay( (u32)xml.ReadAttribInt( "hint_text", 0, "delay" ) ); if ( xml.NavigateToNode( "state_progress", 0 ) ) { m_progress = UIHelper::CreateProgressBar( xml, "state_progress", this ); } if ( xml.NavigateToNode( "progress_shape", 0 ) ) { m_sensor = xr_new<CUIProgressShape>(); AttachChild( m_sensor ); m_sensor->SetAutoDelete( true ); CUIXmlInit::InitProgressShape( xml, "progress_shape", 0, m_sensor ); } if ( xml.NavigateToNode( "arrow", 0 ) ) { m_arrow = xr_new<UI_Arrow>(); m_arrow->init_from_xml( xml, "arrow", this ); } if ( xml.NavigateToNode( "arrow_shadow", 0 ) ) { m_arrow_shadow = xr_new<UI_Arrow>(); m_arrow_shadow->init_from_xml( xml, "arrow_shadow", this ); } if ( xml.NavigateToNode( "icon", 0 ) ) { m_static = UIHelper::CreateStatic( xml, "icon", this ); // m_magnitude = xml.ReadAttribFlt( "icon", 0, "magnitude", 1.0f ); m_static->TextItemControl()->SetText(""); } if ( xml.NavigateToNode( "icon2", 0 ) ) { m_static2 = UIHelper::CreateStatic( xml, "icon2", this ); m_static2->TextItemControl()->SetText(""); } if ( xml.NavigateToNode( "icon3", 0 ) ) { m_static3 = UIHelper::CreateStatic( xml, "icon3", this ); m_static3->TextItemControl()->SetText(""); } set_arrow( 0.0f ); xml.SetLocalRoot( stored_root ); }
void CUICharacterInfo::Init_StrInfoItem( CUIXml& xml_doc, LPCSTR item_str, UIItemType type ) { if ( xml_doc.NavigateToNode( item_str, 0 ) ) { CUIStatic* pItem = m_icons[type] = xr_new<CUIStatic>(); CUIXmlInit::InitStatic( xml_doc, item_str, 0, pItem ); AttachChild( pItem ); pItem->SetAutoDelete( true ); } }
void CUIMessagesWindow::Init(float x, float y, float width, float height) { CUIXml xml; xml.Load (CONFIG_PATH, UI_PATH, "messages_window.xml"); m_pGameLog = xr_new<CUIGameLog>(); m_pGameLog->SetAutoDelete (true); m_pGameLog->Show (true); AttachChild (m_pGameLog); if ( IsGameTypeSingle() ) { CUIXmlInit::InitScrollView (xml, "sp_log_list", 0, m_pGameLog); } else { u32 color; CGameFont* pFont; m_pChatLog = xr_new<CUIGameLog>(); m_pChatLog->SetAutoDelete (true); m_pChatLog->Show (true); AttachChild (m_pChatLog); m_pChatWnd = xr_new<CUIChatWnd>(); m_pChatWnd->SetAutoDelete (true); AttachChild (m_pChatWnd); CUIXmlInit::InitScrollView (xml, "mp_log_list", 0, m_pGameLog); CUIXmlInit::InitFont (xml, "mp_log_list:font", 0, color, pFont); m_pGameLog->SetTextAtrib (pFont, color); CUIXmlInit::InitScrollView (xml, "chat_log_list", 0, m_pChatLog); m_inprogress_chat_log_rect = m_pChatLog->GetWndRect(); m_in_pending_mode = false; XML_NODE* pending_chat_list = xml.NavigateToNode(CHAT_LOG_LIST_PENDING); if (pending_chat_list) { m_pending_chat_log_rect.x1 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "x"); m_pending_chat_log_rect.y1 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "y"); m_pending_chat_log_rect.x2 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "width"); m_pending_chat_log_rect.y2 = xml.ReadAttribFlt(CHAT_LOG_LIST_PENDING, 0, "height"); m_pending_chat_log_rect.rb.add (m_pending_chat_log_rect.lt); }else m_pending_chat_log_rect = m_inprogress_chat_log_rect; CUIXmlInit::InitFont (xml, "chat_log_list:font", 0, color, pFont); m_pChatLog->SetTextAtrib (pFont, color); m_pChatWnd->Init (xml); } }
void UIPlayerItem::Init(CUIXml& uiXml, LPCSTR playerNode, int index) { CUIXmlInit::InitWindow(uiXml, playerNode, index, this); m_player_node_root = uiXml.NavigateToNode(playerNode, index); VERIFY2(m_player_node_root, "player item in team xml node not initialized"); XML_NODE* prev_root = uiXml.GetLocalRoot(); uiXml.SetLocalRoot(m_player_node_root); InitTextParams(uiXml); InitIconParams(uiXml); uiXml.SetLocalRoot(prev_root); }
void CUIWpnParams::InitFromXml(CUIXml& xml_doc) { if (!xml_doc.NavigateToNode("wpn_params", 0)) return; CUIXmlInit::InitWindow (xml_doc, "wpn_params", 0, this); CUIXmlInit::InitStatic (xml_doc, "wpn_params:cap_accuracy", 0, &m_textAccuracy); CUIXmlInit::InitStatic (xml_doc, "wpn_params:cap_damage", 0, &m_textDamage); CUIXmlInit::InitStatic (xml_doc, "wpn_params:cap_handling", 0, &m_textHandling); CUIXmlInit::InitStatic (xml_doc, "wpn_params:cap_rpm", 0, &m_textRPM); m_progressAccuracy.InitFromXml ( xml_doc, "wpn_params:progress_accuracy" ); m_progressDamage.InitFromXml ( xml_doc, "wpn_params:progress_damage" ); m_progressHandling.InitFromXml ( xml_doc, "wpn_params:progress_handling" ); m_progressRPM.InitFromXml ( xml_doc, "wpn_params:progress_rpm" ); }
void CUIStatsPlayerList::Init(CUIXml& xml_doc, LPCSTR path) { // init window CUIXmlInit::InitScrollView (xml_doc, path, 0, this); SetFixedScrollBar (false); m_bStatus_mode = xml_doc.ReadAttribInt(path,0,"status_mode",0)? true: false; m_bSpectator = xml_doc.ReadAttribInt(path,0,"spectator",0)? true: m_bStatus_mode; SetSpectator (m_bSpectator); // init item structure int tabsCount = xml_doc.GetNodesNum(path, 0, "field"); XML_NODE* tab_node = xml_doc.NavigateToNode(path,0); xml_doc.SetLocalRoot (tab_node); for (int i = 0; i < tabsCount; ++i) { LPCSTR name = xml_doc.ReadAttrib("field",i,"name"); float width = xml_doc.ReadAttribFlt("field",i,"width"); if (0 == xr_strcmp(name, "artefacts") && GameID() != eGameIDArtefactHunt) continue; AddField (name,width); } xml_doc.SetLocalRoot (xml_doc.GetRoot()); string256 _path; // init item text params CUIXmlInit::InitFont (xml_doc, strconcat(sizeof(_path),_path, path, ":text_format"), 0, m_i.c, m_i.f); m_i.h = xml_doc.ReadAttribFlt(strconcat(sizeof(_path),_path, path, ":text_format"), 0, "height", 25); // init list header switch (GameID()) { case eGameIDCaptureTheArtefact: case eGameIDArtefactHunt: case eGameIDTeamDeathmatch: if (!m_bSpectator || m_bStatus_mode) InitTeamHeader(xml_doc, path); case eGameIDDeathmatch: InitHeader(xml_doc, path); default: break; } }
void CUIArtefactParams::InitFromXml(CUIXml& xml_doc) { LPCSTR _base = "af_params"; if (!xml_doc.NavigateToNode(_base, 0)) return; string256 _buff; CUIXmlInit::InitWindow (xml_doc, _base, 0, this); for(u32 i=_item_start; i<_max_item_index; ++i) { m_info_items[i] = xr_new<CUIStatic>(); CUIStatic* _s = m_info_items[i]; _s->SetAutoDelete (false); strconcat (sizeof(_buff),_buff, _base, ":static_", af_item_sect_names[i]); CUIXmlInit::InitStatic (xml_doc, _buff, 0, _s); } }
void UIPlayerItem::InitIconParams(CUIXml& uiXml) { VERIFY(m_player_node_root); int temp_number = uiXml.GetNodesNum(m_player_node_root, ICONPARAM_NODE_NAME); for (int i = 0; i < temp_number; ++i) { XML_NODE* icon_param_node = uiXml.NavigateToNode(ICONPARAM_NODE_NAME, i); if (!icon_param_node) break; LPCSTR param_name = uiXml.ReadAttrib(icon_param_node, "name", "param_name_not_set_in_name_attribute"); CUIStatic* temp_static = new CUIStatsIcon(); VERIFY(temp_static); this->AttachChild(temp_static); temp_static->SetAutoDelete(true); CUIXmlInit::InitStatic(uiXml, ICONPARAM_NODE_NAME, i, temp_static); m_icon_params.insert(std::make_pair(shared_str(param_name), temp_static)); } }
void CUIArtefactDetectorElite::construct(CEliteDetector* p) { m_parent = p; CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "ui_detector_artefact.xml"); CUIXmlInit xml_init; string512 buff; xr_strcpy (buff, p->ui_xml_tag()); xml_init.InitWindow (uiXml, buff, 0, this); m_wrk_area = xr_new<CUIWindow>(); xr_sprintf (buff, "%s:wrk_area", p->ui_xml_tag()); xml_init.InitWindow (uiXml, buff, 0, m_wrk_area); m_wrk_area->SetAutoDelete (true); AttachChild (m_wrk_area); xr_sprintf (buff, "%s", p->ui_xml_tag()); int num = uiXml.GetNodesNum (buff,0,"palette"); XML_NODE* pStoredRoot = uiXml.GetLocalRoot(); uiXml.SetLocalRoot (uiXml.NavigateToNode(buff,0)); for(int idx=0; idx<num;++idx) { CUIStatic* S = xr_new<CUIStatic>(); shared_str name = uiXml.ReadAttrib("palette",idx,"id"); m_palette[name] = S; xml_init.InitStatic (uiXml, "palette", idx, S); S->SetAutoDelete (true); m_wrk_area->AttachChild (S); S->SetCustomDraw (true); } uiXml.SetLocalRoot (pStoredRoot); Fvector _map_attach_p = pSettings->r_fvector3(m_parent->cNameSect(), "ui_p"); Fvector _map_attach_r = pSettings->r_fvector3(m_parent->cNameSect(), "ui_r"); _map_attach_r.mul (PI/180.f); m_map_attach_offset.setHPB (_map_attach_r.x, _map_attach_r.y, _map_attach_r.z); m_map_attach_offset.translate_over (_map_attach_p); }
void UITeamState::Init(CUIXml& uiXml, LPCSTR teamNodeName, int index) { VERIFY(teamNodeName); mainUiXml = &uiXml; //warning ! teamXmlNode = uiXml.NavigateToNode(teamNodeName, index); VERIFY2(teamXmlNode, make_string("team xml node (%s) not found", teamNodeName).c_str()); CUIXmlInit::InitWindow(uiXml, teamNodeName, index, this); XML_NODE* tempRoot = uiXml.GetLocalRoot(); uiXml.SetLocalRoot(teamXmlNode); InitScrollPanels(); //CUIXmlInit::InitScrollView(uiXml, "scroll_panel", 0, myScrollList); //myTeamHeader->Init(uiXml, "team_header"); uiXml.SetLocalRoot(tempRoot); }
void CMMSound::Init(CUIXml& xml_doc, LPCSTR path){ string256 _path; m_bRandom = xml_doc.ReadAttribInt(path, 0, "random")? true : false; int nodes_num = xml_doc.GetNodesNum(path, 0, "menu_music"); XML_NODE* tab_node = xml_doc.NavigateToNode(path,0); xml_doc.SetLocalRoot(tab_node); for (int i = 0; i < nodes_num; ++i) m_play_list.push_back(xml_doc.Read("menu_music", i, "")); xml_doc.SetLocalRoot(xml_doc.GetRoot()); strconcat(sizeof(_path),_path, path,":whell_sound"); if (check_file(xml_doc.Read(_path, 0, ""))) m_whell.create(xml_doc.Read(_path, 0, "") ,st_Effect,sg_SourceType); strconcat(sizeof(_path),_path, path,":whell_click"); if (check_file(xml_doc.Read(_path, 0, ""))) m_whell_click.create(xml_doc.Read(_path, 0, ""),st_Effect,sg_SourceType ); }
void CUIMMShniaga::CreateList(xr_vector<CUIStatic*>& lst, CUIXml& xml_doc, LPCSTR path){ CGameFont* pF; u32 color; float button_height = xml_doc.ReadAttribFlt("button", 0, "h"); R_ASSERT (button_height); CUIXmlInit::InitFont (xml_doc, path, 0, color, pF); R_ASSERT (pF); int nodes_num = xml_doc.GetNodesNum(path, 0, "btn"); XML_NODE* tab_node = xml_doc.NavigateToNode(path,0); xml_doc.SetLocalRoot (tab_node); CUIStatic* st; for (int i = 0; i < nodes_num; ++i) { st = new CUIStatic(); st->SetWndPos (Fvector2().set(0,0)); st->SetWndSize (Fvector2().set(m_view->GetDesiredChildWidth(), button_height)); st->SetTextComplexMode (false); st->SetTextST (xml_doc.ReadAttrib ("btn", i, "caption")); if (pF) st->SetFont (pF); float font_height = st->GetFont()->GetHeight(); UI()->ClientToScreenScaledHeight(font_height); st->SetTextY ( (button_height-font_height)/2.0f ); st->SetTextColor (color); st->SetTextAlignment (CGameFont::alCenter); st->SetWindowName (xml_doc.ReadAttrib("btn", i, "name")); st->SetMessageTarget (this); lst.push_back(st); } xml_doc.SetLocalRoot(xml_doc.GetRoot()); }
void CUIPdaMsgListItem::Init(float x, float y, float width, float height) { CUIStatic::Init (x, y, width, height); CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH,PDA_MSG_MAINGAME_CHAR); R_ASSERT2 (xml_result, "xml file not found"); CUIXmlInit xml_init; AttachChild (&UIIcon); xml_init.InitStatic (uiXml, "icon_static", 0, &UIIcon); AttachChild(&UIName); if(uiXml.NavigateToNode ("name_static",0)) xml_init.InitStatic (uiXml, "name_static", 0, &UIName); else { UIName.Show (false); UIName.Enable (false); } AttachChild (&UIMsgText); xml_init.InitStatic (uiXml, "text_static", 0, &UIMsgText); }
void CCharacterInfo::load_shared (LPCSTR) { const ITEM_DATA& item_data = *id_to_index::GetById(m_ProfileId); CUIXml* pXML = item_data._xml; pXML->SetLocalRoot (pXML->GetRoot()); XML_NODE* item_node = pXML->NavigateToNode(id_to_index::tag_name, item_data.pos_in_file); R_ASSERT3(item_node, "profile id=", *item_data.id); pXML->SetLocalRoot(item_node); LPCSTR spec_char = pXML->Read("specific_character", 0, NULL); if(!spec_char) { data()->m_CharacterId = NULL; LPCSTR char_class = pXML->Read ("class", 0, NULL); if(char_class) { char* buf_str = xr_strdup(char_class); xr_strlwr(buf_str); data()->m_Class = buf_str; xr_free(buf_str); } else data()->m_Class = NO_CHARACTER_CLASS; data()->m_Rank = pXML->ReadInt ("rank", 0, NO_RANK); data()->m_Reputation = pXML->ReadInt ("reputation", 0, NO_REPUTATION); } else data()->m_CharacterId = spec_char; }
void CUIPdaListItem::Init(float x, float y, float width, float height) { inherited::Init (x, y, width, height); CUIXml uiXml; bool xml_result = uiXml.Init (CONFIG_PATH, UI_PATH, PDA_CONTACT_CHAR); R_ASSERT2 (xml_result, "xml file not found"); CUIXmlInit xml_init; UIInfo = xr_new<CUICharacterInfo> (); UIInfo->SetAutoDelete (true); AttachChild (UIInfo); UIInfo->Init (0, 0, width, height, PDA_CONTACT_CHAR); if (uiXml.NavigateToNode ("mask_frame_window", 0)) { UIMask = xr_new<CUIFrameWindow> (); UIMask->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "mask_frame_window", 0, UIMask); UIInfo->UIIcon().SetMask (UIMask); } xml_init.InitAutoStaticGroup (uiXml,"pda_char_auto_statics", 0, this); }
void CUISequencer::Start(LPCSTR tutor_name) { VERIFY(m_items.size()==0); Device.seqFrame.Add (this, REG_PRIORITY_LOW-10000); Device.seqRender.Add (this, 3); m_UIWindow = xr_new<CUIWindow>(); CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, "game_tutorials.xml"); int items_count = uiXml.GetNodesNum (tutor_name,0,"item"); VERIFY(items_count>0); uiXml.SetLocalRoot (uiXml.NavigateToNode(tutor_name,0)); m_bPlayEachItem = !!uiXml.ReadInt("play_each_item",0,0); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "global_wnd", 0, m_UIWindow); //. xml_init.InitAutoStaticGroup(uiXml, "global_wnd", m_UIWindow); for(int i=0;i<items_count;++i){ LPCSTR _tp = uiXml.ReadAttrib ("item",i,"type",""); bool bVideo = 0==_stricmp(_tp,"video"); CUISequenceItem* pItem = 0; if (bVideo) pItem = xr_new<CUISequenceVideoItem>(this); else pItem = xr_new<CUISequenceSimpleItem>(this); m_items.push_back (pItem); pItem->Load (&uiXml,i); } CUISequenceItem* pCurrItem = m_items.front(); pCurrItem->Start (); m_pStoredInputReceiver = pInput->CurrentIR(); IR_Capture (); m_bActive = true; }
void CUITextureMaster::ParseShTexInfo(LPCSTR xml_file) { CUIXml xml; xml.Load (CONFIG_PATH, "ui\\textures_descr", xml_file); int files_num = xml.GetNodesNum("",0,"file"); for(int fi=0; fi<files_num; ++fi) { XML_NODE* root_node = xml.GetLocalRoot(); shared_str file = xml.ReadAttrib("file", fi, "name"); XML_NODE* node = xml.NavigateToNode("file", fi); //. Msg("-%s",file.c_str()); int num = xml.GetNodesNum(node, "texture"); for (int i = 0; i<num; i++) { TEX_INFO info; info.file = file; info.rect.x1 = xml.ReadAttribFlt(node, "texture",i,"x"); info.rect.x2 = xml.ReadAttribFlt(node, "texture",i,"width") + info.rect.x1; info.rect.y1 = xml.ReadAttribFlt(node, "texture",i,"y"); info.rect.y2 = xml.ReadAttribFlt(node, "texture",i,"height") + info.rect.y1; shared_str id = xml.ReadAttrib (node, "texture",i,"id"); //. Msg("--%s",id.c_str()); m_textures.insert(mk_pair(id,info)); } xml.SetLocalRoot (root_node); } }
void CUIMainIngameWnd::Init() { CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, MAININGAME_XML); CUIXmlInit xml_init; CUIWindow::Init (0,0, UI_BASE_WIDTH, UI_BASE_HEIGHT); Enable(false); AttachChild (&UIStaticHealth); xml_init.InitStatic (uiXml, "static_health", 0, &UIStaticHealth); AttachChild (&UIStaticArmor); xml_init.InitStatic (uiXml, "static_armor", 0, &UIStaticArmor); AttachChild (&UIWeaponBack); xml_init.InitStatic (uiXml, "static_weapon", 0, &UIWeaponBack); UIWeaponBack.AttachChild (&UIWeaponSignAmmo); xml_init.InitStatic (uiXml, "static_ammo", 0, &UIWeaponSignAmmo); UIWeaponSignAmmo.SetElipsis (CUIStatic::eepEnd, 2); UIWeaponBack.AttachChild (&UIWeaponIcon); xml_init.InitStatic (uiXml, "static_wpn_icon", 0, &UIWeaponIcon); UIWeaponIcon.SetShader (GetEquipmentIconsShader()); UIWeaponIcon_rect = UIWeaponIcon.GetWndRect(); //--------------------------------------------------------- AttachChild (&UIPickUpItemIcon); xml_init.InitStatic (uiXml, "pick_up_item", 0, &UIPickUpItemIcon); UIPickUpItemIcon.SetShader (GetEquipmentIconsShader()); UIPickUpItemIcon.Show (false); m_iPickUpItemIconWidth = UIPickUpItemIcon.GetWidth(); m_iPickUpItemIconHeight = UIPickUpItemIcon.GetHeight(); m_iPickUpItemIconX = UIPickUpItemIcon.GetWndRect().left; m_iPickUpItemIconY = UIPickUpItemIcon.GetWndRect().top; //--------------------------------------------------------- UIWeaponIcon.Enable (false); //индикаторы UIZoneMap->Init (); UIZoneMap->SetScale (DEFAULT_MAP_SCALE); if(IsGameTypeSingle()) { xml_init.InitStatic (uiXml, "static_pda_online", 0, &UIPdaOnline); UIZoneMap->Background().AttachChild (&UIPdaOnline); } //Полоса прогресса здоровья UIStaticHealth.AttachChild (&UIHealthBar); //. xml_init.InitAutoStaticGroup(uiXml,"static_health", &UIStaticHealth); xml_init.InitProgressBar (uiXml, "progress_bar_health", 0, &UIHealthBar); //Полоса прогресса армора UIStaticArmor.AttachChild (&UIArmorBar); //. xml_init.InitAutoStaticGroup(uiXml,"static_armor", &UIStaticArmor); xml_init.InitProgressBar (uiXml, "progress_bar_armor", 0, &UIArmorBar); // Подсказки, которые возникают при наведении прицела на объект AttachChild (&UIStaticQuickHelp); xml_init.InitStatic (uiXml, "quick_info", 0, &UIStaticQuickHelp); uiXml.SetLocalRoot (uiXml.GetRoot()); m_UIIcons = xr_new<CUIScrollView>(); m_UIIcons->SetAutoDelete(true); xml_init.InitScrollView (uiXml, "icons_scroll_view", 0, m_UIIcons); AttachChild (m_UIIcons); // Загружаем иконки if(IsGameTypeSingle()) { xml_init.InitStatic (uiXml, "starvation_static", 0, &UIStarvationIcon); UIStarvationIcon.Show (false); xml_init.InitStatic (uiXml, "psy_health_static", 0, &UIPsyHealthIcon); UIPsyHealthIcon.Show (false); } xml_init.InitStatic (uiXml, "weapon_jammed_static", 0, &UIWeaponJammedIcon); UIWeaponJammedIcon.Show (false); xml_init.InitStatic (uiXml, "radiation_static", 0, &UIRadiaitionIcon); UIRadiaitionIcon.Show (false); xml_init.InitStatic (uiXml, "wound_static", 0, &UIWoundIcon); UIWoundIcon.Show (false); xml_init.InitStatic (uiXml, "invincible_static", 0, &UIInvincibleIcon); UIInvincibleIcon.Show (false); if(GameID()==GAME_ARTEFACTHUNT){ xml_init.InitStatic (uiXml, "artefact_static", 0, &UIArtefactIcon); UIArtefactIcon.Show (false); } shared_str warningStrings[6] = { "jammed", "radiation", "wounds", "starvation", "fatigue", "invincible" }; // Загружаем пороговые значения для индикаторов EWarningIcons j = ewiWeaponJammed; while (j < ewiInvincible) { // Читаем данные порогов для каждого индикатора shared_str cfgRecord = pSettings->r_string("main_ingame_indicators_thresholds", *warningStrings[static_cast<int>(j) - 1]); u32 count = _GetItemCount(*cfgRecord); char singleThreshold[8]; float f = 0; for (u32 k = 0; k < count; ++k) { _GetItem(*cfgRecord, k, singleThreshold); sscanf(singleThreshold, "%f", &f); m_Thresholds[j].push_back(f); } j = static_cast<EWarningIcons>(j + 1); } // Flashing icons initialize uiXml.SetLocalRoot (uiXml.NavigateToNode("flashing_icons")); InitFlashingIcons (&uiXml); uiXml.SetLocalRoot (uiXml.GetRoot()); AttachChild (&UICarPanel); xml_init.InitWindow (uiXml, "car_panel", 0, &UICarPanel); AttachChild (&UIMotionIcon); UIMotionIcon.Init (); if(IsGameTypeSingle()) { m_artefactPanel->InitFromXML (uiXml, "artefact_panel", 0); this->AttachChild (m_artefactPanel); } AttachChild (&UIStaticDiskIO); UIStaticDiskIO.SetWndRect (1000,750,16,16); UIStaticDiskIO.GetUIStaticItem().SetRect(0,0,16,16); UIStaticDiskIO.InitTexture ("ui\\ui_disk_io"); UIStaticDiskIO.SetOriginalRect (0,0,32,32); UIStaticDiskIO.SetStretchTexture (TRUE); HUD_SOUND::LoadSound ("maingame_ui", "snd_new_contact" , m_contactSnd , SOUND_TYPE_IDLE); }
void CUIHudStatesWnd::InitFromXml( CUIXml& xml, LPCSTR path ) { CUIXmlInit::InitWindow( xml, path, 0, this ); XML_NODE* stored_root = xml.GetLocalRoot(); XML_NODE* new_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( new_root ); m_back = UIHelper::CreateStatic( xml, "back", this ); m_ui_health_bar = UIHelper::CreateProgressBar( xml, "progress_bar_health", this ); m_ui_stamina_bar = UIHelper::CreateProgressBar( xml, "progress_bar_stamina", this ); // m_back_v = UIHelper::CreateStatic( xml, "back_v", this ); // m_static_armor = UIHelper::CreateStatic( xml, "static_armor", this ); /* m_resist_back[ALife::infl_rad] = UIHelper::CreateStatic( xml, "resist_back_rad", this ); m_resist_back[ALife::infl_fire] = UIHelper::CreateStatic( xml, "resist_back_fire", this ); m_resist_back[ALife::infl_acid] = UIHelper::CreateStatic( xml, "resist_back_acid", this ); m_resist_back[ALife::infl_psi] = UIHelper::CreateStatic( xml, "resist_back_psi", this ); // electra = no has CStatic!! */ m_indik[ALife::infl_rad] = UIHelper::CreateStatic( xml, "indik_rad", this ); m_indik[ALife::infl_fire] = UIHelper::CreateStatic( xml, "indik_fire", this ); m_indik[ALife::infl_acid] = UIHelper::CreateStatic( xml, "indik_acid", this ); m_indik[ALife::infl_psi] = UIHelper::CreateStatic( xml, "indik_psi", this ); // m_lanim_name = xml.ReadAttrib( "indik_rad", 0, "light_anim", "" ); m_ui_weapon_cur_ammo = UIHelper::CreateTextWnd( xml, "static_cur_ammo", this ); m_ui_weapon_fmj_ammo = UIHelper::CreateTextWnd( xml, "static_fmj_ammo", this ); m_ui_weapon_ap_ammo = UIHelper::CreateTextWnd( xml, "static_ap_ammo", this ); m_fire_mode = UIHelper::CreateTextWnd( xml, "static_fire_mode", this ); m_ui_grenade = UIHelper::CreateTextWnd( xml, "static_grenade", this ); m_ui_weapon_icon = UIHelper::CreateStatic( xml, "static_wpn_icon", this ); m_ui_weapon_icon->SetShader( InventoryUtilities::GetEquipmentIconsShader() ); // m_ui_weapon_icon->Enable ( false ); m_ui_weapon_icon_rect = m_ui_weapon_icon->GetWndRect(); // m_ui_armor_bar = UIHelper::CreateProgressBar( xml, "progress_bar_armor", this ); // m_progress_self = xr_new<CUIProgressShape>(); // m_progress_self->SetAutoDelete(true); // AttachChild( m_progress_self ); // CUIXmlInit::InitProgressShape( xml, "progress", 0, m_progress_self ); // m_arrow = xr_new<UI_Arrow>(); // m_arrow_shadow = xr_new<UI_Arrow>(); // m_arrow->init_from_xml( xml, "arrow", this ); // m_arrow_shadow->init_from_xml( xml, "arrow_shadow", this ); // m_back_over_arrow = UIHelper::CreateStatic( xml, "back_over_arrow", this ); /* m_bleeding_lev1 = UIHelper::CreateStatic( xml, "bleeding_level_1", this ); m_bleeding_lev1->Show( false ); m_bleeding_lev2 = UIHelper::CreateStatic( xml, "bleeding_level_2", this ); m_bleeding_lev2->Show( false ); m_bleeding_lev3 = UIHelper::CreateStatic( xml, "bleeding_level_3", this ); m_bleeding_lev3->Show( false ); m_radiation_lev1 = UIHelper::CreateStatic( xml, "radiation_level_1", this ); m_radiation_lev1->Show( false ); m_radiation_lev2 = UIHelper::CreateStatic( xml, "radiation_level_2", this ); m_radiation_lev2->Show( false ); m_radiation_lev3 = UIHelper::CreateStatic( xml, "radiation_level_3", this ); m_radiation_lev3->Show( false ); for ( int i = 0; i < it_max; ++i ) { m_cur_state_LA[i] = true; SwitchLA( false, (ALife::EInfluenceType)i ); } */ xml.SetLocalRoot( stored_root ); }
void CUIInventoryWnd::Init() { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, INVENTORY_XML); R_ASSERT3 (xml_result, "file parsing error ", uiXml.m_xml_file_name); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main", 0, this); AttachChild (&UIBeltSlots); xml_init.InitStatic (uiXml, "belt_slots", 0, &UIBeltSlots); AttachChild (&UIBack); xml_init.InitStatic (uiXml, "back", 0, &UIBack); AttachChild (&UIStaticBottom); xml_init.InitStatic (uiXml, "bottom_static", 0, &UIStaticBottom); AttachChild (&UIBagWnd); xml_init.InitStatic (uiXml, "bag_static", 0, &UIBagWnd); AttachChild (&UIMoneyWnd); xml_init.InitStatic (uiXml, "money_static", 0, &UIMoneyWnd); AttachChild (&UIDescrWnd); xml_init.InitStatic (uiXml, "descr_static", 0, &UIDescrWnd); #ifndef INV_FLOAT_ITEM_INFO UIDescrWnd.AttachChild (&UIItemInfo); UIItemInfo.Init (0, 0, UIDescrWnd.GetWidth(), UIDescrWnd.GetHeight(), INVENTORY_ITEM_XML); #endif #ifdef INV_NEW_SLOTS_SYSTEM if (GameID() == GAME_SINGLE){ AttachChild (&UISleepWnd); UISleepWnd.Init(); UISleepWnd.SetWindowName("sleep_wnd"); // дл¤ лучшего нахождени¤ через GetStatic } #endif AttachChild (&UIPersonalWnd); xml_init.InitFrameWindow (uiXml, "character_frame_window", 0, &UIPersonalWnd); AttachChild (&UIProgressBack); xml_init.InitStatic (uiXml, "progress_background", 0, &UIProgressBack); if (GameID() != GAME_SINGLE){ AttachChild (&UIProgressBack_rank); xml_init.InitStatic (uiXml, "progress_back_rank", 0, &UIProgressBack_rank); UIProgressBack_rank.AttachChild (&UIProgressBarRank); xml_init.InitProgressBar (uiXml, "progress_bar_rank", 0, &UIProgressBarRank); UIProgressBarRank.SetProgressPos(100); } UIProgressBack.AttachChild (&UIProgressBarHealth); xml_init.InitProgressBar (uiXml, "progress_bar_health", 0, &UIProgressBarHealth); UIProgressBack.AttachChild (&UIProgressBarPsyHealth); xml_init.InitProgressBar (uiXml, "progress_bar_psy", 0, &UIProgressBarPsyHealth); UIProgressBack.AttachChild (&UIProgressBarRadiation); xml_init.InitProgressBar (uiXml, "progress_bar_radiation", 0, &UIProgressBarRadiation); #ifdef INV_NEW_SLOTS_SYSTEM if (GameID() == GAME_SINGLE){ UIProgressBack.AttachChild (&UIProgressBarSatiety); xml_init.InitProgressBar (uiXml, "progress_bar_satiety", 0, &UIProgressBarSatiety); } #endif UIPersonalWnd.AttachChild (&UIStaticPersonal); xml_init.InitStatic (uiXml, "static_personal",0, &UIStaticPersonal); // UIStaticPersonal.Init (1, UIPersonalWnd.GetHeight() - 175, 260, 260); AttachChild (&UIOutfitInfo); UIOutfitInfo.InitFromXml (uiXml); //. xml_init.InitStatic (uiXml, "outfit_info_window",0, &UIOutfitInfo); //Ёлементы автоматического добавлени¤ xml_init.InitAutoStatic (uiXml, "auto_static", this); if (GameID() != GAME_SINGLE){ UIRankFrame = xr_new<CUIStatic> (); UIRankFrame->SetAutoDelete(true); UIRank = xr_new<CUIStatic> (); UIRank->SetAutoDelete(true); CUIXmlInit::InitStatic(uiXml, "rank", 0, UIRankFrame); CUIXmlInit::InitStatic(uiXml, "rank:pic", 0, UIRank); AttachChild(UIRankFrame); UIRankFrame->AttachChild(UIRank); } m_pUIBagList = xr_new<CUIDragDropListEx>(); UIBagWnd.AttachChild(m_pUIBagList); m_pUIBagList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_bag", 0, m_pUIBagList); BindDragDropListEnents (m_pUIBagList); m_pUIBeltList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIBeltList); m_pUIBeltList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_belt", 0, m_pUIBeltList); BindDragDropListEnents (m_pUIBeltList); #if defined(INV_OUTFIT_FULL_ICON_HIDE) m_pUIOutfitList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIOutfitList); m_pUIOutfitList->SetAutoDelete(true); #else m_pUIOutfitList = xr_new<CUIOutfitDragDropList>(); AttachChild(m_pUIOutfitList); m_pUIOutfitList->SetAutoDelete(true); #endif xml_init.InitDragDropListEx (uiXml, "dragdrop_outfit", 0, m_pUIOutfitList); BindDragDropListEnents (m_pUIOutfitList); ZeroMemory(&m_slots_array, sizeof(m_slots_array)); #ifdef INV_NEW_SLOTS_SYSTEM m_pUIPistolList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPistolList); m_pUIPistolList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_slot_weapon_1", 0, m_pUIPistolList); BindDragDropListEnents(m_pUIPistolList); m_pUIAutomaticList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIAutomaticList); m_pUIAutomaticList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_slot_weapon_2", 0, m_pUIAutomaticList); BindDragDropListEnents(m_pUIAutomaticList); if (GameID() == GAME_SINGLE){ m_pUIKnifeList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIKnifeList); m_pUIKnifeList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_weapon_0", 0, m_pUIKnifeList); BindDragDropListEnents (m_pUIKnifeList); m_pUIBinocularList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIBinocularList); m_pUIBinocularList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_weapon_3", 0, m_pUIBinocularList); BindDragDropListEnents (m_pUIBinocularList); m_pUIDetectorList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIDetectorList); m_pUIDetectorList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_detector", 0, m_pUIDetectorList); BindDragDropListEnents (m_pUIDetectorList); m_pUITorchList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUITorchList); m_pUITorchList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_torch", 0, m_pUITorchList); BindDragDropListEnents (m_pUITorchList); m_pUIPDAList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPDAList); m_pUIPDAList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_pda", 0, m_pUIPDAList); BindDragDropListEnents (m_pUIPDAList); m_pUIHelmetList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIHelmetList); m_pUIHelmetList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_helmet", 0, m_pUIHelmetList); BindDragDropListEnents (m_pUIHelmetList); m_pUISlotQuickAccessList_0 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_0); m_pUISlotQuickAccessList_0->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_0", 0, m_pUISlotQuickAccessList_0); BindDragDropListEnents (m_pUISlotQuickAccessList_0); m_pUISlotQuickAccessList_1 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_1); m_pUISlotQuickAccessList_1->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_1", 0, m_pUISlotQuickAccessList_1); BindDragDropListEnents (m_pUISlotQuickAccessList_1); m_pUISlotQuickAccessList_2 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_2); m_pUISlotQuickAccessList_2->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_2", 0, m_pUISlotQuickAccessList_2); BindDragDropListEnents (m_pUISlotQuickAccessList_2); m_pUISlotQuickAccessList_3 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_3); m_pUISlotQuickAccessList_3->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_3", 0, m_pUISlotQuickAccessList_3); BindDragDropListEnents (m_pUISlotQuickAccessList_3); m_slots_array[KNIFE_SLOT] = m_pUIKnifeList; m_slots_array[APPARATUS_SLOT] = m_pUIBinocularList; m_slots_array[PDA_SLOT] = m_pUIPDAList; m_slots_array[DETECTOR_SLOT] = m_pUIDetectorList; m_slots_array[TORCH_SLOT] = m_pUITorchList; m_slots_array[HELMET_SLOT] = m_pUIHelmetList; m_slots_array[SLOT_QUICK_ACCESS_0] = m_pUISlotQuickAccessList_0; m_slots_array[SLOT_QUICK_ACCESS_1] = m_pUISlotQuickAccessList_1; m_slots_array[SLOT_QUICK_ACCESS_2] = m_pUISlotQuickAccessList_2; m_slots_array[SLOT_QUICK_ACCESS_3] = m_pUISlotQuickAccessList_3; } #else m_pUIPistolList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPistolList); m_pUIPistolList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_pistol", 0, m_pUIPistolList); BindDragDropListEnents(m_pUIPistolList); m_pUIAutomaticList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIAutomaticList); m_pUIAutomaticList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_automatic", 0, m_pUIAutomaticList); BindDragDropListEnents(m_pUIAutomaticList); #endif m_slots_array[PISTOL_SLOT] = m_pUIPistolList; m_slots_array[RIFLE_SLOT] = m_pUIAutomaticList; m_slots_array[OUTFIT_SLOT] = m_pUIOutfitList; m_slots_array[GRENADE_SLOT] = NULL; m_slots_array[BOLT_SLOT] = NULL; m_slots_array[ARTEFACT_SLOT] = NULL; // m_pUIBeltList; //pop-up menu AttachChild (&UIPropertiesBox); UIPropertiesBox.Init (0,0,300,300); UIPropertiesBox.Hide (); AttachChild (&UIStaticTime); xml_init.InitStatic (uiXml, "time_static", 0, &UIStaticTime); UIStaticTime.AttachChild (&UIStaticTimeString); xml_init.InitStatic (uiXml, "time_static_str", 0, &UIStaticTimeString); UIExitButton = xr_new<CUI3tButton>();UIExitButton->SetAutoDelete(true); AttachChild (UIExitButton); xml_init.Init3tButton (uiXml, "exit_button", 0, UIExitButton); #ifdef INV_FLOAT_ITEM_INFO AttachChild (&UIItemInfo); UIItemInfo.Init (INVENTORY_ITEM_XML); #endif //Load sounds XML_NODE* stored_root = uiXml.GetLocalRoot (); uiXml.SetLocalRoot (uiXml.NavigateToNode ("action_sounds",0)); ::Sound->create (sounds[eInvSndOpen], uiXml.Read("snd_open", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvSndClose], uiXml.Read("snd_close", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToSlot], uiXml.Read("snd_item_to_slot", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToBelt], uiXml.Read("snd_item_to_belt", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToRuck], uiXml.Read("snd_item_to_ruck", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvProperties], uiXml.Read("snd_properties", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvDropItem], uiXml.Read("snd_drop_item", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvAttachAddon], uiXml.Read("snd_attach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvDetachAddon], uiXml.Read("snd_detach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemUse], uiXml.Read("snd_item_use", 0, NULL),st_Effect,sg_SourceType); uiXml.SetLocalRoot (stored_root); }
void CInfoPortion::load_shared (LPCSTR) { const ITEM_DATA& item_data = *id_to_index::GetById(m_InfoId); CUIXml* pXML = item_data._xml; pXML->SetLocalRoot (pXML->GetRoot()); //loading from XML XML_NODE* pNode = pXML->NavigateToNode(id_to_index::tag_name, item_data.pos_in_file); THROW3 (pNode, "info_portion id=", *item_data.id); //список названий диалогов int dialogs_num = pXML->GetNodesNum(pNode, "dialog"); info_data()->m_DialogNames.clear(); int i = 0; for(; i<dialogs_num; ++i) { shared_str dialog_name = pXML->Read(pNode, "dialog", i,""); info_data()->m_DialogNames.push_back(dialog_name); } //список названий порций информации, которые деактивируются, //после получения этой порции int disable_num = pXML->GetNodesNum(pNode, "disable"); info_data()->m_DisableInfo.clear(); for(i=0; i<disable_num; ++i) { shared_str info_id = pXML->Read(pNode, "disable", i,""); info_data()->m_DisableInfo.push_back(info_id); } //имена скриптовых функций info_data()->m_PhraseScript.Load(pXML, pNode); //индексы статей info_data()->m_Articles.clear(); int articles_num = pXML->GetNodesNum(pNode, "article"); for(i=0; i<articles_num; ++i) { LPCSTR article_str_id = pXML->Read(pNode, "article", i, NULL); THROW(article_str_id); info_data()->m_Articles.push_back(article_str_id); } info_data()->m_ArticlesDisable.clear(); articles_num = pXML->GetNodesNum(pNode, "article_disable"); for(i=0; i<articles_num; ++i) { LPCSTR article_str_id = pXML->Read(pNode, "article_disable", i, NULL); THROW(article_str_id); info_data()->m_ArticlesDisable.push_back(article_str_id); } info_data()->m_GameTasks.clear(); int task_num = pXML->GetNodesNum(pNode, "task"); for(i=0; i<task_num; ++i) { LPCSTR task_str_id = pXML->Read(pNode, "task", i, NULL); THROW(task_str_id); info_data()->m_GameTasks.push_back(task_str_id); } }
void CUIMessageBox::InitMessageBox(LPCSTR box_template) { Clear (); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "message_box.xml"); CUIXmlInit xml_init; string512 str; strconcat (sizeof(str),str,box_template,":picture"); m_UIStaticPicture = new CUIStatic(); AttachChild(m_UIStaticPicture); xml_init.InitStatic (uiXml, str, 0, m_UIStaticPicture); strconcat (sizeof(str),str,box_template,":message_text"); if (uiXml.NavigateToNode(str,0)) { m_UIStaticText = new CUIStatic(); AttachChild(m_UIStaticText); xml_init.InitStatic (uiXml, str, 0, m_UIStaticText); } strcpy_s (str,box_template); xml_init.InitStatic (uiXml, str, 0, this); LPCSTR _type = uiXml.ReadAttrib(str,0,"type",NULL); R_ASSERT (_type); m_eMessageBoxStyle = MESSAGEBOX_OK; if(0==stricmp(_type,"ok")) { m_eMessageBoxStyle = MESSAGEBOX_OK; } else if(0==stricmp(_type,"yes_no")) { m_eMessageBoxStyle = MESSAGEBOX_YES_NO; } else if(0==stricmp(_type,"yes_no_cancel")) { m_eMessageBoxStyle = MESSAGEBOX_YES_NO_CANCEL; } else if(0==stricmp(_type,"yes_no_copy")) { m_eMessageBoxStyle = MESSAGEBOX_YES_NO_COPY; } else if(0==stricmp(_type,"direct_ip")) { m_eMessageBoxStyle = MESSAGEBOX_DIRECT_IP; } else if(0==stricmp(_type,"password")) { m_eMessageBoxStyle = MESSAGEBOX_PASSWORD; } else if(0==stricmp(_type,"quit_windows")) { m_eMessageBoxStyle = MESSAGEBOX_QUIT_WINDOWS; } else if(0==stricmp(_type,"quit_game")) { m_eMessageBoxStyle = MESSAGEBOX_QUIT_GAME; } else if(0==stricmp(_type,"info")) { m_eMessageBoxStyle = MESSAGEBOX_INFO; }; switch (m_eMessageBoxStyle) { case MESSAGEBOX_OK: { strconcat (sizeof(str),str,box_template,":button_ok"); m_UIButtonYesOk = new CUI3tButtonEx(); AttachChild (m_UIButtonYesOk); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonYesOk); } break; case MESSAGEBOX_INFO: { } break; case MESSAGEBOX_DIRECT_IP: strconcat (sizeof(str),str,box_template,":cap_host"); m_UIStaticHost = new CUIStatic(); AttachChild (m_UIStaticHost); xml_init.InitStatic (uiXml, str, 0, m_UIStaticHost); strconcat (sizeof(str),str,box_template,":edit_host"); m_UIEditHost = new CUIEditBox(); AttachChild (m_UIEditHost); xml_init.InitEditBox (uiXml, str, 0, m_UIEditHost); strconcat (sizeof(str),str,box_template,":cap_password"); m_UIStaticPass = new CUIStatic(); AttachChild (m_UIStaticPass); xml_init.InitStatic (uiXml, str, 0, m_UIStaticPass); strconcat (sizeof(str),str,box_template,":edit_password"); m_UIEditPass = new CUIEditBox(); AttachChild (m_UIEditPass); xml_init.InitEditBox (uiXml, str, 0, m_UIEditPass); strconcat (sizeof(str),str,box_template,":button_yes"); m_UIButtonYesOk = new CUI3tButtonEx(); AttachChild (m_UIButtonYesOk); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonYesOk); strconcat (sizeof(str),str,box_template,":button_no"); m_UIButtonNo = new CUI3tButtonEx(); AttachChild (m_UIButtonNo); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonNo); //m_message_box_yes_no->func_on_ok = CUIWndCallback::void_function( this, &CUIActorMenu::OnMesBoxYes ); break; case MESSAGEBOX_PASSWORD: strconcat (sizeof(str),str,box_template,":cap_user_password"); m_UIStaticUserPass = new CUIStatic(); AttachChild (m_UIStaticUserPass); xml_init.InitStatic (uiXml, str, 0, m_UIStaticUserPass); strconcat (sizeof(str),str,box_template,":cap_password"); m_UIStaticPass = new CUIStatic(); AttachChild (m_UIStaticPass); xml_init.InitStatic (uiXml, str, 0, m_UIStaticPass); strconcat (sizeof(str),str,box_template,":edit_user_password"); m_UIEditUserPass = new CUIEditBox(); AttachChild (m_UIEditUserPass); xml_init.InitEditBox (uiXml, str, 0, m_UIEditUserPass); strconcat (sizeof(str),str,box_template,":edit_password"); m_UIEditPass = new CUIEditBox(); AttachChild (m_UIEditPass); xml_init.InitEditBox (uiXml, str, 0, m_UIEditPass); case MESSAGEBOX_QUIT_WINDOWS: case MESSAGEBOX_QUIT_GAME: case MESSAGEBOX_YES_NO: { strconcat (sizeof(str),str,box_template,":button_yes"); m_UIButtonYesOk = new CUI3tButtonEx(); AttachChild (m_UIButtonYesOk); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonYesOk); strconcat (sizeof(str),str,box_template,":button_no"); m_UIButtonNo = new CUI3tButtonEx(); AttachChild (m_UIButtonNo); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonNo); } break; case MESSAGEBOX_YES_NO_CANCEL: { strconcat (sizeof(str),str,box_template,":button_yes"); m_UIButtonYesOk = new CUI3tButtonEx(); AttachChild (m_UIButtonYesOk); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonYesOk); strconcat (sizeof(str),str,box_template,":button_no"); m_UIButtonNo = new CUI3tButtonEx(); AttachChild (m_UIButtonNo); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonNo); strconcat (sizeof(str),str,box_template,":button_cancel"); m_UIButtonCancel = new CUI3tButtonEx(); AttachChild (m_UIButtonCancel); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonCancel); } break; case MESSAGEBOX_YES_NO_COPY: { strconcat (sizeof(str),str,box_template,":button_yes"); m_UIButtonYesOk = new CUI3tButtonEx(); AttachChild (m_UIButtonYesOk); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonYesOk); strconcat (sizeof(str),str,box_template,":button_no"); m_UIButtonNo = new CUI3tButtonEx(); AttachChild (m_UIButtonNo); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonNo); strconcat (sizeof(str),str,box_template,":button_copy"); m_UIButtonCopy = new CUI3tButtonEx(); AttachChild (m_UIButtonCopy); xml_init.Init3tButtonEx (uiXml, str, 0, m_UIButtonCopy); strconcat (sizeof(str),str,box_template,":edit_url"); if ( uiXml.NavigateToNode(str) ) { m_UIEditURL = new CUIEditBox(); AttachChild (m_UIEditURL); xml_init.InitEditBox (uiXml, str, 0, m_UIEditURL); // m_UIEditURL->read_only } } break; }; }