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 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 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 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 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 CServerList::InitFromXml(CUIXml& xml_doc, LPCSTR path) { CUIXmlInit::InitWindow (xml_doc, path, 0, this); string256 buf; CUIXmlInit::InitListWnd (xml_doc, strconcat(sizeof(buf),buf,path,":list"), 0, &m_list[LST_SERVER]); m_fListH[0] = m_list[LST_SERVER].GetHeight(); m_fListH[1] = xml_doc.ReadAttribFlt(buf,0,"height2"); CUIXmlInit::InitListWnd (xml_doc, strconcat(sizeof(buf),buf,path,":list_server_properties"), 0, &m_list[LST_SRV_PROP]); CUIXmlInit::InitListWnd (xml_doc, strconcat(sizeof(buf),buf,path,":list_players_list"), 0, &m_list[LST_PLAYERS]); CUIXmlInit::InitFrameWindow (xml_doc, strconcat(sizeof(buf),buf,path,":frame"), 0, &m_frame[LST_SERVER]); CUIXmlInit::InitFrameWindow (xml_doc, strconcat(sizeof(buf),buf,path,":list_server_properties:frame"), 0, &m_frame[LST_SRV_PROP]); CUIXmlInit::InitFrameWindow (xml_doc, strconcat(sizeof(buf),buf,path,":list_players_list:frame"), 0, &m_frame[LST_PLAYERS]); CUIXmlInit::InitFont (xml_doc, strconcat(sizeof(buf),buf,path,":list_item:text"), 0, m_itemInfo.color, m_itemInfo.font); CUIXmlInit::InitEditBox (xml_doc, strconcat(sizeof(buf),buf,path,":edit_gs_filter"), 0, &m_edit_gs_filter); m_fEditPos[0] = m_edit_gs_filter.GetWndPos().y; m_fEditPos[1] = xml_doc.ReadAttribFlt(buf,0,"y2"); CUIXmlInit::InitFrameLine (xml_doc, strconcat(sizeof(buf),buf,path,":cap_server_properties"), 0, &m_header2[0]); CUIXmlInit::InitFrameLine (xml_doc, strconcat(sizeof(buf),buf,path,":cap_players_list"), 0, &m_header2[1]); CUIXmlInit::InitFrameLine (xml_doc, strconcat(sizeof(buf),buf,path,":cap_frags"), 0, &m_header2[2]); CUIXmlInit::InitFrameLine (xml_doc, strconcat(sizeof(buf),buf,path,":cap_death"), 0, &m_header2[3]); m_itemInfo.size.icon = xml_doc.ReadAttribFlt( strconcat(sizeof(buf),buf, path, ":sizes"), 0, "icon"); m_itemInfo.size.server = xml_doc.ReadAttribFlt( buf, 0, "server"); m_itemInfo.size.map = xml_doc.ReadAttribFlt( buf, 0, "map"); m_itemInfo.size.game = xml_doc.ReadAttribFlt( buf, 0, "game"); m_itemInfo.size.players = xml_doc.ReadAttribFlt( buf, 0, "players"); m_itemInfo.size.ping = xml_doc.ReadAttribFlt( buf, 0, "ping"); m_itemInfo.size.version = xml_doc.ReadAttribFlt( buf, 0, "version"); // init header elements for (int i = 0; i<LST_COLUMN_COUNT; i++) { CUIXmlInit::Init3tButtonEx (xml_doc,strconcat(sizeof(buf),buf,path,":header"), 0, &m_header[i]); CUIXmlInit::InitFrameLine (xml_doc,strconcat(sizeof(buf),buf,path,":header_frames"), 0, &m_header_frames[i]); } m_header[0].Enable (false); InitHeader (); UpdateSizes (); UpdateVisibility (); }
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 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; }
void CUIItemInfo::Init(LPCSTR xml_name){ CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, xml_name); R_ASSERT2 (xml_result, "xml file not found"); CUIXmlInit xml_init; if(uiXml.NavigateToNode("main_frame",0)) { Frect wnd_rect; wnd_rect.x1 = uiXml.ReadAttribFlt("main_frame", 0, "x", 0); wnd_rect.y1 = uiXml.ReadAttribFlt("main_frame", 0, "y", 0); wnd_rect.x2 = uiXml.ReadAttribFlt("main_frame", 0, "width", 0); wnd_rect.y2 = uiXml.ReadAttribFlt("main_frame", 0, "height", 0); inherited::Init(wnd_rect.x1, wnd_rect.y1, wnd_rect.x2, wnd_rect.y2); } if(uiXml.NavigateToNode("static_name",0)) { UIName = xr_new<CUIStatic>(); AttachChild (UIName); UIName->SetAutoDelete (true); xml_init.InitStatic (uiXml, "static_name", 0, UIName); } if(uiXml.NavigateToNode("static_weight",0)) { UIWeight = xr_new<CUIStatic>(); AttachChild (UIWeight); UIWeight->SetAutoDelete(true); xml_init.InitStatic (uiXml, "static_weight", 0, UIWeight); } if(uiXml.NavigateToNode("static_cost",0)) { UICost = xr_new<CUIStatic>(); AttachChild (UICost); UICost->SetAutoDelete (true); xml_init.InitStatic (uiXml, "static_cost", 0, UICost); } if(uiXml.NavigateToNode("static_condition",0)) { UICondition = xr_new<CUIStatic>(); AttachChild (UICondition); UICondition->SetAutoDelete (true); xml_init.InitStatic (uiXml, "static_condition", 0, UICondition); } if(uiXml.NavigateToNode("condition_progress",0)) { UICondProgresBar = xr_new<CUIProgressBar>(); AttachChild(UICondProgresBar);UICondProgresBar->SetAutoDelete(true); xml_init.InitProgressBar (uiXml, "condition_progress", 0, UICondProgresBar); } if(uiXml.NavigateToNode("descr_list",0)) { UIWpnParams = xr_new<CUIWpnParams>(); UIArtefactParams = xr_new<CUIArtefactParams>(); UIWpnParams->InitFromXml (uiXml); UIArtefactParams->InitFromXml (uiXml); UIDesc = xr_new<CUIScrollView>(); AttachChild (UIDesc); UIDesc->SetAutoDelete (true); m_desc_info.bShowDescrText = !!uiXml.ReadAttribInt("descr_list",0,"only_text_info", 1); xml_init.InitScrollView (uiXml, "descr_list", 0, UIDesc); xml_init.InitFont (uiXml, "descr_list:font", 0, m_desc_info.uDescClr, m_desc_info.pDescFont); } if (uiXml.NavigateToNode("image_static", 0)) { UIItemImage = xr_new<CUIStatic>(); AttachChild (UIItemImage); UIItemImage->SetAutoDelete (true); xml_init.InitStatic (uiXml, "image_static", 0, UIItemImage); UIItemImage->TextureAvailable(true); UIItemImage->TextureOff (); UIItemImage->ClipperOn (); UIItemImageSize.set (UIItemImage->GetWidth(),UIItemImage->GetHeight()); } xml_init.InitAutoStaticGroup (uiXml, "auto", 0, this); }
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 CUIDetectorWave::InitFromXML(CUIXml& xml, LPCSTR path) { CUIXmlInit::InitFrameLine (xml, path, 0, this); m_step = xml.ReadAttribFlt(path,0,"step"); }