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 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 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 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 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); }
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 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 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 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); }
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 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 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); }
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 CUIGameDM::Init(int stage) { if(stage==0) { // shared m_pTeamPanels = xr_new<UITeamPanels>(); m_pMoneyIndicator = xr_new<CUIMoneyIndicator>(); m_pMoneyIndicator->SetAutoDelete(true); m_pRankIndicator = xr_new<CUIRankIndicator>(); m_pRankIndicator->SetAutoDelete (true); m_pFragLimitIndicator = xr_new<CUITextWnd>(); m_pFragLimitIndicator->SetAutoDelete(true); inherited::Init (stage); m_time_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_timelimit", m_window); m_spectrmode_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_spetatormode", m_window); m_spectator_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_spectator", m_window); m_pressjump_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_pressjump", m_window); m_pressbuy_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_pressbuy", m_window); m_round_result_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_round_result", m_window); m_force_respawn_time_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_force_respawn_time", m_window); m_demo_play_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_demo_play", m_window); m_warm_up_caption = UIHelper::CreateTextWnd(*m_msgs_xml, "mp_warm_up", m_window); } if(stage==1) { //unique m_pTeamPanels->Init (TEAM_PANELS_DM_XML_NAME, "team_panels_wnd"); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "ui_game_dm.xml"); CUIXmlInit::InitWindow (uiXml,"global", 0, m_window); m_pMoneyIndicator->InitFromXML (uiXml); m_pRankIndicator->InitFromXml (uiXml); CUIXmlInit::InitTextWnd (uiXml,"fraglimit",0, m_pFragLimitIndicator); } if(stage==2) { //after inherited::Init (stage); m_window->AttachChild (m_pMoneyIndicator); m_window->AttachChild (m_pRankIndicator); m_window->AttachChild (m_pFragLimitIndicator); } };
void CUIActorInfoWnd::FillPointsInfo () { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH,ACTOR_STATISTIC_XML); UIMasterList->Clear (); const vStatSectionData& _storage = Actor()->StatisticMgr().GetCStorage(); vStatSectionData::const_iterator it = _storage.begin(); vStatSectionData::const_iterator it_e = _storage.end(); FillMasterPart (&uiXml, "foo"); for(; it!=it_e; ++it) { FillMasterPart (&uiXml, (*it).key); } FillMasterPart (&uiXml, "total"); UIMasterList->SetSelected(UIMasterList->GetItem(1) ); }
CUIButtonHint::CUIButtonHint () :m_ownerWnd(NULL),m_enabledOnFrame(false) { Device.seqRender.Add (this, REG_PRIORITY_LOW-1000); CUIXmlInit xml_init; CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "hint_item.xml"); xml_init.InitWindow (uiXml,"button_hint",0,this); m_border = new CUIFrameLineWnd(); m_border->SetAutoDelete(true); AttachChild (m_border); xml_init.InitFrameLine (uiXml,"button_hint:frame_line",0,m_border); m_text = new CUIStatic(); m_text->SetAutoDelete(true); AttachChild (m_text); xml_init.InitStatic (uiXml,"button_hint:description",0,m_text); }
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 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; }; }
void CUIActorMenu::Construct() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "actor_menu.xml"); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main", 0, this); m_hint_wnd = UIHelper::CreateHint (uiXml, "hint_wnd"); m_LeftBackground = new CUIStatic(); m_LeftBackground->SetAutoDelete (true); AttachChild (m_LeftBackground); xml_init.InitStatic (uiXml, "left_background", 0, m_LeftBackground); m_pUpgradeWnd = new CUIInventoryUpgradeWnd(); AttachChild (m_pUpgradeWnd); m_pUpgradeWnd->SetAutoDelete (true); m_pUpgradeWnd->Init (); m_ActorCharacterInfo = new CUICharacterInfo(); m_ActorCharacterInfo->SetAutoDelete( true ); AttachChild( m_ActorCharacterInfo ); m_ActorCharacterInfo->InitCharacterInfo( &uiXml, "actor_ch_info" ); m_PartnerCharacterInfo = new CUICharacterInfo(); m_PartnerCharacterInfo->SetAutoDelete( true ); AttachChild( m_PartnerCharacterInfo ); m_PartnerCharacterInfo->InitCharacterInfo( &uiXml, "partner_ch_info" ); m_RightDelimiter = UIHelper::CreateStatic(uiXml, "right_delimiter", this); m_ActorTradeCaption = UIHelper::CreateStatic(uiXml, "right_delimiter:trade_caption", m_RightDelimiter); m_ActorTradePrice = UIHelper::CreateStatic(uiXml, "right_delimiter:trade_price", m_RightDelimiter); m_ActorTradeWeightMax = UIHelper::CreateStatic(uiXml, "right_delimiter:trade_weight_max", m_RightDelimiter); m_ActorTradeCaption->AdjustWidthToText(); m_LeftDelimiter = UIHelper::CreateStatic(uiXml, "left_delimiter", this); m_PartnerTradeCaption = UIHelper::CreateStatic(uiXml, "left_delimiter:trade_caption", m_LeftDelimiter); m_PartnerTradePrice = UIHelper::CreateStatic(uiXml, "left_delimiter:trade_price", m_LeftDelimiter); m_PartnerTradeWeightMax = UIHelper::CreateStatic(uiXml, "left_delimiter:trade_weight_max", m_LeftDelimiter); m_PartnerTradeCaption->AdjustWidthToText(); m_ActorBottomInfo = UIHelper::CreateStatic(uiXml, "actor_weight_caption", this); m_ActorWeight = UIHelper::CreateStatic(uiXml, "actor_weight", this); m_ActorWeightMax = UIHelper::CreateStatic(uiXml, "actor_weight_max", this); m_ActorBottomInfo->AdjustWidthToText(); m_PartnerBottomInfo = UIHelper::CreateStatic(uiXml, "partner_weight_caption", this); m_PartnerWeight = UIHelper::CreateStatic(uiXml, "partner_weight", this); m_PartnerBottomInfo->AdjustWidthToText(); m_PartnerWeight_end_x = m_PartnerWeight->GetWndPos().x; m_pInventoryBagList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_bag", this); m_pInventoryBeltList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_belt", this); m_pInventoryOutfitList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_outfit", this); m_pInventoryDetectorList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_detector", this); m_pInventoryPistolList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_pistol", this); m_pInventoryAutomaticList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_automatic", this); m_pTradeActorBagList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_actor_trade_bag", this); m_pTradeActorList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_actor_trade", this); m_pTradePartnerBagList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_partner_bag", this); m_pTradePartnerList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_partner_trade", this); #ifdef INV_KNIFE_SLOT m_pInventoryKnifeList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_knife", this); #endif #ifdef INV_TORCH_SLOT m_pInventoryTorchList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_torch", this); #endif #ifdef INV_BINO_SLOT m_pInventoryBinoList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_bino", this); #endif #ifdef DRAG_DROP_TRASH m_pTrashList = UIHelper::CreateDragDropListEx(uiXml, "dragdrop_trash", this); m_pTrashList->m_f_item_drop = CUIDragDropListEx::DRAG_DROP_EVENT(this, &CUIActorMenu::OnItemDrop); m_pTrashList->m_f_drag_event = CUIDragDropListEx::DRAG_ITEM_EVENT(this, &CUIActorMenu::OnDragItemOnTrash); #endif #ifdef EXT_BELT e_af_count = uiXml.ReadAttribInt("dragdrop_belt", 0, "rows_num", 5); //+ clamp(e_af_count, u32(5), u32(16)); e_af_count_base = e_af_count - 5;// reserv for outfit m_belt_list_over.resize(e_af_count); #endif //EXT_BELT m_belt_list_over[0] = UIHelper::CreateStatic(uiXml, "belt_list_over", this); Fvector2 pos; pos = m_belt_list_over[0]->GetWndPos(); float dy = uiXml.ReadAttribFlt("belt_list_over", 0, "dy", 10.0f); for ( u8 i = 1; i < e_af_count; ++i ) { pos.y += dy; m_belt_list_over[i] = UIHelper::CreateStatic(uiXml, "belt_list_over", this); m_belt_list_over[i]->SetWndPos( pos ); } m_ActorMoney = UIHelper::CreateStatic(uiXml, "actor_money_static", this); m_PartnerMoney = UIHelper::CreateStatic(uiXml, "partner_money_static", this); m_trade_button = UIHelper::Create3tButtonEx(uiXml, "trade_button", this); m_takeall_button = UIHelper::Create3tButtonEx(uiXml, "takeall_button", this); m_exit_button = UIHelper::Create3tButtonEx(uiXml, "exit_button", this); m_clock_value = UIHelper::CreateStatic(uiXml, "clock_value", this); m_pDeadBodyBagList = new CUIDragDropListEx(); AttachChild (m_pDeadBodyBagList); m_pDeadBodyBagList->SetAutoDelete (true); xml_init.InitDragDropListEx (uiXml, "dragdrop_deadbody_bag", 0, m_pDeadBodyBagList); m_ActorStateInfo = new ui_actor_state_wnd(); m_ActorStateInfo->init_from_xml (uiXml, "actor_state_info"); m_ActorStateInfo->SetAutoDelete (true); AttachChild (m_ActorStateInfo); XML_NODE* stored_root = uiXml.GetLocalRoot (); uiXml.SetLocalRoot (uiXml.NavigateToNode ("action_sounds",0)); ::Sound->create (sounds[eSndOpen], uiXml.Read("snd_open", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eSndClose], uiXml.Read("snd_close", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eItemToSlot], uiXml.Read("snd_item_to_slot", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eItemToBelt], uiXml.Read("snd_item_to_belt", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eItemToRuck], uiXml.Read("snd_item_to_ruck", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eProperties], uiXml.Read("snd_properties", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eDropItem], uiXml.Read("snd_drop_item", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eAttachAddon], uiXml.Read("snd_attach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eDetachAddon], uiXml.Read("snd_detach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eItemUse], uiXml.Read("snd_item_use", 0, NULL),st_Effect,sg_SourceType); uiXml.SetLocalRoot (stored_root); m_ItemInfo = new CUIItemInfo(); //- m_ItemInfo->SetAutoDelete (true); //- AttachChild (m_ItemInfo); m_ItemInfo->InitItemInfo ("actor_menu_item.xml"); m_upgrade_info = NULL; if ( ai().get_alife() ) { m_upgrade_info = new UIInvUpgradeInfo(); m_upgrade_info->SetAutoDelete (true); AttachChild (m_upgrade_info); m_upgrade_info->init_from_xml ("actor_menu_item.xml"); } m_message_box_yes_no = new CUIMessageBoxEx(); m_message_box_yes_no->InitMessageBox( "message_box_yes_no" ); m_message_box_yes_no->SetAutoDelete (true); m_message_box_yes_no->SetText ( "" ); m_message_box_ok = new CUIMessageBoxEx(); m_message_box_ok->InitMessageBox ( "message_box_ok" ); m_message_box_ok->SetAutoDelete (true); m_message_box_ok->SetText ( "" ); m_UIPropertiesBox = new CUIPropertiesBox(); AttachChild (m_UIPropertiesBox); m_UIPropertiesBox->InitPropertiesBox(Fvector2().set(0,0),Fvector2().set(300,300)); m_UIPropertiesBox->Hide (); m_UIPropertiesBox->SetWindowName ( "property_box" ); InitCallbacks (); BindDragDropListEvents (m_pInventoryBeltList); BindDragDropListEvents (m_pInventoryPistolList); BindDragDropListEvents (m_pInventoryAutomaticList); BindDragDropListEvents (m_pInventoryOutfitList); BindDragDropListEvents (m_pInventoryDetectorList); BindDragDropListEvents (m_pInventoryBagList); BindDragDropListEvents (m_pTradeActorBagList); BindDragDropListEvents (m_pTradeActorList); BindDragDropListEvents (m_pTradePartnerBagList); BindDragDropListEvents (m_pTradePartnerList); BindDragDropListEvents (m_pDeadBodyBagList); #ifdef INV_KNIFE_SLOT BindDragDropListEvents (m_pInventoryKnifeList); #endif #ifdef INV_TORCH_SLOT BindDragDropListEvents (m_pInventoryTorchList); #endif #ifdef INV_BINO_SLOT BindDragDropListEvents (m_pInventoryBinoList); #endif #ifdef DRAG_DROP_TRASH m_allowed_drops[iTrashSlot].push_back(iActorBag); m_allowed_drops[iTrashSlot].push_back(iActorSlot); m_allowed_drops[iTrashSlot].push_back(iActorBelt); #endif m_allowed_drops[iActorSlot].push_back(iActorBag); m_allowed_drops[iActorSlot].push_back(iActorTrade); m_allowed_drops[iActorSlot].push_back(iDeadBodyBag); m_allowed_drops[iActorBag].push_back(iActorSlot); m_allowed_drops[iActorBag].push_back(iActorBelt); m_allowed_drops[iActorBag].push_back(iActorTrade); m_allowed_drops[iActorBag].push_back(iDeadBodyBag); m_allowed_drops[iActorBag].push_back(iActorBag); m_allowed_drops[iActorBelt].push_back(iActorBag); m_allowed_drops[iActorBelt].push_back(iActorTrade); m_allowed_drops[iActorBelt].push_back(iDeadBodyBag); m_allowed_drops[iActorBelt].push_back(iActorBelt); m_allowed_drops[iActorTrade].push_back(iActorSlot); m_allowed_drops[iActorTrade].push_back(iActorBag); m_allowed_drops[iActorTrade].push_back(iActorBelt); m_allowed_drops[iActorTrade].push_back(iActorTrade); m_allowed_drops[iPartnerTradeBag].push_back(iPartnerTrade); m_allowed_drops[iPartnerTradeBag].push_back(iPartnerTradeBag); m_allowed_drops[iPartnerTrade].push_back(iPartnerTradeBag); m_allowed_drops[iPartnerTrade].push_back(iPartnerTrade); m_allowed_drops[iDeadBodyBag].push_back(iActorSlot); m_allowed_drops[iDeadBodyBag].push_back(iActorBag); m_allowed_drops[iDeadBodyBag].push_back(iActorBelt); m_allowed_drops[iDeadBodyBag].push_back(iDeadBodyBag); m_upgrade_selected = NULL; SetCurrentItem (NULL); SetActor (NULL); SetPartner (NULL); SetInvBox (NULL); m_actor_trade = NULL; m_partner_trade = NULL; m_repair_mode = false; DeInitInventoryMode (); DeInitTradeMode (); DeInitUpgradeMode (); DeInitDeadBodySearchMode (); }
void CUICharacterInfo::InitCharacterInfo(Fvector2 pos, Fvector2 size, LPCSTR xml_name) { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, xml_name); InitCharacterInfo (pos, size,&uiXml); }
void CUIGameCTA::Init(int stage) { if(stage==0) { m_round_result_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_round_result", Window); m_pressbuy_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_pressbuy", Window); m_pressjump_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_pressjump", Window); m_spectator_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_spectator", Window); m_spectrmode_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_spetatormode", Window); m_warm_up_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_warm_up", Window); m_time_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_timelimit", Window); m_demo_play_caption = UIHelper::CreateTextWnd(*MsgConfig, "mp_demo_play", Window); teamPanels = xr_new<UITeamPanels>(); teamPanels->Init (TEAM_PANELS_XML_NAME, "team_panels_wnd"); CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, CTA_GAME_WND_XML); CUIXmlInit::InitWindow (uiXml, "global", 0, Window); m_pMoneyIndicator = xr_new<CUIMoneyIndicator>(); m_pMoneyIndicator->SetAutoDelete(true); m_pMoneyIndicator->InitFromXML (uiXml); m_pRankIndicator = xr_new<CUIRankIndicator>(); m_pRankIndicator->SetAutoDelete (true); m_pRankIndicator->InitFromXml (uiXml); m_pReinforcementInidcator = xr_new<CUITextWnd>(); m_pReinforcementInidcator->SetAutoDelete(true); CUIXmlInit::InitTextWnd (uiXml, "reinforcement", 0, m_pReinforcementInidcator); m_team1_icon = xr_new<CUIStatic>(); m_team2_icon = xr_new<CUIStatic>(); CUIXmlInit::InitStatic (uiXml, "team1_icon", 0, m_team1_icon); CUIXmlInit::InitStatic (uiXml, "team2_icon", 0, m_team2_icon); m_team1_score = xr_new<CUITextWnd>(); m_team2_score = xr_new<CUITextWnd>(); m_team1_score->SetAutoDelete (true); m_team2_score->SetAutoDelete (true); CUIXmlInit::InitTextWnd (uiXml, "team1_score", 0, m_team1_score); CUIXmlInit::InitTextWnd (uiXml, "team2_score", 0, m_team2_score); m_pFragLimitIndicator = xr_new<CUITextWnd>(); m_pFragLimitIndicator->SetAutoDelete(true); CUIXmlInit::InitTextWnd (uiXml, "fraglimit", 0, m_pFragLimitIndicator); } if(stage==2) { inherited::Init (stage); Window->AttachChild (m_pMoneyIndicator); Window->AttachChild (m_pRankIndicator); Window->AttachChild (m_pReinforcementInidcator); Window->AttachChild (m_pFragLimitIndicator); Window->AttachChild (m_team1_score); Window->AttachChild (m_team2_score); } }
void CUIZoneMap::Init() { CUIXml uiXml; uiXml.Load (CONFIG_PATH, UI_PATH, "zone_map.xml"); CUIXmlInit xml_init; xml_init.InitStatic (uiXml, "minimap:background", 0, &m_background); xml_init.InitWindow (uiXml, "minimap:level_frame", 0, &m_clipFrame); xml_init.InitStatic (uiXml, "minimap:center", 0, &m_center); m_clock_wnd = UIHelper::CreateStatic(uiXml, "minimap:clock_wnd", &m_background); m_activeMap = xr_new<CUIMiniMap>(); m_clipFrame.AttachChild (m_activeMap); m_activeMap->SetAutoDelete (true); m_activeMap->EnableHeading (true); xml_init.InitStatic (uiXml, "minimap:compass", 0, &m_compass); m_background.AttachChild (&m_compass); m_clipFrame.AttachChild (&m_center); m_Counter_text.SetText( "" ); visible = true; Fvector2 sz_k = m_clipFrame.GetWndSize(); Fvector2 sz = sz_k; { float k = UI().get_current_kx(); sz.y *= UI_BASE_HEIGHT*k; sz.x = sz.y / k; m_clipFrame.SetWndSize (sz); Fvector2 p = m_clipFrame.GetWndPos(); p.mul (UI_BASE_HEIGHT); m_clipFrame.SetWndPos (p); m_background.SetHeight (m_background.GetHeight() * UI_BASE_HEIGHT); m_background.SetWidth (m_background.GetHeight() * k); } Fvector2 map_center; m_clipFrame.GetWndRect().getcenter(map_center); m_background.SetWndPos (map_center); Fvector2 cp; cp.x = m_clipFrame.GetWidth()/2.0f; cp.y = m_clipFrame.GetHeight()/2.0f; m_center.SetWndPos (cp); Fvector2 rel_pos = m_compass.GetWndPos(); rel_pos.mul (m_background.GetWndSize()); m_compass.SetWndPos (rel_pos); rel_pos = m_clock_wnd->GetWndPos(); rel_pos.mul (m_background.GetWndSize()); m_clock_wnd->SetWndPos (rel_pos); if ( IsGameTypeSingle() ) { xml_init.InitStatic (uiXml, "minimap:static_counter", 0, &m_Counter); m_background.AttachChild (&m_Counter); xml_init.InitTextWnd (uiXml, "minimap:static_counter:text_static", 0, &m_Counter_text); m_Counter.AttachChild (&m_Counter_text); rel_pos = m_Counter.GetWndPos(); rel_pos.mul (m_background.GetWndSize()); m_Counter.SetWndPos (rel_pos); } }
void CUIFactionWarWnd::Init() { CUIXml xml; xml.Load( CONFIG_PATH, UI_PATH, PDA_FACTION_WAR_XML ); CUIXmlInit::InitWindow( xml, "main_wnd", 0, this ); m_background = UIHelper::CreateFrameLine( xml, "background", this ); m_center_background = UIHelper::CreateStatic( xml, "center_background", this ); m_target_static = UIHelper::CreateStatic( xml, "target_static", this ); m_target_caption = UIHelper::CreateStatic( xml, "target_caption", this ); //m_target_caption->SetElipsis( 1, 0 ); m_tc_pos = m_target_caption->GetWndPos(); m_target_desc = UIHelper::CreateStatic( xml, "target_decs", this ); m_td_pos = m_target_desc->GetWndPos(); m_state_static = UIHelper::CreateStatic( xml, "state_static", this ); m_our_icon = UIHelper::CreateStatic( xml, "static_our_icon", this ); m_our_icon_over = UIHelper::CreateStatic( xml, "static_our_icon_over", this ); m_our_name = UIHelper::CreateStatic( xml, "static_our_name", this ); m_st_our_frac_info = UIHelper::CreateStatic( xml, "static_our_frac_info", this ); m_st_our_mem_count = UIHelper::CreateStatic( xml, "static_our_mem_count", this ); m_st_our_resource = UIHelper::CreateStatic( xml, "static_our_resource", this ); m_pb_our_state = UIHelper::CreateProgressBar( xml, "progress_our_state", this ); m_pb_our_mem_count = UIHelper::CreateProgressBar( xml, "progress_our_mem_count", this ); m_pb_our_resource = UIHelper::CreateProgressBar( xml, "progress_our_resource", this ); m_enemy_icon = UIHelper::CreateStatic( xml, "static_enemy_icon", this ); m_enemy_icon_over = UIHelper::CreateStatic( xml, "static_enemy_icon_over", this ); m_enemy_name = UIHelper::CreateStatic( xml, "static_enemy_name", this ); m_st_enemy_frac_info = UIHelper::CreateStatic( xml, "static_enemy_frac_info", this ); m_st_enemy_mem_count = UIHelper::CreateStatic( xml, "static_enemy_mem_count", this ); m_st_enemy_resource = UIHelper::CreateStatic( xml, "static_enemy_resource", this ); m_pb_enemy_state = UIHelper::CreateProgressBar( xml, "progress_enemy_state", this ); m_pb_enemy_mem_count = UIHelper::CreateProgressBar( xml, "progress_enemy_mem_count", this ); m_pb_enemy_resource = UIHelper::CreateProgressBar( xml, "progress_enemy_resource", this ); m_static_line1 = UIHelper::CreateFrameLine( xml, "static_line1", this ); m_static_line2 = UIHelper::CreateFrameLine( xml, "static_line2", this ); m_static_line3 = UIHelper::CreateFrameLine( xml, "static_line3", this ); m_static_line4 = UIHelper::CreateFrameLine( xml, "static_line4", this ); m_static_line_left = UIHelper::CreateFrameLine( xml, "static_line_left", this ); m_static_line_right = UIHelper::CreateFrameLine( xml, "static_line_right", this ); VERIFY( hint_wnd ); m_war_states_parent = new CUIWindow(); m_war_states_parent->SetAutoDelete( true ); AttachChild( m_war_states_parent ); Fvector2 pos; pos.x = xml.ReadAttribFlt( "static_vs_state", 0, "x" ); pos.y = xml.ReadAttribFlt( "static_vs_state", 0, "y" ); m_war_states_parent->SetWndPos( pos ); for ( u8 i = 0; i < max_war_state; ++i ) { m_war_state[i] = new UIWarState(); m_war_state[i]->InitXML( xml, "static_vs_state", m_war_states_parent ); m_war_state[i]->set_hint_wnd( hint_wnd ); } float dx = xml.ReadAttribFlt( "static_vs_state", 0, "dx" ); m_war_states_dx = dx; m_war_states_xcenter = xml.ReadAttribFlt( "static_vs_state", 0, "xcenter", 511.0f ); pos.set( 0.0f, 0.0f ); m_war_state[0]->SetWndPos( pos ); for ( u8 i = 1; i < max_war_state; ++i ) { pos.x += m_war_state[i-1]->GetWndSize().x + dx; m_war_state[i]->SetWndPos( pos ); } for ( u8 i = 0; i < max_bonuce; ++i ) { m_our_bonuces[i] = UIHelper::CreateStatic( xml, "static_our_bonuce", this ); } dx = xml.ReadAttribFlt( "static_our_bonuce", 0, "dx" ); pos = m_our_bonuces[0]->GetWndPos(); for ( u8 i = 1; i < max_bonuce; ++i ) { pos.x += m_our_bonuces[i-1]->GetWndSize().x + dx; m_our_bonuces[i]->SetWndPos( pos ); } for ( u8 i = 0; i < max_bonuce; ++i ) { m_enemy_bonuces[i] = UIHelper::CreateStatic( xml, "static_enemy_bonuce", this ); } dx = xml.ReadAttribFlt( "static_enemy_bonuce", 0, "dx" ); pos = m_enemy_bonuces[0]->GetWndPos(); for ( u8 i = 1; i < max_bonuce; ++i ) { pos.x += m_enemy_bonuces[i-1]->GetWndSize().x + dx; m_enemy_bonuces[i]->SetWndPos( pos ); } int delay = xml.ReadAttribInt( "main_wnd", 0, "update_delay", 3000 ); m_update_delay = (0 < delay)? (u32)delay : 0; }