void CStringTable::Load (LPCSTR xml_file) { CUIXml uiXml; string_path xml_file_full; strconcat (sizeof(xml_file_full),xml_file_full, xml_file, ".xml"); string_path _s; strconcat (sizeof(_s),_s, STRING_TABLE_PATH, "\\", *(pData->m_sLanguage) ); bool xml_result = uiXml.Init(CONFIG_PATH, _s, xml_file_full); if(!xml_result) Debug.fatal(DEBUG_INFO,"string table xml file not found %s, for language %s", xml_file_full, *(pData->m_sLanguage)); //общий список всех записей таблицы в файле int string_num = uiXml.GetNodesNum (uiXml.GetRoot(), "string"); for(int i=0; i<string_num; ++i) { LPCSTR string_name = uiXml.ReadAttrib(uiXml.GetRoot(), "string", i, "id", NULL); VERIFY3 (pData->m_StringTable.find(string_name) == pData->m_StringTable.end(), "duplicate string table id", string_name); LPCSTR string_text = uiXml.Read(uiXml.GetRoot(), "string:text", i, NULL); if(m_bWriteErrorsToLog && string_text) Msg("[string table] '%s' no translation in '%s'", string_name, *(pData->m_sLanguage)); VERIFY3 (string_text, "string table entry does not has a text", string_name); STRING_VALUE str_val = ParseLine(string_text, string_name, true); pData->m_StringTable[string_name] = str_val; } }
void CUIStatsWnd::Init(LPCSTR XML) { CUIXml uiXml; if (XML) strcpy(XML_NAME, XML); else strcpy(XML_NAME, STATS_XML); bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, XML_NAME); R_ASSERT2(xml_result, "xml file not found"); CUIXmlInit xml_init; CUIWindow::Init(CUIXmlInit::ApplyAlignX(0, alCenter), CUIXmlInit::ApplyAlignY(0, alCenter), UI_BASE_WIDTH, UI_BASE_HEIGHT); // „итаем из xml файла параметры окна и контролов AttachChild(&UIFrameWnd); xml_init.InitFrameWindow(uiXml, "frame_window", 0, &UIFrameWnd); UIFrameWnd.AttachChild(&UIStatsList); xml_init.InitListWnd(uiXml, "list", 0, &UIStatsList); UIStatsList.SetMessageTarget(this); UIStatsList.EnableScrollBar(true); xml_init.InitMultiTextStatic(uiXml, "headers_mt_static", 0, &UIHeader); UIFrameWnd.AttachChild(&UIHeader); }
void 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 CUIEventsWnd::Init () { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "pda_events.xml"); R_ASSERT3 (xml_result, "xml file not found", "pda_events.xml"); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main_wnd", 0, this); m_UILeftFrame = xr_new<CUIFrameWindow>(); m_UILeftFrame->SetAutoDelete(true); AttachChild (m_UILeftFrame); xml_init.InitFrameWindow (uiXml, "main_wnd:left_frame", 0, m_UILeftFrame); m_UILeftHeader = xr_new<CUIFrameLineWnd>(); m_UILeftHeader->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_UILeftHeader); xml_init.InitFrameLine (uiXml, "main_wnd:left_frame:left_frame_header", 0, m_UILeftHeader); //. xml_init.InitAutoStaticGroup (uiXml, "main_wnd:left_frame",m_UILeftFrame); m_UIAnimation = xr_new<CUIAnimatedStatic>(); m_UIAnimation->SetAutoDelete(true); xml_init.InitAnimatedStatic (uiXml, "main_wnd:left_frame:left_frame_header:anim_static", 0, m_UIAnimation); m_UILeftHeader->AttachChild (m_UIAnimation); m_UIRightWnd = xr_new<CUIWindow>(); m_UIRightWnd->SetAutoDelete(true); AttachChild (m_UIRightWnd); xml_init.InitWindow (uiXml, "main_wnd:right_frame", 0, m_UIRightWnd); m_UIMapWnd = xr_new<CUIMapWnd>(); m_UIMapWnd->SetAutoDelete(false); m_UIMapWnd->Init ("pda_events.xml","main_wnd:right_frame:map_wnd"); m_UITaskInfoWnd = xr_new<CUITaskDescrWnd>(); m_UITaskInfoWnd->SetAutoDelete(false); m_UITaskInfoWnd->Init (&uiXml,"main_wnd:right_frame:task_descr_view"); m_ListWnd = xr_new<CUIScrollView>(); m_ListWnd->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_ListWnd); xml_init.InitScrollView (uiXml, "main_wnd:left_frame:list", 0, m_ListWnd); m_TaskFilter = xr_new<CUITabControl>(); m_TaskFilter->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_TaskFilter); xml_init.InitTabControl (uiXml, "main_wnd:left_frame:filter_tab", 0, m_TaskFilter); m_TaskFilter->SetWindowName ("filter_tab"); Register (m_TaskFilter); AddCallback ("filter_tab",TAB_CHANGED,CUIWndCallback::void_function(this,&CUIEventsWnd::OnFilterChanged)); /* m_primary_or_all_filter_btn = xr_new<CUI3tButton>(); m_primary_or_all_filter_btn->SetAutoDelete(true); m_UILeftFrame->AttachChild (m_primary_or_all_filter_btn); xml_init.Init3tButton (uiXml, "main_wnd:left_frame:primary_or_all", 0, m_primary_or_all_filter_btn); Register (m_primary_or_all_filter_btn); m_primary_or_all_filter_btn-> SetWindowName("btn_primary_or_all"); AddCallback ("btn_primary_or_all",BUTTON_CLICKED,boost::bind(&CUIEventsWnd::OnFilterChanged,this,_1,_2)); */ m_currFilter = eActiveTask; SetDescriptionMode (true); m_ui_task_item_xml.Init (CONFIG_PATH, UI_PATH, "job_item.xml"); }
void CUIMessagesWindow::Init(float x, float y, float width, float height){ CUIXml xml; u32 color; CGameFont* pFont; xml.Init(CONFIG_PATH, UI_PATH, "messages_window.xml"); m_pGameLog = xr_new<CUIGameLog>();m_pGameLog->SetAutoDelete(true); m_pGameLog->Show(true); AttachChild(m_pGameLog); if ( IsGameTypeSingle() ) { CUIXmlInit::InitScrollView(xml, "sp_log_list", 0, m_pGameLog); } else { m_pChatLog = xr_new<CUIGameLog>(); m_pChatLog->SetAutoDelete(true); m_pChatLog->Show (true); AttachChild (m_pChatLog); m_pChatWnd = xr_new<CUIChatWnd>(m_pChatLog); m_pChatWnd->SetAutoDelete(true); AttachChild (m_pChatWnd); CUIXmlInit::InitScrollView(xml, "mp_log_list", 0, m_pGameLog); CUIXmlInit::InitFont(xml, "mp_log_list:font", 0, color, pFont); m_pGameLog->SetTextAtrib(pFont, color); CUIXmlInit::InitScrollView(xml, "chat_log_list", 0, m_pChatLog); CUIXmlInit::InitFont(xml, "chat_log_list:font", 0, color, pFont); m_pChatLog->SetTextAtrib(pFont, color); m_pChatWnd->Init (xml); } }
CUIStatsListItem * CUIStatsWnd::AddItem() { CUIStatsListItem *pNewItem = xr_new<CUIStatsListItem>(); UIStatsList.AddItem<CUIListItem>(pNewItem); UIStatsList.ScrollToBegin(); CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, XML_NAME); R_ASSERT2(xml_result, "xml file not found"); pNewItem->XmlInit("list", uiXml); // pNewItem->SetMessageTarget(this); return pNewItem; }
void CUINewsWnd::Init(LPCSTR xml_name, LPCSTR start_from) { string512 pth; CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, xml_name); R_ASSERT3 (xml_result, "xml file not found", xml_name); CUIXmlInit xml_init; strconcat (pth,start_from,"list"); xml_init.InitWindow (uiXml, pth, 0, this); UIScrollWnd = xr_new<CUIScrollView>();UIScrollWnd->SetAutoDelete(true); AttachChild (UIScrollWnd); xml_init.InitScrollView (uiXml, pth, 0, UIScrollWnd); }
CUIGameAHunt::CUIGameAHunt() { CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, "ui_game_ahunt.xml"); if(m_pFragLimitIndicator) xr_delete(m_pFragLimitIndicator); m_pFragLimitIndicator = xr_new<CUIStatic>(); CUIXmlInit::InitStatic (uiXml, "fraglimit",0, m_pFragLimitIndicator); m_pReinforcementInidcator = xr_new<CUIProgressShape>(); CUIXmlInit::InitProgressShape (uiXml, "reinforcement", 0, m_pReinforcementInidcator); //------------------------------------------------------------- m_pBuySpawnMsgBox = NULL; }
void CUICellItem::init() { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "inventory_new.xml"); R_ASSERT3 (xml_result, "file parsing error ", uiXml.m_xml_file_name); 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_pConditionState = xr_new<CUIProgressBar>(); m_pConditionState->SetAutoDelete(true); AttachChild(m_pConditionState); CUIXmlInit::InitProgressBar(uiXml, "condition_progess_bar", 0, m_pConditionState); m_pConditionState->Show(true); }
void test_key (int dik) { if(dik==DIK_K) { if(!pUIFrame) { CUIXml uiXML; uiXML.Init(CONFIG_PATH, UI_PATH, "talk.xml"); pUIFrame = xr_new<CUIFrameWindow>(); CUIXmlInit::InitFrameWindow (uiXML, "frame_window", 0, pUIFrame); }else xr_delete(pUIFrame); } /* if(dik==DIK_K){ if(g_pTestFont){ g_pTestFont->Release(); g_pTestFont = NULL; g_pTextSprite->Release(); return; } HRESULT hr; static int _height = -12; static u32 _width = 0; static u32 _weigth = FW_BOLD; static BOOL _italic = FALSE; hr = D3DXCreateFont( HW.pDevice, _height, _width, _weigth, 1, _italic, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Times New Roman", &g_pTestFont ); D3DXCreateSprite( HW.pDevice, &g_pTextSprite ); g_pTestFont->PreloadText("This is a trivial call to ID3DXFont::DrawText", xr_strlen("This is a trivial call to ID3DXFont::DrawText")); } */ }
void CUIPdaMsgListItem::Init(float x, float y, float width, float height) { CUIStatic::Init (x, y, width, height); CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH,PDA_MSG_MAINGAME_CHAR); R_ASSERT2 (xml_result, "xml file not found"); CUIXmlInit xml_init; AttachChild (&UIIcon); xml_init.InitStatic (uiXml, "icon_static", 0, &UIIcon); AttachChild(&UIName); if(uiXml.NavigateToNode ("name_static",0)) xml_init.InitStatic (uiXml, "name_static", 0, &UIName); else { UIName.Show (false); UIName.Enable (false); } AttachChild (&UIMsgText); xml_init.InitStatic (uiXml, "text_static", 0, &UIMsgText); }
void CUIPdaListItem::Init(float x, float y, float width, float height) { inherited::Init (x, y, width, height); CUIXml uiXml; bool xml_result = uiXml.Init (CONFIG_PATH, UI_PATH, PDA_CONTACT_CHAR); R_ASSERT2 (xml_result, "xml file not found"); CUIXmlInit xml_init; UIInfo = xr_new<CUICharacterInfo> (); UIInfo->SetAutoDelete (true); AttachChild (UIInfo); UIInfo->Init (0, 0, width, height, PDA_CONTACT_CHAR); if (uiXml.NavigateToNode ("mask_frame_window", 0)) { UIMask = xr_new<CUIFrameWindow> (); UIMask->SetAutoDelete (true); xml_init.InitFrameWindow (uiXml, "mask_frame_window", 0, UIMask); UIInfo->UIIcon().SetMask (UIMask); } xml_init.InitAutoStaticGroup (uiXml,"pda_char_auto_statics", 0, this); }
void CUISequencer::Start(LPCSTR tutor_name) { VERIFY(m_items.size()==0); Device.seqFrame.Add (this, REG_PRIORITY_LOW-10000); Device.seqRender.Add (this, 3); m_UIWindow = xr_new<CUIWindow>(); CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, "game_tutorials.xml"); int items_count = uiXml.GetNodesNum (tutor_name,0,"item"); VERIFY(items_count>0); uiXml.SetLocalRoot (uiXml.NavigateToNode(tutor_name,0)); m_bPlayEachItem = !!uiXml.ReadInt("play_each_item",0,0); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "global_wnd", 0, m_UIWindow); //. xml_init.InitAutoStaticGroup(uiXml, "global_wnd", m_UIWindow); for(int i=0;i<items_count;++i){ LPCSTR _tp = uiXml.ReadAttrib ("item",i,"type",""); bool bVideo = 0==_stricmp(_tp,"video"); CUISequenceItem* pItem = 0; if (bVideo) pItem = xr_new<CUISequenceVideoItem>(this); else pItem = xr_new<CUISequenceSimpleItem>(this); m_items.push_back (pItem); pItem->Load (&uiXml,i); } CUISequenceItem* pCurrItem = m_items.front(); pCurrItem->Start (); m_pStoredInputReceiver = pInput->CurrentIR(); IR_Capture (); m_bActive = true; }
void 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 CUIPdaWnd::Init() { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH,PDA_XML); R_ASSERT3 (xml_result, "xml file not found", PDA_XML); CUIXmlInit xml_init; m_pActiveDialog = NULL; xml_init.InitWindow (uiXml, "main", 0, this); UIMainPdaFrame = xr_new<CUIStatic>(); UIMainPdaFrame->SetAutoDelete(true); AttachChild (UIMainPdaFrame); xml_init.InitStatic (uiXml, "background_static", 0, UIMainPdaFrame); //Ёлементы автоматического добавлени¤ xml_init.InitAutoStatic (uiXml, "auto_static", this); // Main buttons background UIMainButtonsBackground = xr_new<CUIFrameLineWnd>(); UIMainButtonsBackground->SetAutoDelete(true); UIMainPdaFrame->AttachChild(UIMainButtonsBackground); xml_init.InitFrameLine (uiXml, "mbbackground_frame_line", 0, UIMainButtonsBackground); // Timer background UITimerBackground = xr_new<CUIFrameLineWnd>(); UITimerBackground->SetAutoDelete(true); UIMainPdaFrame->AttachChild(UITimerBackground); xml_init.InitFrameLine (uiXml, "timer_frame_line", 0, UITimerBackground); // Oкно карты UIMapWnd = xr_new<CUIMapWnd>(); UIMapWnd->Init ("pda_map.xml","map_wnd"); if( IsGameTypeSingle() ) { // Oкно коммуникaции UIPdaContactsWnd = xr_new<CUIPdaContactsWnd>(); UIPdaContactsWnd->Init (); // Oкно новостей UIDiaryWnd = xr_new<CUIDiaryWnd>(); UIDiaryWnd->Init (); // ќкно энциклопедии UIEncyclopediaWnd = xr_new<CUIEncyclopediaWnd>(); UIEncyclopediaWnd->Init (); // ќкно статистики о актере UIActorInfo = xr_new<CUIActorInfoWnd>(); UIActorInfo->Init (); // ќкно рейтинга сталкеров UIStalkersRanking = xr_new<CUIStalkersRankingWnd>(); UIStalkersRanking->Init (); UIEventsWnd = xr_new<CUIEventsWnd>(); UIEventsWnd->Init (); } // Tab control UITabControl = xr_new<CUITabControl>(); UITabControl->SetAutoDelete(true); UIMainPdaFrame->AttachChild (UITabControl); xml_init.InitTabControl (uiXml, "tab", 0, UITabControl); UITabControl->SetMessageTarget(this); if(GameID()!=GAME_SINGLE){ UITabControl->GetButtonsVector()->at(0)->Enable(false); UITabControl->GetButtonsVector()->at(2)->Enable(false); UITabControl->GetButtonsVector()->at(3)->Enable(false); UITabControl->GetButtonsVector()->at(4)->Enable(false); UITabControl->GetButtonsVector()->at(5)->Enable(false); UITabControl->GetButtonsVector()->at(6)->Enable(false); } m_updatedSectionImage = xr_new<CUIStatic>(); xml_init.InitStatic (uiXml, "updated_section_static", 0, m_updatedSectionImage); m_oldSectionImage = xr_new<CUIStatic>(); xml_init.InitStatic (uiXml, "old_section_static", 0, m_oldSectionImage); m_pActiveSection = eptNoActiveTab; RearrangeTabButtons (UITabControl, m_sign_places_main); }
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 CUITradeWnd::Init() { CUIXml uiXml; bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, TRADE_XML); R_ASSERT3 (xml_result, "xml file not found", TRADE_XML); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main", 0, this); //статические элементы интерфейса AttachChild (&m_uidata->UIStaticTop); xml_init.InitStatic (uiXml, "top_background", 0, &m_uidata->UIStaticTop); AttachChild (&m_uidata->UIStaticBottom); xml_init.InitStatic (uiXml, "bottom_background", 0, &m_uidata->UIStaticBottom); //иконки с изображение нас и партнера по торговле AttachChild (&m_uidata->UIOurIcon); xml_init.InitStatic (uiXml, "static_icon", 0, &m_uidata->UIOurIcon); AttachChild (&m_uidata->UIOthersIcon); xml_init.InitStatic (uiXml, "static_icon", 1, &m_uidata->UIOthersIcon); m_uidata->UIOurIcon.AttachChild (&m_uidata->UICharacterInfoLeft); m_uidata->UICharacterInfoLeft.Init (0,0, m_uidata->UIOurIcon.GetWidth(), m_uidata->UIOurIcon.GetHeight(), TRADE_CHARACTER_XML); m_uidata->UIOthersIcon.AttachChild (&m_uidata->UICharacterInfoRight); m_uidata->UICharacterInfoRight.Init (0,0, m_uidata->UIOthersIcon.GetWidth(), m_uidata->UIOthersIcon.GetHeight(), TRADE_CHARACTER_XML); //Списки торговли AttachChild (&m_uidata->UIOurBagWnd); xml_init.InitStatic (uiXml, "our_bag_static", 0, &m_uidata->UIOurBagWnd); AttachChild (&m_uidata->UIOthersBagWnd); xml_init.InitStatic (uiXml, "others_bag_static", 0, &m_uidata->UIOthersBagWnd); m_uidata->UIOurBagWnd.AttachChild (&m_uidata->UIOurMoneyStatic); xml_init.InitStatic (uiXml, "our_money_static", 0, &m_uidata->UIOurMoneyStatic); m_uidata->UIOthersBagWnd.AttachChild(&m_uidata->UIOtherMoneyStatic); xml_init.InitStatic (uiXml, "other_money_static", 0, &m_uidata->UIOtherMoneyStatic); AttachChild (&m_uidata->UIOurTradeWnd); xml_init.InitStatic (uiXml, "static", 0, &m_uidata->UIOurTradeWnd); AttachChild (&m_uidata->UIOthersTradeWnd); xml_init.InitStatic (uiXml, "static", 1, &m_uidata->UIOthersTradeWnd); m_uidata->UIOurTradeWnd.AttachChild (&m_uidata->UIOurPriceCaption); xml_init.InitMultiTextStatic (uiXml, "price_mt_static", 0, &m_uidata->UIOurPriceCaption); m_uidata->UIOthersTradeWnd.AttachChild(&m_uidata->UIOthersPriceCaption); xml_init.InitMultiTextStatic (uiXml, "price_mt_static", 0, &m_uidata->UIOthersPriceCaption); //Списки Drag&Drop m_uidata->UIOurBagWnd.AttachChild (&m_uidata->UIOurBagList); xml_init.InitDragDropListEx (uiXml, "dragdrop_list", 0, &m_uidata->UIOurBagList); m_uidata->UIOthersBagWnd.AttachChild(&m_uidata->UIOthersBagList); xml_init.InitDragDropListEx (uiXml, "dragdrop_list", 1, &m_uidata->UIOthersBagList); m_uidata->UIOurTradeWnd.AttachChild (&m_uidata->UIOurTradeList); xml_init.InitDragDropListEx (uiXml, "dragdrop_list", 2, &m_uidata->UIOurTradeList); m_uidata->UIOthersTradeWnd.AttachChild(&m_uidata->UIOthersTradeList); xml_init.InitDragDropListEx (uiXml, "dragdrop_list", 3, &m_uidata->UIOthersTradeList); AttachChild (&m_uidata->UIDescWnd); xml_init.InitStatic (uiXml, "desc_static", 0, &m_uidata->UIDescWnd); #ifndef INV_FLOAT_ITEM_INFO m_uidata->UIDescWnd.AttachChild (&m_uidata->UIItemInfo); m_uidata->UIItemInfo.Init (0,0, m_uidata->UIDescWnd.GetWidth(), m_uidata->UIDescWnd.GetHeight(), TRADE_ITEM_XML); #endif xml_init.InitAutoStatic (uiXml, "auto_static", this); AttachChild (&m_uidata->UIPerformTradeButton); xml_init.Init3tButton (uiXml, "button", 0, &m_uidata->UIPerformTradeButton); AttachChild (&m_uidata->UIToTalkButton); xml_init.Init3tButton (uiXml, "button", 1, &m_uidata->UIToTalkButton); #ifdef INV_FLOAT_ITEM_INFO AttachChild (&m_uidata->UIItemInfo); m_uidata->UIItemInfo.Init (TRADE_ITEM_XML); #endif m_uidata->UIDealMsg = NULL; BindDragDropListEnents (&m_uidata->UIOurBagList); BindDragDropListEnents (&m_uidata->UIOthersBagList); BindDragDropListEnents (&m_uidata->UIOurTradeList); BindDragDropListEnents (&m_uidata->UIOthersTradeList); }
void CUICarBodyWnd::Init() { CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, CAR_BODY_XML); CUIXmlInit xml_init; xml_init.InitWindow (uiXml, "main", 0, this); m_pUIStaticTop = xr_new<CUIStatic>(); m_pUIStaticTop->SetAutoDelete(true); AttachChild (m_pUIStaticTop); xml_init.InitStatic (uiXml, "top_background", 0, m_pUIStaticTop); m_pUIStaticBottom = xr_new<CUIStatic>(); m_pUIStaticBottom->SetAutoDelete(true); AttachChild (m_pUIStaticBottom); xml_init.InitStatic (uiXml, "bottom_background", 0, m_pUIStaticBottom); m_pUIOurIcon = xr_new<CUIStatic>(); m_pUIOurIcon->SetAutoDelete(true); AttachChild (m_pUIOurIcon); xml_init.InitStatic (uiXml, "static_icon", 0, m_pUIOurIcon); m_pUIOthersIcon = xr_new<CUIStatic>(); m_pUIOthersIcon->SetAutoDelete(true); AttachChild (m_pUIOthersIcon); xml_init.InitStatic (uiXml, "static_icon", 1, m_pUIOthersIcon); m_pUICharacterInfoLeft = xr_new<CUICharacterInfo>(); m_pUICharacterInfoLeft->SetAutoDelete(true); m_pUIOurIcon->AttachChild (m_pUICharacterInfoLeft); m_pUICharacterInfoLeft->Init(0,0, m_pUIOurIcon->GetWidth(), m_pUIOurIcon->GetHeight(), "trade_character.xml"); m_pUICharacterInfoRight = xr_new<CUICharacterInfo>(); m_pUICharacterInfoRight->SetAutoDelete(true); m_pUIOthersIcon->AttachChild (m_pUICharacterInfoRight); m_pUICharacterInfoRight->Init (0,0, m_pUIOthersIcon->GetWidth(), m_pUIOthersIcon->GetHeight(), "trade_character.xml"); m_pUIOurBagWnd = xr_new<CUIStatic>(); m_pUIOurBagWnd->SetAutoDelete(true); AttachChild (m_pUIOurBagWnd); xml_init.InitStatic (uiXml, "our_bag_static", 0, m_pUIOurBagWnd); m_pUIOthersBagWnd = xr_new<CUIStatic>(); m_pUIOthersBagWnd->SetAutoDelete(true); AttachChild (m_pUIOthersBagWnd); xml_init.InitStatic (uiXml, "others_bag_static", 0, m_pUIOthersBagWnd); m_pUIOurBagList = xr_new<CUIDragDropListEx>(); m_pUIOurBagList->SetAutoDelete(true); m_pUIOurBagWnd->AttachChild (m_pUIOurBagList); xml_init.InitDragDropListEx (uiXml, "dragdrop_list_our", 0, m_pUIOurBagList); m_pUIOthersBagList = xr_new<CUIDragDropListEx>(); m_pUIOthersBagList->SetAutoDelete(true); m_pUIOthersBagWnd->AttachChild (m_pUIOthersBagList); xml_init.InitDragDropListEx (uiXml, "dragdrop_list_other", 0, m_pUIOthersBagList); //информация о предмете m_pUIDescWnd = xr_new<CUIFrameWindow>(); m_pUIDescWnd->SetAutoDelete(true); AttachChild (m_pUIDescWnd); xml_init.InitFrameWindow (uiXml, "frame_window", 0, m_pUIDescWnd); m_pUIStaticDesc = xr_new<CUIStatic>(); m_pUIStaticDesc->SetAutoDelete(true); m_pUIDescWnd->AttachChild (m_pUIStaticDesc); xml_init.InitStatic (uiXml, "descr_static", 0, m_pUIStaticDesc); m_pUIItemInfo = xr_new<CUIItemInfo>(); m_pUIItemInfo->SetAutoDelete(true); m_pUIDescWnd->AttachChild (m_pUIItemInfo); m_pUIItemInfo->Init (0,0, m_pUIDescWnd->GetWidth(), m_pUIDescWnd->GetHeight(), CARBODY_ITEM_XML); xml_init.InitAutoStatic (uiXml, "auto_static", this); m_pUIPropertiesBox = xr_new<CUIPropertiesBox>(); m_pUIPropertiesBox->SetAutoDelete(true); AttachChild (m_pUIPropertiesBox); m_pUIPropertiesBox->Init (0,0,300,300); m_pUIPropertiesBox->Hide (); SetCurrentItem (NULL); m_pUIStaticDesc->SetText (NULL); m_pUITakeAll = xr_new<CUI3tButton>(); m_pUITakeAll->SetAutoDelete(true); AttachChild (m_pUITakeAll); xml_init.Init3tButton (uiXml, "take_all_btn", 0, m_pUITakeAll); BindDragDropListEnents (m_pUIOurBagList); BindDragDropListEnents (m_pUIOthersBagList); }
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 CUIMainIngameWnd::Init() { CUIXml uiXml; uiXml.Init (CONFIG_PATH, UI_PATH, MAININGAME_XML); CUIXmlInit xml_init; CUIWindow::Init (0,0, UI_BASE_WIDTH, UI_BASE_HEIGHT); Enable(false); AttachChild (&UIStaticHealth); xml_init.InitStatic (uiXml, "static_health", 0, &UIStaticHealth); AttachChild (&UIStaticArmor); xml_init.InitStatic (uiXml, "static_armor", 0, &UIStaticArmor); AttachChild (&UIWeaponBack); xml_init.InitStatic (uiXml, "static_weapon", 0, &UIWeaponBack); UIWeaponBack.AttachChild (&UIWeaponSignAmmo); xml_init.InitStatic (uiXml, "static_ammo", 0, &UIWeaponSignAmmo); UIWeaponSignAmmo.SetElipsis (CUIStatic::eepEnd, 2); UIWeaponBack.AttachChild (&UIWeaponIcon); xml_init.InitStatic (uiXml, "static_wpn_icon", 0, &UIWeaponIcon); UIWeaponIcon.SetShader (GetEquipmentIconsShader()); UIWeaponIcon_rect = UIWeaponIcon.GetWndRect(); //--------------------------------------------------------- AttachChild (&UIPickUpItemIcon); xml_init.InitStatic (uiXml, "pick_up_item", 0, &UIPickUpItemIcon); UIPickUpItemIcon.SetShader (GetEquipmentIconsShader()); UIPickUpItemIcon.Show (false); m_iPickUpItemIconWidth = UIPickUpItemIcon.GetWidth(); m_iPickUpItemIconHeight = UIPickUpItemIcon.GetHeight(); m_iPickUpItemIconX = UIPickUpItemIcon.GetWndRect().left; m_iPickUpItemIconY = UIPickUpItemIcon.GetWndRect().top; //--------------------------------------------------------- UIWeaponIcon.Enable (false); //индикаторы UIZoneMap->Init (); UIZoneMap->SetScale (DEFAULT_MAP_SCALE); if(IsGameTypeSingle()) { xml_init.InitStatic (uiXml, "static_pda_online", 0, &UIPdaOnline); UIZoneMap->Background().AttachChild (&UIPdaOnline); } //Полоса прогресса здоровья UIStaticHealth.AttachChild (&UIHealthBar); //. xml_init.InitAutoStaticGroup(uiXml,"static_health", &UIStaticHealth); xml_init.InitProgressBar (uiXml, "progress_bar_health", 0, &UIHealthBar); //Полоса прогресса армора UIStaticArmor.AttachChild (&UIArmorBar); //. xml_init.InitAutoStaticGroup(uiXml,"static_armor", &UIStaticArmor); xml_init.InitProgressBar (uiXml, "progress_bar_armor", 0, &UIArmorBar); // Подсказки, которые возникают при наведении прицела на объект AttachChild (&UIStaticQuickHelp); xml_init.InitStatic (uiXml, "quick_info", 0, &UIStaticQuickHelp); uiXml.SetLocalRoot (uiXml.GetRoot()); m_UIIcons = xr_new<CUIScrollView>(); m_UIIcons->SetAutoDelete(true); xml_init.InitScrollView (uiXml, "icons_scroll_view", 0, m_UIIcons); AttachChild (m_UIIcons); // Загружаем иконки if(IsGameTypeSingle()) { xml_init.InitStatic (uiXml, "starvation_static", 0, &UIStarvationIcon); UIStarvationIcon.Show (false); xml_init.InitStatic (uiXml, "psy_health_static", 0, &UIPsyHealthIcon); UIPsyHealthIcon.Show (false); } xml_init.InitStatic (uiXml, "weapon_jammed_static", 0, &UIWeaponJammedIcon); UIWeaponJammedIcon.Show (false); xml_init.InitStatic (uiXml, "radiation_static", 0, &UIRadiaitionIcon); UIRadiaitionIcon.Show (false); xml_init.InitStatic (uiXml, "wound_static", 0, &UIWoundIcon); UIWoundIcon.Show (false); xml_init.InitStatic (uiXml, "invincible_static", 0, &UIInvincibleIcon); UIInvincibleIcon.Show (false); if(GameID()==GAME_ARTEFACTHUNT){ xml_init.InitStatic (uiXml, "artefact_static", 0, &UIArtefactIcon); UIArtefactIcon.Show (false); } shared_str warningStrings[6] = { "jammed", "radiation", "wounds", "starvation", "fatigue", "invincible" }; // Загружаем пороговые значения для индикаторов EWarningIcons j = ewiWeaponJammed; while (j < ewiInvincible) { // Читаем данные порогов для каждого индикатора shared_str cfgRecord = pSettings->r_string("main_ingame_indicators_thresholds", *warningStrings[static_cast<int>(j) - 1]); u32 count = _GetItemCount(*cfgRecord); char singleThreshold[8]; float f = 0; for (u32 k = 0; k < count; ++k) { _GetItem(*cfgRecord, k, singleThreshold); sscanf(singleThreshold, "%f", &f); m_Thresholds[j].push_back(f); } j = static_cast<EWarningIcons>(j + 1); } // Flashing icons initialize uiXml.SetLocalRoot (uiXml.NavigateToNode("flashing_icons")); InitFlashingIcons (&uiXml); uiXml.SetLocalRoot (uiXml.GetRoot()); AttachChild (&UICarPanel); xml_init.InitWindow (uiXml, "car_panel", 0, &UICarPanel); AttachChild (&UIMotionIcon); UIMotionIcon.Init (); if(IsGameTypeSingle()) { m_artefactPanel->InitFromXML (uiXml, "artefact_panel", 0); this->AttachChild (m_artefactPanel); } AttachChild (&UIStaticDiskIO); UIStaticDiskIO.SetWndRect (1000,750,16,16); UIStaticDiskIO.GetUIStaticItem().SetRect(0,0,16,16); UIStaticDiskIO.InitTexture ("ui\\ui_disk_io"); UIStaticDiskIO.SetOriginalRect (0,0,32,32); UIStaticDiskIO.SetStretchTexture (TRUE); HUD_SOUND::LoadSound ("maingame_ui", "snd_new_contact" , m_contactSnd , SOUND_TYPE_IDLE); }