DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ PlayerContainer()

void PlayerContainer::PlayerContainer ( LayoutHolder parent,
int sort = -1 )
inlineprotected

См. определение в файле PlayerContainer.c строка 34

35 {
37 m_PlayerAttachmentsContainer = new AttachmentsGroupContainer(this);
38
39 #ifndef PLATFORM_CONSOLE
40 RightArea rightArea = RightArea.Cast(GetParent());
41 if (rightArea)
42 {
43 rightArea.GetSlotsArea().AddChild(GetHeader().GetRootWidget());
44 rightArea.GetSlotsArea().AddChild(m_PlayerAttachmentsContainer.GetRootWidget());
45 }
46 #endif
47
49 m_CollapsibleHeader.SetName( "#container_inventory" );
50 SetHeader(null);
51 m_Body.Insert( m_PlayerAttachmentsContainer );
52 m_MainWidget = m_RootWidget.FindAnyWidget( "body" );
53 m_PlayerAttachmentsContainer.GetRootWidget().SetColor(166 << 24 | 80 << 16 | 80 << 8 | 80);
54 WidgetEventHandler.GetInstance().RegisterOnChildAdd( m_MainWidget, this, "OnChildAdd" );
55 WidgetEventHandler.GetInstance().RegisterOnChildRemove( m_MainWidget, this, "OnChildRemove" );
56
57 //START - InitGhostSlots
58 string config_path_ghosts_slots = "CfgVehicles SurvivorBase InventoryEquipment playerSlots";
59 ref array<string> player_ghosts_slots = new array<string>;
60 GetGame().ConfigGetTextArray( config_path_ghosts_slots, player_ghosts_slots );
61
62 for ( int i = 0; i < player_ghosts_slots.Count(); i++ )
63 {
64 string slot_name = player_ghosts_slots.Get ( i );
65 string path = "CfgSlots" + " " + slot_name;
66
67 if ( GetGame().ConfigIsExisting( path ) )
68 {
69 string icon_name; //icon_name must be in format "set:<setname> image:<imagename>"
70 GetGame().ConfigGetText( path + " ghostIcon", icon_name );
71 int slot_number = i;
72 int column = slot_number % ITEMS_IN_ROW;
73
74 //START - GetWidgetSlot
75 int row = slot_number / ITEMS_IN_ROW;
76 if( row >= m_PlayerAttachmentsContainer.Count() )
77 {
78 if( row < ( player_ghosts_slots.Count() / ITEMS_IN_ROW ) )
80 else
81 AddSlotsContainer( player_ghosts_slots.Count() % ITEMS_IN_ROW );
82 }
83
84 SlotsIcon icon = GetSlotsIcon( row, column );
85
86 icon.GetMainWidget().Show( true );
87 icon.Clear();
88
89 WidgetEventHandler.GetInstance().RegisterOnDoubleClick( icon.GetPanelWidget(), this, "DoubleClick" );
90
91 //END - GetWidgetSlot
92 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetPanelWidget(), this, "OnDropReceivedFromGhostArea" );
93 WidgetEventHandler.GetInstance().RegisterOnDropReceived( icon.GetGhostSlot(), this, "OnDropReceivedFromGhostArea" );
94 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetGhostSlot(), this, "DraggingOver" );
95 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( icon.GetPanelWidget(), this, "DraggingOver" );
96 WidgetEventHandler.GetInstance().RegisterOnMouseButtonDown( icon.GetPanelWidget(), this, "MouseClick" );
97
98 icon.GetGhostSlot().LoadImageFile( 0, StaticGUIUtils.VerifyIconImageString(StaticGUIUtils.IMAGESETGROUP_INVENTORY,icon_name) );
99 //END - LoadIconIntoWidgetSlot
100
101 GetGame().ConfigGetText( path + " name", slot_name );
102 int slot_id = InventorySlots.GetSlotIdFromString( slot_name );
103 icon.SetSlotID(slot_id);
104 icon.SetSlotDisplayName(InventorySlots.GetSlotDisplayName(slot_id));
105 m_InventorySlots.Set( slot_id, icon );
106 }
107 }
108 m_PlayerAttachmentsContainer.GetMainWidget().Update();
109 //END - InitGhostSlots
110 RecomputeOpenedContainers();
111 }
const int ITEMS_IN_ROW
Определения Attachments.c:1
map
Определения ControlsXboxNew.c:4
string path
Определения OptionSelectorMultistate.c:142
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Определения PluginRemotePlayerDebugClient.c:14
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
ref CollapsibleHeader m_CollapsibleHeader
Определения CollapsibleContainer.c:3
override Header GetHeader()
Определения CollapsibleContainer.c:176
override void SetHeader(Header header)
Определения CollapsibleContainer.c:181
SlotsIcon GetSlotsIcon(int row, int column)
Определения PlayerContainer.c:29
ref AttachmentsGroupContainer m_PlayerAttachmentsContainer
Определения PlayerContainer.c:3
void AddSlotsContainer(int row_count)
Определения PlayerContainer.c:230
ref map< int, SlotsIcon > m_InventorySlots
Определения PlayerContainer.c:4
Widget GetSlotsArea()
Определения RightArea.c:254
Widget GetPanelWidget()
Определения SlotsIcon.c:205
void SetSlotID(int slot_ID)
Определения SlotsIcon.c:195
void SetSlotDisplayName(string text)
Определения SlotsIcon.c:144
void Clear()
Определения SlotsIcon.c:612
ImageWidget GetGhostSlot()
Определения SlotsIcon.c:235
proto native CGame GetGame()
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407

Перекрестные ссылки AddSlotsContainer(), SlotsIcon::Clear(), CGame::ConfigGetText(), CGame::ConfigGetTextArray(), GetGame(), SlotsIcon::GetGhostSlot(), CollapsibleContainer::GetHeader(), WidgetEventHandler::GetInstance(), SlotsIcon::GetPanelWidget(), GetParent(), InventorySlots::GetSlotDisplayName(), InventorySlots::GetSlotIdFromString(), RightArea::GetSlotsArea(), GetSlotsIcon(), StaticGUIUtils::IMAGESETGROUP_INVENTORY, ITEMS_IN_ROW, CollapsibleContainer::m_CollapsibleHeader, m_InventorySlots, m_PlayerAttachmentsContainer, m_RootWidget, path, WidgetEventHandler::RegisterOnChildAdd(), WidgetEventHandler::RegisterOnChildRemove(), WidgetEventHandler::RegisterOnDoubleClick(), WidgetEventHandler::RegisterOnDraggingOver(), WidgetEventHandler::RegisterOnDropReceived(), WidgetEventHandler::RegisterOnMouseButtonDown(), CollapsibleContainer::SetHeader(), SlotsIcon::SetSlotDisplayName(), SlotsIcon::SetSlotID() и StaticGUIUtils::VerifyIconImageString().