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

◆ AttachmentAddedEx()

void ClosableContainer::AttachmentAddedEx ( EntityAI item,
string slot,
EntityAI parent,
bool immedUpdate = true )
inlineprotected

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

129 {
130 int slot_id = InventorySlots.GetSlotIdFromString( slot );
131 int sort = -1;
132 bool updateNeeded = false;
133 ref Attachments att_cont = null;
134 ref CargoContainer cont = null;
135
136 if ( item.GetInventory().GetAttachmentSlotsCount() > 0 && item.CanDisplayAnyAttachmentSlot() )
137 {
138 updateNeeded = true;
139
140 att_cont = new Attachments( this, item );
141 sort = (m_AttachmentSlotsSorted.Find( slot_id ) * 2) + SORT_ATTACHMENTS_NEXT_OFFSET;
142 att_cont.InitAttachmentGrid( sort );
143 att_cont.SetAttachmentSlotID(slot_id);
144
145 m_AttachmentAttachments.Insert( item, att_cont );
146 m_AttachmentAttachmentsContainers.Insert( item, att_cont.GetWrapper() );
147
148 att_cont.UpdateInterval();
149 }
150
151 if ( item.GetInventory().GetCargo() )
152 {
153 updateNeeded = true;
154
155 cont = new CargoContainer( this, true );
156 sort = (m_AttachmentSlotsSorted.Find( slot_id ) * 2) + SORT_CARGO_NEXT_OFFSET;
157 cont.GetRootWidget().SetSort( sort );
158 cont.SetEntity( item, false );
159 cont.SetAttachmentSlotID(slot_id);
160 Insert( cont, m_Atts.GetAttachmentHeight() + m_AttachmentCargos.Count() + 1 );
161
162 m_AttachmentCargos.Insert( item, cont );
163 }
164
165 if (updateNeeded)
166 {
167 if (att_cont)
168 {
169 att_cont.ShowFalseAttachmentsHeader(true);
170 if (cont)
171 {
172 cont.ShowFalseCargoHeader(false);
173 cont.UpdateSize();
174 cont.SetAlternateFalseTextHeaderWidget(att_cont.GetFalseHeaderTextWidget());
175 }
176 }
177 else if (cont)
178 {
179 cont.SetAlternateFalseTextHeaderWidget(null); //just to be safe..
180 cont.UpdateSize();
181 }
182
184 RecomputeOpenedContainers();
185
186 Inventory.GetInstance().UpdateConsoleToolbar();
187
188 if (m_Parent && immedUpdate)
189 m_Parent.Refresh();
190 }
191 }
void Inventory(LayoutHolder parent)
Определения Inventory.c:74
Widget m_Parent
Определения SizeToChild.c:92
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
ref map< EntityAI, ref Attachments > m_AttachmentAttachments
ref map< EntityAI, ref AttachmentsWrapper > m_AttachmentAttachmentsContainers
ref Attachments m_Atts
ref array< int > m_AttachmentSlotsSorted

Перекрестные ссылки InventorySlots::GetSlotIdFromString(), Inventory(), m_AttachmentAttachments, m_AttachmentAttachmentsContainers, m_AttachmentCargos, m_AttachmentSlotsSorted, m_Atts, m_Parent и RecomputeContainers().

Используется в AttachmentAdded() и SetEntity().