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

◆ ItemAttached()

void PlayerContainer::ItemAttached ( EntityAI item,
string slot_name )
inlineprotected

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

125 {
126 int slot = InventorySlots.GetSlotIdFromString( slot_name );
127 SlotsIcon icon = m_InventorySlots.Get( slot );
128
129 if( icon )
130 {
131 if( icon.IsReserved())
132 m_Player.GetOnAttachmentReleaseLock().Invoke(item, slot);
133
134 icon.Init( item );
135
136 if( m_ShowedItems.Contains( item ) == false )
137 {
138 string name;
139 int sort_index = Inventory.GetPlayerAttachmentIndex( slot );
140 int current_sort = 9999;
141 if( GetFocusedContainer() )
142 current_sort = GetFocusedContainer().GetRootWidget().GetSort();
143
144 if( item.GetSlotsCountCorrect() > 0 )
145 {
146 ContainerWithCargoAndAttachments iwca = new ContainerWithCargoAndAttachments( this, sort_index );
147 iwca.SetEntity( item );
148 iwca.SetSlotIcon( icon );
149 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "ToggleWidget" );
150
151 if( iwca.IsDisplayable() )
152 {
153 icon.GetRadialIconPanel().Show( true );
154 }
155 m_ShowedItems.Insert( item, iwca );
156 RecomputeOpenedContainers();
157 Refresh();
158 }
159 else if( item.GetInventory().GetCargo() )
160 {
161 ContainerWithCargo iwc = new ContainerWithCargo( this, sort_index );
162 iwc.SetEntity( item );
163 iwc.SetSlotIcon( icon );
164 iwc.UpdateInterval();
165 WidgetEventHandler.GetInstance().RegisterOnMouseButtonUp( icon.GetPanelWidget(), this, "ToggleWidget" );
166 m_ShowedItems.Insert( item, iwc );
167 RecomputeOpenedContainers();
168 if( iwc.IsDisplayable() )
169 icon.GetRadialIconPanel().Show(true);
170
171 Refresh();
172 }
173 }
174
175 ClosableContainer conta = ClosableContainer.Cast( m_ShowedItems.Get( item ) );
176 string config = "CfgVehicles " + item.GetType() + " GUIInventoryAttachmentsProps";
177 if( conta && conta.IsInherited( ClosableContainer ) )
178 {
179 bool show_radial_icon = ( item.GetInventory().GetCargo() || item.GetSlotsCountCorrect() > 0 ) && !GetGame().ConfigIsExisting( config );
180 Widget rip = icon.GetRadialIconPanel();
181
182 rip.Show( show_radial_icon );
183 SetOpenForSlotIcon(conta.IsOpened(),icon);
184 }
185 }
186 UpdateSelectionIcons();
187 }
void Inventory(LayoutHolder parent)
Определения Inventory.c:74
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
proto native bool ConfigIsExisting(string path)
override bool IsOpened()
Определения ContainerWithCargo.c:102
void ClosableContainer(LayoutHolder parent, int sort=-1)
Определения ClosableContainer.c:6
override void Refresh()
Определения PlayerContainer.c:1091
PlayerBase m_Player
Определения PlayerContainer.c:7
ref map< int, SlotsIcon > m_InventorySlots
Определения PlayerContainer.c:4
ref map< EntityAI, ref Container > m_ShowedItems
Определения PlayerContainer.c:5
Widget GetPanelWidget()
Определения SlotsIcon.c:205
void Init(EntityAI obj, bool reservation=false)
Определения SlotsIcon.c:501
bool IsReserved()
Определения SlotsIcon.c:200
Widget GetRadialIconPanel()
Определения SlotsIcon.c:300
proto native CGame GetGame()
WorkspaceWidget Widget
Defined in code.

Перекрестные ссылки Container::ClosableContainer(), CGame::ConfigIsExisting(), GetGame(), WidgetEventHandler::GetInstance(), SlotsIcon::GetPanelWidget(), SlotsIcon::GetRadialIconPanel(), InventorySlots::GetSlotIdFromString(), SlotsIcon::Init(), Inventory(), ClosableContainer::IsOpened(), SlotsIcon::IsReserved(), m_InventorySlots, m_Player, m_ShowedItems, name, Refresh() и WidgetEventHandler::RegisterOnMouseButtonUp().

Используется в SetPlayer() и ~PlayerContainer().