DayZ 1.24
Loading...
Searching...
No Matches
CargoContainerRow.c
Go to the documentation of this file.
2{
3 protected int m_NumberRow;
4 protected int m_NumberColumnFocused;
5 protected int m_Width;
6 protected int m_MaxColumns;
7
8 protected EntityAI m_Entity;
9
10 protected CargoContainer m_ParentContainer;
13
15 {
16 m_ParentContainer = CargoContainer.Cast(parent);
17#ifdef PLATFORM_CONSOLE
18 m_MaxColumns = 5;
19#else
20 m_MaxColumns = 10;
21#endif
22
23 for (int i = 0; i < m_MaxColumns; i++)
24 {
25 Widget iconWidget = GetMainWidget().FindAnyWidget("Icon" + i);
26
27 iconWidget.SetUserID(i);
28
29 WidgetEventHandler.GetInstance().RegisterOnDropReceived(iconWidget, this, "DropReceived");
30 WidgetEventHandler.GetInstance().RegisterOnDraggingOver(iconWidget, this, "DraggingOver");
31 }
32
33 m_RootWidget.GetScript(m_Resizer1);
34 m_RootWidget.FindAnyWidget("SpacerTop").GetScript(m_Resizer2);
35 }
36
38 {
39 for (int i = 0; i < m_MaxColumns; i++)
40 {
41 //GetMainWidget().FindAnyWidget( "Cursor" + i ).Show( false );
42#ifdef PLATFORM_WINDOWS
43#ifndef PLATFORM_CONSOLE
44#ifndef SERVER_FOR_CONSOLE
45 CargoGrid grid = CargoGrid.Cast(m_Entity.GetInventory().GetCargo());
46 if (grid)
47 {
48
49 EntityAI entity = grid.FindEntityInCargoOn(m_NumberRow, i);
50 if (entity)
51 {
53
54 if (icon)
55 icon.SetActive(false);
56 }
57 else
58 GetMainWidget().FindAnyWidget("Cursor" + i).Show(false);
59 }
60#endif
61#endif
62#endif
63 }
64
66 }
67
68 void SetFocus(int column)
69 {
71
72 //GetMainWidget().FindAnyWidget( "Cursor" + column ).Show( true );
73
74 // Show selector
75#ifdef PLATFORM_WINDOWS
76#ifndef PLATFORM_CONSOLE
77#ifndef SERVER_FOR_CONSOLE
78 CargoGrid grid = CargoGrid.Cast(m_Entity.GetInventory().GetCargo());
79 if (grid)
80 {
83 {
85
86 if (icon)
87 icon.SetActive(true);
88 }
89 else
90 GetMainWidget().FindAnyWidget("Cursor" + column).Show(true);
91 }
92#endif
93#endif
94#endif
95 }
96
97 bool GetIconSize(int row, int column, out int width, out int height)
98 {
99#ifdef PLATFORM_WINDOWS
100#ifndef PLATFORM_CONSOLE
101#ifndef SERVER_FOR_CONSOLE
102 CargoGrid grid = CargoGrid.Cast(m_Entity.GetInventory().GetCargo());
103 if (grid)
104 {
105 EntityAI focused_item_new = grid.FindEntityInCargoOn(row, column);
107 {
109
110 if (icon)
111 {
112 width = icon.GetSizeX();
113 height = icon.GetSizeY();
114
115 return true;
116 }
117 }
118 }
119#endif
120#endif
121#endif
122
123 return false;
124 }
125
127 {
129 }
130
131 override void SetLayoutName()
132 {
133#ifdef PLATFORM_CONSOLE
135#else
136 switch (InventoryMenu.GetWidthType())
137 {
138 case ScreenWidthType.NARROW:
139 {
141 break;
142 }
143 case ScreenWidthType.MEDIUM:
144 {
146 break;
147 }
148 case ScreenWidthType.WIDE:
149 {
151
152 break;
153 }
154 }
155#endif
156
157 }
158
160 {
162 }
163
165 {
166 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
167 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, receiver.GetUserID());
168 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
169 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, receiver.GetUserID(), m_ParentContainer);
170 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
172 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
174 }
175
177 {
178 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
179 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, receiver.GetUserID(), null);
180 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
181 ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, receiver.GetUserID(), null, m_ParentContainer);
182 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
183 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, receiver.GetUserID(), null, m_ParentContainer);
184 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
185 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, receiver.GetUserID(), null, m_ParentContainer);
186 }
187
188 //NOT used - obsolete (all ColumnOnDraggingOver and Column methods)
191 {
192 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
193 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 0, null);
194 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
195 ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 0, null, m_ParentContainer);
196 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
197 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 0, null, m_ParentContainer);
198 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
199 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 0, null, m_ParentContainer);
200 }
201
203 {
204 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
205 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 1, null);
206 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
207 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 1, null, m_ParentContainer);
208 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
209 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 1, null, m_ParentContainer);
210 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
211 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 1, null, m_ParentContainer);
212 }
213
215 {
216 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
217 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 2, null);
218 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
219 ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 2, null, m_ParentContainer);
220 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
221 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 2, null, m_ParentContainer);
222 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
223 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 2, null, m_ParentContainer);
224 }
225
227 {
228 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
229 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 3, null);
230 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
231 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 3, null, m_ParentContainer);
232 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
233 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 3, null, m_ParentContainer);
234 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
235 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 3, null, m_ParentContainer);
236 }
237
239 {
240 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
241 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 4, null);
242 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
243 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 4, null, m_ParentContainer);
244 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
245 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 4, null, m_ParentContainer);
246 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
247 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 4, null, m_ParentContainer);
248 }
249
251 {
252 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
253 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 5, null);
254 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
255 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 5, null, m_ParentContainer);
256 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
257 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 5, null, m_ParentContainer);
258 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
259 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 5, null, m_ParentContainer);
260 }
261
263 {
264 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
265 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 6, null);
266 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
267 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 6, null, m_ParentContainer);
268 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
269 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 6, null, m_ParentContainer);
270 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
271 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 6, null, m_ParentContainer);
272 }
273
275 {
276 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
277 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 7, null);
278 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
279 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 7, null, m_ParentContainer);
280 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
281 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 7, null, m_ParentContainer);
282 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
283 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 7, null, m_ParentContainer);
284 }
285
287 {
288 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
289 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 8, null);
290 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
291 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 8, null, m_ParentContainer);
292 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
293 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 8, null, m_ParentContainer);
294 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
295 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 8, null, m_ParentContainer);
296 }
297
299 {
300 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
301 ContainerWithCargo.Cast(m_Parent.m_Parent).DraggingOverGrid(w, m_NumberRow, 9, null);
302 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
303 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 9, null, m_ParentContainer);
304 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
305 (HandsContainer.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 9, null, m_ParentContainer);
306 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
307 (AttachmentCategoriesRow.Cast(m_Parent.m_Parent)).DraggingOverGrid(w, m_NumberRow, 9, null, m_ParentContainer);
308 }
309
311 {
312 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
313 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 0);
314 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
315 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 0, m_ParentContainer);
316 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
318 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
320 }
321
323 {
324 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
325 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 1);
326 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
327 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 1, m_ParentContainer);
328 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
330 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
332 }
333
335 {
336 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
337 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 2);
338 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
339 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 2, m_ParentContainer);
340 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
342 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
344 }
345
347 {
348 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
349 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 3);
350 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
351 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 3, m_ParentContainer);
352 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
354 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
356 }
357
359 {
360 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
361 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 4);
362 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
363 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 4, m_ParentContainer);
364 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
366 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
368 }
369
371 {
372 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
373 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 5);
374 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
375 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 5, m_ParentContainer);
376 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
378 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
380 }
381
383 {
384 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
385 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 6);
386 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
387 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 6, m_ParentContainer);
388 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
390 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
392 }
393
395 {
396 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
397 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 7);
398 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
399 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 7, m_ParentContainer);
400 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
402 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
404 }
405
407 {
408 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
409 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 8);
410 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
411 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 8, m_ParentContainer);
412 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
414 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
416 }
417
419 {
420 if (m_Parent.m_Parent.IsInherited(ContainerWithCargo))
421 (ContainerWithCargo.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 9);
422 else if (m_Parent.m_Parent.IsInherited(ContainerWithCargoAndAttachments))
423 (ContainerWithCargoAndAttachments.Cast(m_Parent.m_Parent)).DropReceived(w, m_NumberRow, 9, m_ParentContainer);
424 else if (m_Parent.m_Parent.IsInherited(HandsContainer))
426 else if (m_Parent.m_Parent.IsInherited(AttachmentCategoriesRow))
428 }
430
431 override void OnShow()
432 {
433 GetRootWidget().Show(true);
434 }
435
436 override void OnHide()
437 {
438 GetRootWidget().Show(false);
439 }
440
442 {
444 }
445
447 {
448 return m_Width;
449 }
450
451 void SetWidth(int width, bool immedUpdate = true)
452 {
453 m_Width = width;
454 int i;
455
456 for (i = width; i < m_MaxColumns; i++)
457 {
458 GetMainWidget().FindAnyWidget("Icon" + i).Show(false, false);
459 GetMainWidget().FindAnyWidget("Spacer" + i).Show(false, false);
460 }
461
462 GetMainWidget().FindAnyWidget("Spacer10").Show(m_Width != 0, false);
463
464 if (immedUpdate)
465 {
466 m_Resizer2.Refresh();
467 GetMainWidget().Update();
468 }
469
470 m_Resizer1.ResizeParentToChild();
471 }
472}
Icon x
Icon y
ScreenWidthType
void InventoryMenu()
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Widget m_Parent
Definition SizeToChild.c:86
void Column8(Widget w)
override void OnShow()
!-—
void DraggingOver(Widget w, int x, int y, Widget receiver)
void ColumnOnDraggingOver9(Widget w)
void SetFocus(int column)
void ColumnOnDraggingOver7(Widget w)
override void SetLayoutName()
void Column6(Widget w)
void ColumnOnDraggingOver0(Widget w)
!-—
void Column0(Widget w)
void Column2(Widget w)
ref SizeToChild m_Resizer1
ref SizeToParent m_Resizer2
void ColumnOnDraggingOver5(Widget w)
void ColumnOnDraggingOver6(Widget w)
void SetEntity(EntityAI entity)
void SetWidth(int width, bool immedUpdate=true)
void Column3(Widget w)
void Column9(Widget w)
void DropReceived(Widget w, int x, int y, Widget receiver)
bool GetIconSize(int row, int column, out int width, out int height)
void ColumnOnDraggingOver8(Widget w)
void SetNumber(int number)
void Column1(Widget w)
void Column7(Widget w)
void CargoContainerRow(LayoutHolder parent)
CargoContainer m_ParentContainer
void ColumnOnDraggingOver4(Widget w)
void ColumnOnDraggingOver3(Widget w)
void Column5(Widget w)
void Column4(Widget w)
void ColumnOnDraggingOver1(Widget w)
void ColumnOnDraggingOver2(Widget w)
override void OnHide()
Definition Icon.c:2
static WidgetEventHandler GetInstance()
const string CargoContainerRowNarrow
const string CargoContainerRowMedium
const string CargoContainerRowWide
const string CargoContainerRowXbox