void UITaskListWnd::init_from_xml( CUIXml& xml, LPCSTR path ) { VERIFY( hint_wnd ); CUIXmlInit::InitWindow( xml, path, 0, this ); XML_NODE* stored_root = xml.GetLocalRoot(); XML_NODE* tmpl_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( tmpl_root ); m_background = UIHelper::CreateFrameWindow( xml, "background_frame", this ); m_caption = UIHelper::CreateStatic( xml, "t_caption", this ); // m_counter = UIHelper::CreateStatic( xml, "t_counter", this ); m_bt_close = UIHelper::Create3tButton( xml, "btn_close", this ); Register( m_bt_close ); AddCallback( m_bt_close, BUTTON_DOWN, CUIWndCallback::void_function( this, &UITaskListWnd::OnBtnClose ) ); m_list = xr_new<CUIScrollView>(); m_list->SetAutoDelete( true ); AttachChild( m_list ); CUIXmlInit::InitScrollView( xml, "task_list", 0, m_list ); m_orig_h = GetHeight(); m_list->SetWindowName("---second_task_list"); m_list->m_sort_function = fastdelegate::MakeDelegate( this, &UITaskListWnd::SortingLessFunction ); xml.SetLocalRoot( stored_root ); }
void 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 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 ui_actor_state_item::init_from_xml( CUIXml& xml, LPCSTR path ) { CUIXmlInit::InitWindow( xml, path, 0, this); XML_NODE* stored_root = xml.GetLocalRoot(); XML_NODE* new_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( new_root ); LPCSTR hint_text = xml.Read( "hint_text", 0, "no hint" ); set_hint_text_ST( hint_text ); set_hint_delay( (u32)xml.ReadAttribInt( "hint_text", 0, "delay" ) ); if ( xml.NavigateToNode( "state_progress", 0 ) ) { m_progress = UIHelper::CreateProgressBar( xml, "state_progress", this ); } if ( xml.NavigateToNode( "progress_shape", 0 ) ) { m_sensor = xr_new<CUIProgressShape>(); AttachChild( m_sensor ); m_sensor->SetAutoDelete( true ); CUIXmlInit::InitProgressShape( xml, "progress_shape", 0, m_sensor ); } if ( xml.NavigateToNode( "arrow", 0 ) ) { m_arrow = xr_new<UI_Arrow>(); m_arrow->init_from_xml( xml, "arrow", this ); } if ( xml.NavigateToNode( "arrow_shadow", 0 ) ) { m_arrow_shadow = xr_new<UI_Arrow>(); m_arrow_shadow->init_from_xml( xml, "arrow_shadow", this ); } if ( xml.NavigateToNode( "icon", 0 ) ) { m_static = UIHelper::CreateStatic( xml, "icon", this ); // m_magnitude = xml.ReadAttribFlt( "icon", 0, "magnitude", 1.0f ); m_static->TextItemControl()->SetText(""); } if ( xml.NavigateToNode( "icon2", 0 ) ) { m_static2 = UIHelper::CreateStatic( xml, "icon2", this ); m_static2->TextItemControl()->SetText(""); } if ( xml.NavigateToNode( "icon3", 0 ) ) { m_static3 = UIHelper::CreateStatic( xml, "icon3", this ); m_static3->TextItemControl()->SetText(""); } set_arrow( 0.0f ); xml.SetLocalRoot( stored_root ); }
void UITeamState::Init(CUIXml& uiXml, LPCSTR teamNodeName, int index) { VERIFY(teamNodeName); mainUiXml = &uiXml; //warning ! teamXmlNode = uiXml.NavigateToNode(teamNodeName, index); VERIFY2(teamXmlNode, make_string("team xml node (%s) not found", teamNodeName).c_str()); CUIXmlInit::InitWindow(uiXml, teamNodeName, index, this); XML_NODE* tempRoot = uiXml.GetLocalRoot(); uiXml.SetLocalRoot(teamXmlNode); InitScrollPanels(); //CUIXmlInit::InitScrollView(uiXml, "scroll_panel", 0, myScrollList); //myTeamHeader->Init(uiXml, "team_header"); uiXml.SetLocalRoot(tempRoot); }
void 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 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 CUIInventoryWnd::Init() { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, INVENTORY_XML); R_ASSERT3 (xml_result, "file parsing error ", uiXml.m_xml_file_name); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main", 0, this); AttachChild (&UIBeltSlots); xml_init.InitStatic (uiXml, "belt_slots", 0, &UIBeltSlots); AttachChild (&UIBack); xml_init.InitStatic (uiXml, "back", 0, &UIBack); AttachChild (&UIStaticBottom); xml_init.InitStatic (uiXml, "bottom_static", 0, &UIStaticBottom); AttachChild (&UIBagWnd); xml_init.InitStatic (uiXml, "bag_static", 0, &UIBagWnd); AttachChild (&UIMoneyWnd); xml_init.InitStatic (uiXml, "money_static", 0, &UIMoneyWnd); AttachChild (&UIDescrWnd); xml_init.InitStatic (uiXml, "descr_static", 0, &UIDescrWnd); #ifndef INV_FLOAT_ITEM_INFO UIDescrWnd.AttachChild (&UIItemInfo); UIItemInfo.Init (0, 0, UIDescrWnd.GetWidth(), UIDescrWnd.GetHeight(), INVENTORY_ITEM_XML); #endif #ifdef INV_NEW_SLOTS_SYSTEM if (GameID() == GAME_SINGLE){ AttachChild (&UISleepWnd); UISleepWnd.Init(); UISleepWnd.SetWindowName("sleep_wnd"); // дл¤ лучшего нахождени¤ через GetStatic } #endif AttachChild (&UIPersonalWnd); xml_init.InitFrameWindow (uiXml, "character_frame_window", 0, &UIPersonalWnd); AttachChild (&UIProgressBack); xml_init.InitStatic (uiXml, "progress_background", 0, &UIProgressBack); if (GameID() != GAME_SINGLE){ AttachChild (&UIProgressBack_rank); xml_init.InitStatic (uiXml, "progress_back_rank", 0, &UIProgressBack_rank); UIProgressBack_rank.AttachChild (&UIProgressBarRank); xml_init.InitProgressBar (uiXml, "progress_bar_rank", 0, &UIProgressBarRank); UIProgressBarRank.SetProgressPos(100); } UIProgressBack.AttachChild (&UIProgressBarHealth); xml_init.InitProgressBar (uiXml, "progress_bar_health", 0, &UIProgressBarHealth); UIProgressBack.AttachChild (&UIProgressBarPsyHealth); xml_init.InitProgressBar (uiXml, "progress_bar_psy", 0, &UIProgressBarPsyHealth); UIProgressBack.AttachChild (&UIProgressBarRadiation); xml_init.InitProgressBar (uiXml, "progress_bar_radiation", 0, &UIProgressBarRadiation); #ifdef INV_NEW_SLOTS_SYSTEM if (GameID() == GAME_SINGLE){ UIProgressBack.AttachChild (&UIProgressBarSatiety); xml_init.InitProgressBar (uiXml, "progress_bar_satiety", 0, &UIProgressBarSatiety); } #endif UIPersonalWnd.AttachChild (&UIStaticPersonal); xml_init.InitStatic (uiXml, "static_personal",0, &UIStaticPersonal); // UIStaticPersonal.Init (1, UIPersonalWnd.GetHeight() - 175, 260, 260); AttachChild (&UIOutfitInfo); UIOutfitInfo.InitFromXml (uiXml); //. xml_init.InitStatic (uiXml, "outfit_info_window",0, &UIOutfitInfo); //Ёлементы автоматического добавлени¤ xml_init.InitAutoStatic (uiXml, "auto_static", this); if (GameID() != GAME_SINGLE){ UIRankFrame = xr_new<CUIStatic> (); UIRankFrame->SetAutoDelete(true); UIRank = xr_new<CUIStatic> (); UIRank->SetAutoDelete(true); CUIXmlInit::InitStatic(uiXml, "rank", 0, UIRankFrame); CUIXmlInit::InitStatic(uiXml, "rank:pic", 0, UIRank); AttachChild(UIRankFrame); UIRankFrame->AttachChild(UIRank); } m_pUIBagList = xr_new<CUIDragDropListEx>(); UIBagWnd.AttachChild(m_pUIBagList); m_pUIBagList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_bag", 0, m_pUIBagList); BindDragDropListEnents (m_pUIBagList); m_pUIBeltList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIBeltList); m_pUIBeltList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_belt", 0, m_pUIBeltList); BindDragDropListEnents (m_pUIBeltList); #if defined(INV_OUTFIT_FULL_ICON_HIDE) m_pUIOutfitList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIOutfitList); m_pUIOutfitList->SetAutoDelete(true); #else m_pUIOutfitList = xr_new<CUIOutfitDragDropList>(); AttachChild(m_pUIOutfitList); m_pUIOutfitList->SetAutoDelete(true); #endif xml_init.InitDragDropListEx (uiXml, "dragdrop_outfit", 0, m_pUIOutfitList); BindDragDropListEnents (m_pUIOutfitList); ZeroMemory(&m_slots_array, sizeof(m_slots_array)); #ifdef INV_NEW_SLOTS_SYSTEM m_pUIPistolList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPistolList); m_pUIPistolList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_slot_weapon_1", 0, m_pUIPistolList); BindDragDropListEnents(m_pUIPistolList); m_pUIAutomaticList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIAutomaticList); m_pUIAutomaticList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_slot_weapon_2", 0, m_pUIAutomaticList); BindDragDropListEnents(m_pUIAutomaticList); if (GameID() == GAME_SINGLE){ m_pUIKnifeList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIKnifeList); m_pUIKnifeList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_weapon_0", 0, m_pUIKnifeList); BindDragDropListEnents (m_pUIKnifeList); m_pUIBinocularList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIBinocularList); m_pUIBinocularList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_weapon_3", 0, m_pUIBinocularList); BindDragDropListEnents (m_pUIBinocularList); m_pUIDetectorList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIDetectorList); m_pUIDetectorList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_detector", 0, m_pUIDetectorList); BindDragDropListEnents (m_pUIDetectorList); m_pUITorchList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUITorchList); m_pUITorchList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_torch", 0, m_pUITorchList); BindDragDropListEnents (m_pUITorchList); m_pUIPDAList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPDAList); m_pUIPDAList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_pda", 0, m_pUIPDAList); BindDragDropListEnents (m_pUIPDAList); m_pUIHelmetList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIHelmetList); m_pUIHelmetList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_helmet", 0, m_pUIHelmetList); BindDragDropListEnents (m_pUIHelmetList); m_pUISlotQuickAccessList_0 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_0); m_pUISlotQuickAccessList_0->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_0", 0, m_pUISlotQuickAccessList_0); BindDragDropListEnents (m_pUISlotQuickAccessList_0); m_pUISlotQuickAccessList_1 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_1); m_pUISlotQuickAccessList_1->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_1", 0, m_pUISlotQuickAccessList_1); BindDragDropListEnents (m_pUISlotQuickAccessList_1); m_pUISlotQuickAccessList_2 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_2); m_pUISlotQuickAccessList_2->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_2", 0, m_pUISlotQuickAccessList_2); BindDragDropListEnents (m_pUISlotQuickAccessList_2); m_pUISlotQuickAccessList_3 = xr_new<CUIDragDropListEx>(); AttachChild(m_pUISlotQuickAccessList_3); m_pUISlotQuickAccessList_3->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_slot_quick_access_3", 0, m_pUISlotQuickAccessList_3); BindDragDropListEnents (m_pUISlotQuickAccessList_3); m_slots_array[KNIFE_SLOT] = m_pUIKnifeList; m_slots_array[APPARATUS_SLOT] = m_pUIBinocularList; m_slots_array[PDA_SLOT] = m_pUIPDAList; m_slots_array[DETECTOR_SLOT] = m_pUIDetectorList; m_slots_array[TORCH_SLOT] = m_pUITorchList; m_slots_array[HELMET_SLOT] = m_pUIHelmetList; m_slots_array[SLOT_QUICK_ACCESS_0] = m_pUISlotQuickAccessList_0; m_slots_array[SLOT_QUICK_ACCESS_1] = m_pUISlotQuickAccessList_1; m_slots_array[SLOT_QUICK_ACCESS_2] = m_pUISlotQuickAccessList_2; m_slots_array[SLOT_QUICK_ACCESS_3] = m_pUISlotQuickAccessList_3; } #else m_pUIPistolList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPistolList); m_pUIPistolList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_pistol", 0, m_pUIPistolList); BindDragDropListEnents(m_pUIPistolList); m_pUIAutomaticList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIAutomaticList); m_pUIAutomaticList->SetAutoDelete(true); xml_init.InitDragDropListEx(uiXml, "dragdrop_automatic", 0, m_pUIAutomaticList); BindDragDropListEnents(m_pUIAutomaticList); #endif m_slots_array[PISTOL_SLOT] = m_pUIPistolList; m_slots_array[RIFLE_SLOT] = m_pUIAutomaticList; m_slots_array[OUTFIT_SLOT] = m_pUIOutfitList; m_slots_array[GRENADE_SLOT] = NULL; m_slots_array[BOLT_SLOT] = NULL; m_slots_array[ARTEFACT_SLOT] = NULL; // m_pUIBeltList; //pop-up menu AttachChild (&UIPropertiesBox); UIPropertiesBox.Init (0,0,300,300); UIPropertiesBox.Hide (); AttachChild (&UIStaticTime); xml_init.InitStatic (uiXml, "time_static", 0, &UIStaticTime); UIStaticTime.AttachChild (&UIStaticTimeString); xml_init.InitStatic (uiXml, "time_static_str", 0, &UIStaticTimeString); UIExitButton = xr_new<CUI3tButton>();UIExitButton->SetAutoDelete(true); AttachChild (UIExitButton); xml_init.Init3tButton (uiXml, "exit_button", 0, UIExitButton); #ifdef INV_FLOAT_ITEM_INFO AttachChild (&UIItemInfo); UIItemInfo.Init (INVENTORY_ITEM_XML); #endif //Load sounds XML_NODE* stored_root = uiXml.GetLocalRoot (); uiXml.SetLocalRoot (uiXml.NavigateToNode ("action_sounds",0)); ::Sound->create (sounds[eInvSndOpen], uiXml.Read("snd_open", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvSndClose], uiXml.Read("snd_close", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToSlot], uiXml.Read("snd_item_to_slot", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToBelt], uiXml.Read("snd_item_to_belt", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToRuck], uiXml.Read("snd_item_to_ruck", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvProperties], uiXml.Read("snd_properties", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvDropItem], uiXml.Read("snd_drop_item", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvAttachAddon], uiXml.Read("snd_attach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvDetachAddon], uiXml.Read("snd_detach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemUse], uiXml.Read("snd_item_use", 0, NULL),st_Effect,sg_SourceType); uiXml.SetLocalRoot (stored_root); }
void CUIHudStatesWnd::InitFromXml( CUIXml& xml, LPCSTR path ) { CUIXmlInit::InitWindow( xml, path, 0, this ); XML_NODE* stored_root = xml.GetLocalRoot(); XML_NODE* new_root = xml.NavigateToNode( path, 0 ); xml.SetLocalRoot( new_root ); m_back = UIHelper::CreateStatic( xml, "back", this ); m_ui_health_bar = UIHelper::CreateProgressBar( xml, "progress_bar_health", this ); m_ui_stamina_bar = UIHelper::CreateProgressBar( xml, "progress_bar_stamina", this ); // m_back_v = UIHelper::CreateStatic( xml, "back_v", this ); // m_static_armor = UIHelper::CreateStatic( xml, "static_armor", this ); /* m_resist_back[ALife::infl_rad] = UIHelper::CreateStatic( xml, "resist_back_rad", this ); m_resist_back[ALife::infl_fire] = UIHelper::CreateStatic( xml, "resist_back_fire", this ); m_resist_back[ALife::infl_acid] = UIHelper::CreateStatic( xml, "resist_back_acid", this ); m_resist_back[ALife::infl_psi] = UIHelper::CreateStatic( xml, "resist_back_psi", this ); // electra = no has CStatic!! */ m_indik[ALife::infl_rad] = UIHelper::CreateStatic( xml, "indik_rad", this ); m_indik[ALife::infl_fire] = UIHelper::CreateStatic( xml, "indik_fire", this ); m_indik[ALife::infl_acid] = UIHelper::CreateStatic( xml, "indik_acid", this ); m_indik[ALife::infl_psi] = UIHelper::CreateStatic( xml, "indik_psi", this ); // m_lanim_name = xml.ReadAttrib( "indik_rad", 0, "light_anim", "" ); m_ui_weapon_cur_ammo = UIHelper::CreateTextWnd( xml, "static_cur_ammo", this ); m_ui_weapon_fmj_ammo = UIHelper::CreateTextWnd( xml, "static_fmj_ammo", this ); m_ui_weapon_ap_ammo = UIHelper::CreateTextWnd( xml, "static_ap_ammo", this ); m_fire_mode = UIHelper::CreateTextWnd( xml, "static_fire_mode", this ); m_ui_grenade = UIHelper::CreateTextWnd( xml, "static_grenade", this ); m_ui_weapon_icon = UIHelper::CreateStatic( xml, "static_wpn_icon", this ); m_ui_weapon_icon->SetShader( InventoryUtilities::GetEquipmentIconsShader() ); // m_ui_weapon_icon->Enable ( false ); m_ui_weapon_icon_rect = m_ui_weapon_icon->GetWndRect(); // m_ui_armor_bar = UIHelper::CreateProgressBar( xml, "progress_bar_armor", this ); // m_progress_self = xr_new<CUIProgressShape>(); // m_progress_self->SetAutoDelete(true); // AttachChild( m_progress_self ); // CUIXmlInit::InitProgressShape( xml, "progress", 0, m_progress_self ); // m_arrow = xr_new<UI_Arrow>(); // m_arrow_shadow = xr_new<UI_Arrow>(); // m_arrow->init_from_xml( xml, "arrow", this ); // m_arrow_shadow->init_from_xml( xml, "arrow_shadow", this ); // m_back_over_arrow = UIHelper::CreateStatic( xml, "back_over_arrow", this ); /* m_bleeding_lev1 = UIHelper::CreateStatic( xml, "bleeding_level_1", this ); m_bleeding_lev1->Show( false ); m_bleeding_lev2 = UIHelper::CreateStatic( xml, "bleeding_level_2", this ); m_bleeding_lev2->Show( false ); m_bleeding_lev3 = UIHelper::CreateStatic( xml, "bleeding_level_3", this ); m_bleeding_lev3->Show( false ); m_radiation_lev1 = UIHelper::CreateStatic( xml, "radiation_level_1", this ); m_radiation_lev1->Show( false ); m_radiation_lev2 = UIHelper::CreateStatic( xml, "radiation_level_2", this ); m_radiation_lev2->Show( false ); m_radiation_lev3 = UIHelper::CreateStatic( xml, "radiation_level_3", this ); m_radiation_lev3->Show( false ); for ( int i = 0; i < it_max; ++i ) { m_cur_state_LA[i] = true; SwitchLA( false, (ALife::EInfluenceType)i ); } */ xml.SetLocalRoot( stored_root ); }
void CUIInventoryWnd::Init() { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, INVENTORY_XML); R_ASSERT3 (xml_result, "file parsing error ", uiXml.m_xml_file_name); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main", 0, this); AttachChild (&UIBeltSlots); xml_init.InitStatic (uiXml, "belt_slots", 0, &UIBeltSlots); AttachChild (&UIBack); xml_init.InitStatic (uiXml, "back", 0, &UIBack); AttachChild (&UIStaticBottom); xml_init.InitStatic (uiXml, "bottom_static", 0, &UIStaticBottom); AttachChild (&UIBagWnd); xml_init.InitStatic (uiXml, "bag_static", 0, &UIBagWnd); AttachChild (&UIMoneyWnd); xml_init.InitStatic (uiXml, "money_static", 0, &UIMoneyWnd); AttachChild (&UIDescrWnd); xml_init.InitStatic (uiXml, "descr_static", 0, &UIDescrWnd); UIDescrWnd.AttachChild (&UIItemInfo); UIItemInfo.Init (0, 0, UIDescrWnd.GetWidth(), UIDescrWnd.GetHeight(), INVENTORY_ITEM_XML); AttachChild (&UIPersonalWnd); xml_init.InitFrameWindow (uiXml, "character_frame_window", 0, &UIPersonalWnd); AttachChild (&UIProgressBack); xml_init.InitStatic (uiXml, "progress_background", 0, &UIProgressBack); if (GameID() != GAME_SINGLE){ AttachChild (&UIProgressBack_rank); xml_init.InitStatic (uiXml, "progress_back_rank", 0, &UIProgressBack_rank); UIProgressBack_rank.AttachChild (&UIProgressBarRank); xml_init.InitProgressBar (uiXml, "progress_bar_rank", 0, &UIProgressBarRank); UIProgressBarRank.SetProgressPos(100); } UIProgressBack.AttachChild (&UIProgressBarHealth); xml_init.InitProgressBar (uiXml, "progress_bar_health", 0, &UIProgressBarHealth); UIProgressBack.AttachChild (&UIProgressBarPsyHealth); xml_init.InitProgressBar (uiXml, "progress_bar_psy", 0, &UIProgressBarPsyHealth); UIProgressBack.AttachChild (&UIProgressBarRadiation); xml_init.InitProgressBar (uiXml, "progress_bar_radiation", 0, &UIProgressBarRadiation); UIPersonalWnd.AttachChild (&UIStaticPersonal); xml_init.InitStatic (uiXml, "static_personal",0, &UIStaticPersonal); // UIStaticPersonal.Init (1, UIPersonalWnd.GetHeight() - 175, 260, 260); AttachChild (&UIOutfitInfo); UIOutfitInfo.InitFromXml (uiXml); //. xml_init.InitStatic (uiXml, "outfit_info_window",0, &UIOutfitInfo); //Ёлементы автоматического добавлени¤ xml_init.InitAutoStatic (uiXml, "auto_static", this); if (GameID() != GAME_SINGLE){ UIRankFrame = xr_new<CUIStatic> (); UIRankFrame->SetAutoDelete(true); UIRank = xr_new<CUIStatic> (); UIRank->SetAutoDelete(true); CUIXmlInit::InitStatic(uiXml, "rank", 0, UIRankFrame); CUIXmlInit::InitStatic(uiXml, "rank:pic", 0, UIRank); AttachChild(UIRankFrame); UIRankFrame->AttachChild(UIRank); } m_pUIBagList = xr_new<CUIDragDropListEx>(); UIBagWnd.AttachChild(m_pUIBagList); m_pUIBagList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_bag", 0, m_pUIBagList); BindDragDropListEnents (m_pUIBagList); m_pUIBeltList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIBeltList); m_pUIBeltList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_belt", 0, m_pUIBeltList); BindDragDropListEnents (m_pUIBeltList); m_pUIOutfitList = xr_new<CUIOutfitDragDropList>(); AttachChild(m_pUIOutfitList); m_pUIOutfitList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_outfit", 0, m_pUIOutfitList); BindDragDropListEnents (m_pUIOutfitList); m_pUIPistolList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIPistolList); m_pUIPistolList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_pistol", 0, m_pUIPistolList); BindDragDropListEnents (m_pUIPistolList); m_pUIAutomaticList = xr_new<CUIDragDropListEx>(); AttachChild(m_pUIAutomaticList); m_pUIAutomaticList->SetAutoDelete(true); xml_init.InitDragDropListEx (uiXml, "dragdrop_automatic", 0, m_pUIAutomaticList); BindDragDropListEnents (m_pUIAutomaticList); //pop-up menu AttachChild (&UIPropertiesBox); UIPropertiesBox.Init (0,0,300,300); UIPropertiesBox.Hide (); AttachChild (&UIStaticTime); xml_init.InitStatic (uiXml, "time_static", 0, &UIStaticTime); UIStaticTime.AttachChild (&UIStaticTimeString); xml_init.InitStatic (uiXml, "time_static_str", 0, &UIStaticTimeString); UIExitButton = xr_new<CUI3tButton>();UIExitButton->SetAutoDelete(true); AttachChild (UIExitButton); xml_init.Init3tButton (uiXml, "exit_button", 0, UIExitButton); //Load sounds XML_NODE* stored_root = uiXml.GetLocalRoot (); uiXml.SetLocalRoot (uiXml.NavigateToNode ("action_sounds",0)); ::Sound->create (sounds[eInvSndOpen], uiXml.Read("snd_open", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvSndClose], uiXml.Read("snd_close", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToSlot], uiXml.Read("snd_item_to_slot", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToBelt], uiXml.Read("snd_item_to_belt", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemToRuck], uiXml.Read("snd_item_to_ruck", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvProperties], uiXml.Read("snd_properties", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvDropItem], uiXml.Read("snd_drop_item", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvAttachAddon], uiXml.Read("snd_attach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvDetachAddon], uiXml.Read("snd_detach_addon", 0, NULL),st_Effect,sg_SourceType); ::Sound->create (sounds[eInvItemUse], uiXml.Read("snd_item_use", 0, NULL),st_Effect,sg_SourceType); uiXml.SetLocalRoot (stored_root); }
void 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 (); }