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 CUIGameAHunt::Init (int stage) { if(stage==0) { // shared inherited::Init (stage); m_buy_msg_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_ah_buy", Window); } if(stage==1) { //unique m_pTeamPanels->Init (TEAM_PANELS_AHUNT_XML_NAME, "team_panels_wnd"); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "ui_game_ahunt.xml"); CUIXmlInit::InitWindow (uiXml, "global", 0, Window); CUIXmlInit::InitTextWnd (uiXml, "fraglimit",0, m_pFragLimitIndicator); m_pReinforcementInidcator = xr_new<CUITextWnd>(); m_pReinforcementInidcator->SetAutoDelete(true); CUIXmlInit::InitTextWnd (uiXml, "reinforcement", 0, m_pReinforcementInidcator); CUIXmlInit::InitStatic (uiXml, "team1_icon", 0, m_team1_icon); CUIXmlInit::InitStatic (uiXml, "team2_icon", 0, m_team2_icon); CUIXmlInit::InitTextWnd (uiXml, "team1_score", 0, m_team1_score); CUIXmlInit::InitTextWnd (uiXml, "team2_score", 0, m_team2_score); m_pMoneyIndicator->InitFromXML (uiXml); m_pRankIndicator->InitFromXml (uiXml); } if(stage==2) { //after inherited::Init (stage); Window->AttachChild (m_pReinforcementInidcator); } };
void CUIEventsWnd::Init () { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "pda_events.xml"); R_ASSERT3 (xml_result, "xml file not found", "pda_events.xml"); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main_wnd", 0, this); m_UILeftFrame = xr_new<CUIFrameWindow>(); m_UILeftFrame->SetAutoDelete(true); AttachChild (m_UILeftFrame); xml_init.InitFrameWindow (uiXml, "main_wnd:left_frame", 0, m_UILeftFrame); m_UILeftHeader = xr_new<CUIFrameLineWnd>(); m_UILeftHeader->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_UILeftHeader); xml_init.InitFrameLine (uiXml, "main_wnd:left_frame:left_frame_header", 0, m_UILeftHeader); //. xml_init.InitAutoStaticGroup (uiXml, "main_wnd:left_frame",m_UILeftFrame); m_UIAnimation = xr_new<CUIAnimatedStatic>(); m_UIAnimation->SetAutoDelete(true); xml_init.InitAnimatedStatic (uiXml, "main_wnd:left_frame:left_frame_header:anim_static", 0, m_UIAnimation); m_UILeftHeader->AttachChild (m_UIAnimation); m_UIRightWnd = xr_new<CUIWindow>(); m_UIRightWnd->SetAutoDelete(true); AttachChild (m_UIRightWnd); xml_init.InitWindow (uiXml, "main_wnd:right_frame", 0, m_UIRightWnd); m_UIMapWnd = xr_new<CUIMapWnd>(); m_UIMapWnd->SetAutoDelete(false); m_UIMapWnd->Init ("pda_events.xml","main_wnd:right_frame:map_wnd"); m_UITaskInfoWnd = xr_new<CUITaskDescrWnd>(); m_UITaskInfoWnd->SetAutoDelete(false); m_UITaskInfoWnd->Init (&uiXml,"main_wnd:right_frame:task_descr_view"); m_ListWnd = xr_new<CUIScrollView>(); m_ListWnd->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_ListWnd); xml_init.InitScrollView (uiXml, "main_wnd:left_frame:list", 0, m_ListWnd); m_TaskFilter = xr_new<CUITabControl>(); m_TaskFilter->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_TaskFilter); xml_init.InitTabControl (uiXml, "main_wnd:left_frame:filter_tab", 0, m_TaskFilter); m_TaskFilter->SetWindowName ("filter_tab"); Register (m_TaskFilter); AddCallback ("filter_tab",TAB_CHANGED,CUIWndCallback::void_function(this,&CUIEventsWnd::OnFilterChanged)); /* m_primary_or_all_filter_btn = xr_new<CUI3tButton>(); m_primary_or_all_filter_btn->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_primary_or_all_filter_btn); xml_init.Init3tButton (uiXml, "main_wnd:left_frame:primary_or_all", 0, m_primary_or_all_filter_btn); Register (m_primary_or_all_filter_btn); m_primary_or_all_filter_btn-> SetWindowName("btn_primary_or_all"); AddCallback ("btn_primary_or_all",BUTTON_CLICKED,boost::bind(&CUIEventsWnd::OnFilterChanged,this,_1,_2)); */ m_currFilter = eActiveTask; SetDescriptionMode (true); m_ui_task_item_xml.Init (CONFIG_PATH, UI_PATH, "job_item.xml"); }
void CUIStatsWnd::Init(LPCSTR XML) { CUIXml uiXml; if (XML) strcpy_s(XML_NAME, XML); else strcpy_s(XML_NAME, STATS_XML); uiXml.Load(CONFIG_PATH, UI_PATH, XML_NAME); CUIXmlInit xml_init; Fvector2 pos, size; pos.set (CUIXmlInit::ApplyAlignX(0, alCenter),CUIXmlInit::ApplyAlignY(0, alCenter)); size.set (UI_BASE_WIDTH, UI_BASE_HEIGHT); CUIWindow::SetWndPos(pos); CUIWindow::SetWndSize(size); // „итаем из xml файла параметры окна и контролов AttachChild(&UIFrameWnd); xml_init.InitFrameWindow(uiXml, "frame_window", 0, &UIFrameWnd); UIFrameWnd.AttachChild(&UIStatsList); xml_init.InitListWnd(uiXml, "list", 0, &UIStatsList); UIStatsList.SetMessageTarget(this); UIStatsList.EnableScrollBar(true); xml_init.InitMultiTextStatic(uiXml, "headers_mt_static", 0, &UIHeader); UIFrameWnd.AttachChild(&UIHeader); }
void CUICellItem::init() { CUIXml uiXml; uiXml.Load( CONFIG_PATH, UI_PATH, "actor_menu_item.xml" ); m_text = xr_new<CUIStatic>(); m_text->SetAutoDelete ( true ); AttachChild ( m_text ); CUIXmlInit::InitStatic ( uiXml, "cell_item_text", 0, m_text ); m_text->Show ( false ); /* m_mark = xr_new<CUIStatic>(); m_mark->SetAutoDelete ( true ); AttachChild ( m_mark ); CUIXmlInit::InitStatic ( uiXml, "cell_item_mark", 0, m_mark ); m_mark->Show ( false );*/ m_upgrade = xr_new<CUIStatic>(); m_upgrade->SetAutoDelete( true ); AttachChild ( m_upgrade ); CUIXmlInit::InitStatic ( uiXml, "cell_item_upgrade", 0, m_upgrade ); m_upgrade_pos = m_upgrade->GetWndPos(); m_upgrade->Show ( false ); m_pConditionState = xr_new<CUIProgressBar>(); m_pConditionState->SetAutoDelete(true); AttachChild(m_pConditionState); CUIXmlInit::InitProgressBar(uiXml, "condition_progess_bar", 0, m_pConditionState); m_pConditionState->Show(true); }
void CUIMessagesWindow::Init(float x, float y, float width, float height){ CUIXml xml; u32 color; CGameFont* pFont; xml.Init(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 { m_pChatLog = xr_new<CUIGameLog>(); m_pChatLog->SetAutoDelete(true); m_pChatLog->Show (true); AttachChild (m_pChatLog); m_pChatWnd = xr_new<CUIChatWnd>(m_pChatLog); 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); CUIXmlInit::InitFont(xml, "chat_log_list:font", 0, color, pFont); m_pChatLog->SetTextAtrib(pFont, color); m_pChatWnd->Init (xml); } }
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 ); }
bool UITaskListWndItem::init_task( CGameTask* task, UITaskListWnd* parent ) { VERIFY( task ); if ( !task ) { return false; } m_task = task; SetMessageTarget( parent ); CUIXml xml; xml.Load( CONFIG_PATH, UI_PATH, PDA_TASK_XML ); CUIXmlInit::InitWindow( xml, "second_task_wnd:task_item", 0, this ); m_name = UIHelper::Create3tButton( xml, "second_task_wnd:task_item:name", this ); // m_bt_view = UIHelper::CreateCheck( xml, "second_task_wnd:task_item:btn_view", this ); m_st_story = UIHelper::CreateStatic( xml, "second_task_wnd:task_item:st_story", this ); m_bt_focus = UIHelper::Create3tButton( xml, "second_task_wnd:task_item:btn_focus", this ); m_color_states[stt_activ ] = CUIXmlInit::GetColor( xml, "second_task_wnd:task_item:activ", 0, (u32)(-1) ); m_color_states[stt_unread] = CUIXmlInit::GetColor( xml, "second_task_wnd:task_item:unread", 0, (u32)(-1) ); m_color_states[stt_read ] = CUIXmlInit::GetColor( xml, "second_task_wnd:task_item:read", 0, (u32)(-1) ); update_view(); return true; }
void CUIStatsWnd::Init(LPCSTR XML) { CUIXml uiXml; if (XML) strcpy(XML_NAME, XML); else strcpy(XML_NAME, STATS_XML); bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, XML_NAME); R_ASSERT2(xml_result, "xml file not found"); CUIXmlInit xml_init; CUIWindow::Init(CUIXmlInit::ApplyAlignX(0, alCenter), CUIXmlInit::ApplyAlignY(0, alCenter), UI_BASE_WIDTH, UI_BASE_HEIGHT); // „итаем из xml файла параметры окна и контролов AttachChild(&UIFrameWnd); xml_init.InitFrameWindow(uiXml, "frame_window", 0, &UIFrameWnd); UIFrameWnd.AttachChild(&UIStatsList); xml_init.InitListWnd(uiXml, "list", 0, &UIStatsList); UIStatsList.SetMessageTarget(this); UIStatsList.EnableScrollBar(true); xml_init.InitMultiTextStatic(uiXml, "headers_mt_static", 0, &UIHeader); UIFrameWnd.AttachChild(&UIHeader); }
void CUIArtefactDetectorElite::construct(CEliteDetector* p) { m_parent = p; CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "ui_detector_artefact.xml"); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "elite", 0, this); m_wrk_area = new CUIWindow(); xml_init.InitWindow (uiXml, "elite:wrk_area", 0, m_wrk_area); m_wrk_area->SetAutoDelete (true); AttachChild (m_wrk_area); m_af_sign = new CUIStatic(); xml_init.InitStatic (uiXml, "elite:af_sign", 0, m_af_sign); m_af_sign->SetAutoDelete (true); m_wrk_area->AttachChild (m_af_sign); m_af_sign->SetCustomDraw (true); 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); /* float curr_ = (float)Device.dwWidth/(float)Device.dwHeight; float kx = curr_/1.3333333f; fix_ws_wnd_size (this, kx); */ }
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 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 CUITextureMaster::ParseShTexInfo(LPCSTR xml_file){ CUIXml xml; xml.Init(CONFIG_PATH, UI_PATH, xml_file); shared_str file = xml.Read("file_name",0,""); // shared_textures_it sht_it = m_shTex.find(texture); // if (m_shTex.end() == sht_it) // { int num = xml.GetNodesNum("",0,"texture"); // regions regs; for (int i = 0; i<num; i++) { TEX_INFO info; info.file = file; info.rect.x1 = xml.ReadAttribFlt("texture",i,"x"); info.rect.x2 = xml.ReadAttribFlt("texture",i,"width") + info.rect.x1; info.rect.y1 = xml.ReadAttribFlt("texture",i,"y"); info.rect.y2 = xml.ReadAttribFlt("texture",i,"height") + info.rect.y1; shared_str id = xml.ReadAttrib("texture",i,"id"); m_textures.insert(mk_pair(id,info)); } // m_shTex.insert(mk_pair(texture, regs)); // } }
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 CUIPdaWnd::Init() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, PDA_XML); m_pActiveDialog = NULL; m_sActiveSection = ""; CUIXmlInit::InitWindow (uiXml, "main", 0, this); UIMainPdaFrame = UIHelper::CreateStatic( uiXml, "background_static", this ); m_caption = UIHelper::CreateStatic( uiXml, "caption_static", this ); m_caption_const._set ( m_caption->GetText() ); m_anim_static = new CUIAnimatedStatic(); AttachChild (m_anim_static); m_anim_static->SetAutoDelete(true); CUIXmlInit::InitAnimatedStatic(uiXml, "anim_static", 0, m_anim_static); m_btn_close = UIHelper::Create3tButtonEx( uiXml, "close_button", this ); m_hint_wnd = UIHelper::CreateHint( uiXml, "hint_wnd" ); // m_btn_close->set_hint_wnd( m_hint_wnd ); if ( IsGameTypeSingle() ) { pUITaskWnd = new CUITaskWnd(); pUITaskWnd->hint_wnd = m_hint_wnd; pUITaskWnd->Init (); pUIFactionWarWnd = new CUIFactionWarWnd(); pUIFactionWarWnd->hint_wnd = m_hint_wnd; pUIFactionWarWnd->Init (); pUIRankingWnd = new CUIRankingWnd(); pUIRankingWnd->Init (); pUILogsWnd = new CUILogsWnd(); pUILogsWnd->Init (); } UITabControl = new CUITabControl(); UITabControl->SetAutoDelete (true); AttachChild (UITabControl); CUIXmlInit::InitTabControl (uiXml, "tab", 0, UITabControl); UITabControl->SetMessageTarget (this); UINoice = new CUIStatic(); UINoice->SetAutoDelete ( true ); CUIXmlInit::InitStatic ( uiXml, "noice_static", 0, UINoice ); RearrangeTabButtons (UITabControl); }
CUIStatsListItem * CUIStatsWnd::AddItem() { CUIStatsListItem *pNewItem = new CUIStatsListItem(); UIStatsList.AddItem<CUIListItem>(pNewItem); UIStatsList.ScrollToBegin(); CUIXml uiXml; uiXml.Load(CONFIG_PATH, UI_PATH, XML_NAME); pNewItem->XmlInit("list", uiXml); // pNewItem->SetMessageTarget(this); return pNewItem; }
void CUIActorInfoWnd::Init() { CUIXml uiXml; CUIXmlInit xml_init; uiXml.Load (CONFIG_PATH, UI_PATH,ACTOR_STATISTIC_XML); xml_init.InitWindow (uiXml, "main_wnd", 0, this); // Декоративное оформление UICharIconFrame = xr_new<CUIFrameWindow>(); UICharIconFrame->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "chicon_frame_window", 0, UICharIconFrame); AttachChild (UICharIconFrame); UICharIconHeader = xr_new<CUIFrameLineWnd>(); UICharIconHeader->SetAutoDelete (true); xml_init.InitFrameLine (uiXml, "chicon_frame_line", 0, UICharIconHeader); UICharIconFrame->AttachChild (UICharIconHeader); UIAnimatedIcon = xr_new<CUIAnimatedStatic>(); UIAnimatedIcon->SetAutoDelete (true); xml_init.InitAnimatedStatic (uiXml, "a_static", 0, UIAnimatedIcon); UICharIconHeader->AttachChild (UIAnimatedIcon); UIInfoFrame = xr_new<CUIFrameWindow>(); UIInfoFrame->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "info_frame_window", 0, UIInfoFrame); AttachChild (UIInfoFrame); UIInfoHeader = xr_new<CUIFrameLineWnd>();UIInfoHeader ->SetAutoDelete(true); xml_init.InitFrameLine (uiXml, "info_frame_line", 0, UIInfoHeader); UIInfoFrame->AttachChild (UIInfoHeader); UIDetailList = xr_new<CUIScrollView>();UIDetailList->SetAutoDelete(true); UIInfoFrame->AttachChild (UIDetailList); xml_init.InitScrollView (uiXml, "detail_list", 0, UIDetailList); UIMasterList = xr_new<CUIScrollView>();UIMasterList->SetAutoDelete(true); UICharIconFrame->AttachChild (UIMasterList); xml_init.InitScrollView (uiXml, "master_list", 0, UIMasterList); UICharacterWindow = xr_new<CUIWindow>();UICharacterWindow->SetAutoDelete(true); UICharIconFrame->AttachChild (UICharacterWindow); xml_init.InitWindow (uiXml, "character_info", 0, UICharacterWindow); UICharacterInfo = xr_new<CUICharacterInfo>(); UICharacterInfo->SetAutoDelete(true); UICharacterWindow->AttachChild (UICharacterInfo); UICharacterInfo->InitCharacterInfo (Fvector2().set(0,0),UICharacterWindow->GetWndSize(), ACTOR_CHARACTER_XML); //Элементы автоматического добавления xml_init.InitAutoStatic (uiXml, "right_auto_static", UICharIconFrame); xml_init.InitAutoStatic (uiXml, "left_auto_static", UIInfoFrame); }
CUIStatsListItem * CUIStatsWnd::AddItem() { CUIStatsListItem *pNewItem = xr_new<CUIStatsListItem>(); UIStatsList.AddItem<CUIListItem>(pNewItem); UIStatsList.ScrollToBegin(); CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, XML_NAME); R_ASSERT2(xml_result, "xml file not found"); pNewItem->XmlInit("list", uiXml); // pNewItem->SetMessageTarget(this); return pNewItem; }
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 CStringTable::Load (LPCSTR xml_file) { CUIXml uiXml; string_path xml_file_full; strconcat (sizeof(xml_file_full),xml_file_full, xml_file, ".xml"); string_path _s; strconcat (sizeof(_s),_s, STRING_TABLE_PATH, "\\", *(pData->m_sLanguage) ); bool xml_result = uiXml.Init(CONFIG_PATH, _s, xml_file_full); if(!xml_result) Debug.fatal(DEBUG_INFO,"string table xml file not found %s, for language %s", xml_file_full, *(pData->m_sLanguage)); //общий список всех записей таблицы в файле int string_num = uiXml.GetNodesNum (uiXml.GetRoot(), "string"); for(int i=0; i<string_num; ++i) { LPCSTR string_name = uiXml.ReadAttrib(uiXml.GetRoot(), "string", i, "id", NULL); VERIFY3 (pData->m_StringTable.find(string_name) == pData->m_StringTable.end(), "duplicate string table id", string_name); LPCSTR string_text = uiXml.Read(uiXml.GetRoot(), "string:text", i, NULL); if(m_bWriteErrorsToLog && string_text) Msg("[string table] '%s' no translation in '%s'", string_name, *(pData->m_sLanguage)); VERIFY3 (string_text, "string table entry does not has a text", string_name); STRING_VALUE str_val = ParseLine(string_text, string_name, true); pData->m_StringTable[string_name] = str_val; } }
void CUIGameCTA::SetVoteMessage(LPCSTR str) { if (m_voteStatusWnd) { xr_delete (m_voteStatusWnd); } if (str) { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "ui_game_dm.xml"); m_voteStatusWnd = xr_new<UIVoteStatusWnd>(); m_voteStatusWnd->InitFromXML (uiXml); m_voteStatusWnd->Show (true); m_voteStatusWnd->SetVoteMsg (str); } };
void CUINewsWnd::Init(LPCSTR xml_name, LPCSTR start_from) { string512 pth; CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, xml_name); R_ASSERT3 (xml_result, "xml file not found", xml_name); CUIXmlInit xml_init; strconcat (pth,start_from,"list"); xml_init.InitWindow (uiXml, pth, 0, this); UIScrollWnd = xr_new<CUIScrollView>();UIScrollWnd->SetAutoDelete(true); AttachChild (UIScrollWnd); xml_init.InitScrollView (uiXml, pth, 0, UIScrollWnd); }
void CUIPdaListItem::InitPdaListItem(Fvector2 pos, Fvector2 size) { inherited::SetWndPos (pos); inherited::SetWndSize (size); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, PDA_CONTACT_CHAR); CUIXmlInit xml_init; UIInfo = new CUICharacterInfo(); UIInfo->SetAutoDelete (true); AttachChild (UIInfo); UIInfo->InitCharacterInfo (Fvector2().set(0,0), size, PDA_CONTACT_CHAR); xml_init.InitAutoStaticGroup (uiXml,"pda_char_auto_statics", 0, this); }
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 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" ); }
CUIGameAHunt::CUIGameAHunt() { CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, "ui_game_ahunt.xml"); if(m_pFragLimitIndicator) xr_delete(m_pFragLimitIndicator); m_pFragLimitIndicator = xr_new<CUIStatic>(); CUIXmlInit::InitStatic (uiXml, "fraglimit",0, m_pFragLimitIndicator); m_pReinforcementInidcator = xr_new<CUIProgressShape>(); CUIXmlInit::InitProgressShape (uiXml, "reinforcement", 0, m_pReinforcementInidcator); //------------------------------------------------------------- m_pBuySpawnMsgBox = NULL; }
void CUIFrags2::Init(CUIXml& xml_doc, LPCSTR path, LPCSTR backgrnd_path){ InitBackground(xml_doc, backgrnd_path); CUIWindow* pTeam1 = NULL; CUIWindow* pTeam2 = NULL; Fvector2 pos; pTeam1 = m_pStats->InitStats(xml_doc, path, 1); AttachChild(pTeam1); pTeam2 = m_pStats2->InitStats(xml_doc, path, 2); AttachChild(pTeam2); // team 2 list float x = xml_doc.ReadAttribFlt(path, 0, "x2"); R_ASSERT(x); pos = m_pStats2->GetWndPos(); pos.x = x; // pos.y += 3; m_pStats2->SetWndPos(pos); // team2 statas pos = pTeam2->GetWndPos(); pos.x += m_pStats2->GetWndPos().x; pTeam2->SetWndPos(pos); // team 1 list pos = m_pStats->GetWndPos(); pos.y += 3; m_pStats->SetWndPos(pos); pos = pTeam1->GetWndPos(); pos.x += m_pStats->GetWndPos().x; pTeam1->SetWndPos(pos); }
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 CUIStalkersRankingWnd::Init() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH,STALKERS_RANKING_XML); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main_wnd", 0, this); UICharIconFrame = xr_new<CUIFrameWindow>(); UICharIconFrame->SetAutoDelete(true); AttachChild (UICharIconFrame); xml_init.InitFrameWindow (uiXml, "chicon_frame_window", 0, UICharIconFrame); UICharIconHeader = xr_new<CUIFrameLineWnd>(); UICharIconHeader->SetAutoDelete(true); UICharIconFrame->AttachChild (UICharIconHeader); xml_init.InitFrameLine (uiXml, "chicon_frame_line", 0, UICharIconHeader); UIInfoFrame = xr_new<CUIFrameWindow>(); UIInfoFrame->SetAutoDelete(true); AttachChild (UIInfoFrame); xml_init.InitFrameWindow (uiXml, "info_frame_window", 0, UIInfoFrame); UIInfoHeader = xr_new<CUIFrameLineWnd>(); UIInfoHeader->SetAutoDelete(true); UIInfoFrame->AttachChild (UIInfoHeader); xml_init.InitFrameLine (uiXml, "info_frame_line", 0, UIInfoHeader); UIAnimatedIcon = xr_new<CUIAnimatedStatic>(); UIAnimatedIcon->SetAutoDelete(true); UIInfoHeader->AttachChild (UIAnimatedIcon); xml_init.InitAnimatedStatic (uiXml, "a_static", 0, UIAnimatedIcon); UIList = xr_new<CUIScrollView>(); UIList->SetAutoDelete(true); UIInfoFrame->AttachChild (UIList); xml_init.InitScrollView (uiXml, "list", 0, UIList); UICharacterWindow = xr_new<CUIWindow>(); UICharacterWindow->SetAutoDelete(true); UICharIconFrame->AttachChild (UICharacterWindow); xml_init.InitWindow (uiXml, "character_info", 0, UICharacterWindow); UICharacterInfo = xr_new<CUICharacterInfo>(); UICharacterInfo->SetAutoDelete(true); UICharacterWindow->AttachChild (UICharacterInfo); UICharacterInfo->InitCharacterInfo (Fvector2().set(0,0),UICharacterWindow->GetWndSize(), STALKERS_RANKING_CHARACTER_XML); xml_init.InitAutoStaticGroup (uiXml, "left_auto", 0, UIInfoFrame); xml_init.InitAutoStaticGroup (uiXml, "right_auto", 0, UICharIconFrame); }