DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
Container.c
См. документацию.
2{
5 protected int m_ActiveIndex = 0;
6 protected bool m_LastIndex; //deprecated
7 protected bool m_Closed;
9 protected float m_PrevAlpha;
10 const int ITEMS_IN_ROW = 8;
11
12 //protected int m_RowCount;
13 protected int m_ColumnCount;
14
15 protected int m_FocusedColumn = 0;
16 protected bool m_ForcedHide;
17 protected bool m_ForcedShow; //used to override displayability condition, but 'm_ForcedHide' takes preference
18
20 protected EntityAI m_Entity;
21
22 const int SORT_ATTACHMENTS_OWN = 1; //direct attachments of the parent item
23 const int SORT_CARGO_OWN = 2; //cargo of the parent item
26
27 void OnDropReceivedFromHeader( Widget w, int x, int y, Widget receiver );
28 void DraggingOver( Widget w, int x, int y, Widget receiver );
29 void DraggingOverHeader( Widget w, int x, int y, Widget receiver );
32 void SetHeader(Header header);
34
35 void Container( LayoutHolder parent )
36 {
39 m_PrevAlpha = m_RootWidget.GetAlpha();
40 m_SlotIcon = null;
41 m_ForcedHide = false;
42 m_ForcedShow = false;
43
44 m_ActiveIndex = 0;
45 m_IsActive = false;
46 }
47
49 {
51 {
53 }
54 return null;
55 }
56
58 {
59 if (index < m_Body.Count())
60 {
61 return Container.Cast( m_Body[index] );
62 }
63 return null;
64 }
65
66
68 {
69 m_FocusedContainer = cont;
70 }
71
73 {
75 if (c)
76 {
77 return c.GetFocusedSlotsIcon();
78 }
79 return null;
80 }
81
83 {
84 return m_ActiveIndex;
85 }
86
87 void SetActiveIndex( int index )
88 {
89 m_ActiveIndex = index;
90 }
91
92 ScrollWidget GetSlotsScrollWidget()
93 {
94 return null;
95 }
96
97 ScrollWidget GetScrollWidget()
98 {
99 return null;
100 }
101
103 {
104 if ( m_SlotIcon )
105 {
106 m_SlotIcon.GetRadialIconPanel().Show( false );
107 }
108 }
109
111 {
112 m_SlotIcon = icon;
113 }
114
115 void SetDefaultFocus(bool while_micromanagment_mode = false)
116 {
117 m_ActiveIndex = 0;
118 }
119
121 {
122 m_ActiveIndex = 0;
123 m_FocusedColumn = 0;
124 if ( m_OpenedContainers.Count() > 0 )
125 {
126 m_ActiveIndex = m_OpenedContainers.Count() - 1;
127 }
128 }
129
130 void Unfocus()
131 {
132 }
133
134 void MoveGridCursor(int direction)
135 {
136 if ( direction == Direction.UP )
137 {
139 }
140 else if ( direction == Direction.DOWN )
141 {
143 }
144 else if ( direction == Direction.RIGHT )
145 {
147 }
148 else if ( direction == Direction.LEFT )
149 {
151 }
152
154
155 Inventory.GetInstance().UpdateConsoleToolbar();
156 }
157
159 {
160 ScrollWidget sw = GetScrollWidget();
161 if (sw)
162 {
164 }
165
166 #ifndef PLATFORM_CONSOLE
167 ScrollWidget ssw = GetSlotsScrollWidget();
168 if (ssw)
169 {
171 }
172 #endif
173 }
174
175 void ScrollToActiveContainer(ScrollWidget sw)
176 {
177 if (!sw)
178 return;
179
180 float x, y, y_s;
181 float f_y,f_h;
182 float amount;
183
184 sw.GetScreenPos(x, y);
185 sw.GetScreenSize(x, y_s);
187 f_h = GetFocusedContainerHeight(true);
188
189 float next_pos = f_y + f_h;
190 if (next_pos > (y + y_s))
191 {
192 amount = sw.GetVScrollPos() + next_pos - (y + y_s) + 2;
193 sw.VScrollToPos(amount);
194 }
195 else if (f_y < y)
196 {
197 amount = sw.GetVScrollPos() + f_y - y - 2;
198 sw.VScrollToPos(amount);
199 }
200
201 //CheckScrollbarVisibility();
202 }
203
205 {
206 ScrollWidget sw = GetScrollWidget();
207 if (sw)
208 {
210 }
211
212 #ifndef PLATFORM_CONSOLE
213 ScrollWidget ssw = GetSlotsScrollWidget();
214 if (ssw)
215 {
217 }
218 #endif
219 }
220
221 void CheckScrollbarVisibility(ScrollWidget sw)
222 {
223 if (!sw)
224 return;
225
226 if (!sw.IsScrollbarVisible())
227 {
228 sw.VScrollToPos01(0.0);
229 }
230 else if (sw.GetVScrollPos01() > 1.0)
231 {
232 sw.VScrollToPos01(1.0);
233 }
234 }
235
236 void Open()
237 {
238 m_Closed = false;
240 }
241
242 void Close()
243 {
244 m_Closed = true;
246 }
247
248 bool IsOpened()
249 {
250 return !m_Closed;
251 }
252
253 void SetOpenForSlotIcon(bool open, SlotsIcon icon = null/*m_SlotIcon*/)
254 {
255 if (!icon)
256 {
257 icon = m_SlotIcon;
258 }
259
260 if (icon)
261 {
262 icon.GetRadialIcon().Show(open);
263 icon.GetRadialIconClosed().Show(!open);
264 }
265 /*else
266 {
267 ErrorEx("Dbg No Icon");
268 }*/
269 }
270
271 void Toggle()
272 {
273 if (IsOpened())
274 {
275 Close();
276 }
277 else
278 {
279 Open();
280 }
282 }
283
284 float GetFocusedContainerHeight( bool contents = false )
285 {
286 float x, y, result;
287 if( GetFocusedContainer() )
288 y = GetFocusedContainer().GetFocusedContainerHeight( contents );
289 else if( GetRootWidget() )
290 GetRootWidget().GetScreenSize( x, y );
291
292 result = y;
293
294 if ( m_ActiveIndex == 0 )
295 {
296 if ( GetHeader() )
297 {
298 GetHeader().GetRootWidget().GetScreenSize( x, y );
299 result += y;
300 }
301 }
302 return result;
303 }
304
305 float GetFocusedContainerYPos( bool contents = false )
306 {
307 float x, y;
308 if( GetFocusedContainer() )
309 y = GetFocusedContainer().GetFocusedContainerYPos( contents );
310 else if( GetRootWidget() )
311 GetRootWidget().GetPos( x, y );
312
313 return y;
314 }
315
316 float GetFocusedContainerYScreenPos( bool contents = false )
317 {
318 float x, y, result;
319 if( GetFocusedContainer() )
320 y = GetFocusedContainer().GetFocusedContainerYScreenPos( contents );
321 else if( GetRootWidget() )
322 GetRootWidget().GetScreenPos( x, y );
323
324
325 result = y;
326
327 if ( m_ActiveIndex == 0 )
328 {
329 if ( GetHeader() )
330 {
331 GetHeader().GetRootWidget().GetScreenPos( x, y );
332 result = y;
333 }
334 }
335 return result;
336 }
337
338 int Count()
339 {
340 return m_Body.Count();
341 }
342
344 {
345 if( GetFocusedContainer() )
346 return GetFocusedContainer().SelectItem();
347 return false;
348 }
349
350 bool Select()
351 {
352 if( GetFocusedContainer() )
353 return GetFocusedContainer().Select();
354 return false;
355 }
356
358 {
360 {
361 return GetFocusedContainer().OnSelectButton();
362 }
363 return false;
364 }
365
366 bool Combine()
367 {
368 if( GetFocusedContainer() )
369 return GetFocusedContainer().Combine();
370 return true;
371 }
372
374 {
375 if( GetFocusedContainer() )
376 return GetFocusedContainer().TransferItemToVicinity();
377 return false;
378 }
379
381 {
382 if( GetFocusedContainer() )
383 return GetFocusedContainer().TransferItem();
384 return false;
385 }
386
388 {
389 if( GetFocusedContainer() )
390 return GetFocusedContainer().InspectItem();
391 return false;
392 }
393
395 {
397 {
398 return GetFocusedContainer().SplitItem();
399 }
400 else
401 {
402 if (CanSplit())
403 {
404 ItemBase.Cast(GetFocusedItem()).OnRightClick();
405 }
406 }
407 return false;
408 }
409
411 {
413 return GetFocusedContainer().EquipItem();
414
415 if (CanEquip())
416 {
417 EntityAI ent = GetFocusedItem();
418 bool res = false;
419
420 if (ent)
421 {
422 res = GetGame().GetPlayer().PredictiveTakeOrSwapAttachment(ent);
423 if(!res)
424 {
425 res = GetGame().GetPlayer().PredictiveTakeEntityToInventory(FindInventoryLocationType.ATTACHMENT, ent);
426 }
427 }
428 return res;
429 }
430 return false;
431 }
432
434 {
436 return false;
437
438 EntityAI focusedEntity = GetFocusedItem();
439 if (focusedEntity)
440 {
442 return GetFocusedContainer().CanOpenCloseContainerEx(focusedEntity);
443
444 return CanOpenCloseContainerEx(focusedEntity);
445 }
446
447 return false;
448 }
449
451 {
452 return false;
453 }
454
455 bool CanSplit()
456 {
457 EntityAI focusedEntity = GetFocusedItem();
458 if (focusedEntity)
459 {
461 return GetFocusedContainer().CanSplitEx(focusedEntity);
462
463 return CanSplitEx(focusedEntity);
464 }
465
466 return false;
467 }
468
469 bool CanSplitEx(EntityAI focusedEntity)
470 {
472 return false;
473
474 if (focusedEntity)
475 {
477 return GetFocusedContainer().CanSplitEx(focusedEntity);
478
479 return focusedEntity.CanBeSplit();
480 }
481 return false;
482 }
483
484 bool CanDrop()
485 {
486 EntityAI focusedEntity = GetFocusedItem();
487 if (focusedEntity)
488 {
490 return GetFocusedContainer().CanDropEx(focusedEntity);
491
492 return CanDropEx(focusedEntity);
493
494 }
495
496 return false;
497 }
498
499 bool CanDropEx(EntityAI focusedEntity)
500 {
502 return false;
503
504 if (focusedEntity)
505 {
506 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
507
508 if (player)
509 {
510 return player.CanDropEntity(focusedEntity);
511 }
512 }
513 return false;
514 }
515
517 {
518 EntityAI focusedEntity = GetFocusedItem();
519 if (focusedEntity)
520 {
522 return GetFocusedContainer().CanSwapOrTakeToHandsEx(focusedEntity);
523
524 return CanSwapOrTakeToHandsEx(focusedEntity);
525 }
526
527 return false;
528 }
529
531 {
533 return false;
534
535 if (focusedEntity)
536 {
537 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
538 EntityAI entityInHands = player.GetItemInHands();
539 if (entityInHands)
540 {
542
543 if (!GameInventory.CanSwapEntitiesEx(focusedEntity, entityInHands))
544 {
545 return GameInventory.CanForceSwapEntitiesEx( focusedEntity, null, entityInHands, il );
546 }
547 else
548 {
549 return true;
550 }
551 }
552 else
553 {
554 return player.GetInventory().CanAddEntityIntoHands(focusedEntity);
555 }
556 }
557 return false;
558 }
559
560 bool CanEquip()
561 {
562 EntityAI focusedEntity = GetFocusedItem();
563 if (focusedEntity)
564 {
566 return GetFocusedContainer().CanEquipEx(focusedEntity);
567
568 return CanEquipEx(focusedEntity);
569 }
570
571 return false;
572 }
573
574 bool CanEquipEx(EntityAI focusedEntity)
575 {
577 return false;
578
579 bool found = false;
580 if (focusedEntity)
581 {
583 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
584 found = player.GetInventory().FindFreeLocationFor(focusedEntity,FindInventoryLocationType.ATTACHMENT, il);
585
586 if (found && il.GetParent().GetInventory().FindAttachment(il.GetSlot()))
587 {
588 found = false;
589 }
590 else if (!found)
591 {
592 for (int i = 0; i < focusedEntity.GetInventory().GetSlotIdCount(); i++)
593 {
594 int slot_id = focusedEntity.GetInventory().GetSlotId(i);
595 EntityAI slot_item = player.GetInventory().FindAttachment( slot_id );
596 if (slot_item && player.GetInventory().CanSwapEntitiesEx( focusedEntity, slot_item ))
597 {
598 found = true;
599 break;
600 }
601
602 }
603 }
604 }
605 return found;
606 }
607
609 {
610 EntityAI focusedEntity = GetFocusedItem();
611 if (focusedEntity)
612 {
614 return GetFocusedContainer().CanTakeToInventoryEx(focusedEntity);
615
616 return CanTakeToInventoryEx(focusedEntity);
617 }
618
619 return false;
620 }
621
622 bool CanTakeToInventoryEx(EntityAI focusedEntity)
623 {
625 return false;
626
627 if (focusedEntity)
628 {
629 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
630 return player.GetInventory().CanAddEntityToInventory(focusedEntity,FindInventoryLocationType.CARGO);
631 }
632 return false;
633 }
634
636 {
637 EntityAI focusedEntity = GetFocusedItem();
638 if (focusedEntity)
639 {
641 return GetFocusedContainer().CanCombineEx(focusedEntity);
642
643 return CanCombineEx(focusedEntity);
644 }
645
646 return false;
647 }
648
649 bool CanCombineEx(EntityAI focusedEntity)
650 {
652 return false;
653
654 if (focusedEntity)
655 {
656 EntityAI entityInHands = PlayerBase.Cast(GetGame().GetPlayer()).GetItemInHands();
657 if (focusedEntity != entityInHands)
658 {
659 return (ItemManager.GetCombinationFlags(entityInHands, focusedEntity) != 0);
660 }
661 }
662 return false;
663 }
664
666 {
667 if( GetFocusedContainer() )
668 return GetFocusedContainer().CanCombineAmmo();
669 return false;
670 }
671
672 bool CanAddToQuickbarEx(EntityAI focusedEntity)
673 {
675 return false;
676
677 if (focusedEntity)
678 {
679 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
680 if (focusedEntity.GetHierarchyRootPlayer() == player)
681 {
682 return true;
683 }
684 }
685
686 return false;
687 }
688
690 {
691 if ( CanAddToQuickbarEx(itemToAssign) )
692 {
693 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
695 dpi = player.GetDayZPlayerInventory();
696
697 if (itemToAssign && dpi && !dpi.IsProcessing())
698 {
699 RadialQuickbarMenu.SetItemToAssign(itemToAssign);
700
701 //open radial quickbar menu
702 if (!GetGame().GetUIManager().IsMenuOpen(MENU_RADIAL_QUICKBAR))
703 {
704 RadialQuickbarMenu.OpenMenu(GetGame().GetUIManager().FindMenu(MENU_INVENTORY));
705 }
706 }
707 return true;
708 }
709 return false;
710 }
711
712 bool IsEmpty()
713 {
714 return m_OpenedContainers.Count() == 0;
715 }
716
718 {
719 if( GetFocusedContainer() )
720 return GetFocusedContainer().IsItemActive();
721 return false;
722 }
723
725 {
726 if( GetFocusedContainer() )
727 return GetFocusedContainer().IsItemWithQuantityActive();
728 return false;
729 }
730
732 {
733 EntityAI item;
734 if( GetFocusedContainer() )
735 item = GetFocusedContainer().GetFocusedItem();
736
737 return item;
738 }
739
741 {
742 EntityAI item;
743 if( GetFocusedContainer() )
744 item = GetFocusedContainer().GetFocusedContainerEntity();
745 return item;
746 }
747
749 {
750 return m_ColumnCount;
751 }
752
753 void SetColumnCount( int count )
754 {
755 m_ColumnCount = count;
756 }
757
759 {
760 return m_FocusedColumn;
761 }
762
763 void SetFocusedColumn( int column )
764 {
765 m_FocusedColumn = column;
766 }
767
768 override void UpdateInterval()
769 {
770 for ( int i = 0; i < m_Body.Count(); i++ )
771 {
772 if ( m_Body.Get( i ) )
773 m_Body.Get( i ).UpdateInterval();
774 }
775
777 }
778
779 override void SetLastActive()
780 {
781 if (m_IsActive)
782 {
783 m_IsActive = true;
784 if (m_OpenedContainers.Count())
785 {
786 SetLastFocus();
788 {
789 for (int i = 0; i < m_OpenedContainers.Count() - 1; i++)
790 {
792 {
793 m_OpenedContainers[i].SetActive(false);
794 }
795 }
796 m_OpenedContainers[m_ActiveIndex].SetLastActive();
797 }
798 else
799 {
800 m_OpenedContainers[m_ActiveIndex].SetLastActive();
801 }
802 }
803 }
804 else
805 {
806 m_IsActive = true;
807 if (GetHeader())
808 {
810 }
811 SetLastFocus();
812 if (m_OpenedContainers.Count())
813 {
815 if (c)
816 {
817 c.SetLastActive( );
818 }
819 }
820 }
821 }
822
823 override void SetFirstActive()
824 {
825 if (!m_IsActive)
826 {
827 SetActive(true);
828 }
829 else
830 {
831 if (m_OpenedContainers.Count())
832 {
835 {
836 for (int i = 1; i < m_OpenedContainers.Count(); i++)
837 {
839 {
840 m_OpenedContainers[i].SetActive(false);
841 }
842 }
843 m_OpenedContainers[m_ActiveIndex].SetActive(true);
844 }
845 else
846 {
847 m_OpenedContainers[m_ActiveIndex].SetFirstActive();
848 }
849 }
850 }
851 }
852
853 override void SetActive(bool active)
854 {
855 if (!active)
856 {
857 HideOwnedTooltip();
858 }
859
860 if (!active && !m_IsActive)
861 return;
862
863 super.SetActive( active );
864 if ( GetHeader() )
865 {
866 GetHeader().SetActive(active);
867 }
868
869 if (m_MainWidget.FindAnyWidget("SelectedContainer"))
870 {
871 m_MainWidget.FindAnyWidget("SelectedContainer").Show(active);
872 }
873
874 Container c;
875 if( active )
876 {
877
879 if( m_OpenedContainers.Count() )
880 {
882 if (c)
883 {
884 c.SetActive(active);
885 }
886 }
887 }
888 else
889 {
891 if (c)
892 {
893 GetFocusedContainer().SetActive(false);
894 }
895 Unfocus();
896 m_ActiveIndex = 0;
897 m_FocusedColumn = 0;
898 }
899 }
900
902 {
903 for ( int i = 0; i < Count(); i++ )
904 {
905 for ( int j = 0; j < ITEMS_IN_ROW; j++ )
906 {
907 SlotsIcon icon;
908 if (Get(i) && Get(i).GetMainWidget())
909 Get( i ).GetMainWidget().GetUserData(icon);
910
911 if (icon)
912 icon.GetCursorWidget().Show( false );
913 }
914 }
915 }
916
918 {
919 if( GetFocusedContainer() )
920 {
921 m_FocusedColumn = 0;
922 GetFocusedContainer().UnfocusAll();
923 }
924 }
925
927 {
928 return m_ActiveIndex == ( m_OpenedContainers.Count() - 1 );
929 }
930
932 {
933 return m_ActiveIndex == 0;
934 }
935
937 {
938 return m_ActiveIndex == 0;
939 }
940
942 {
943 return m_ActiveIndex >= ( m_OpenedContainers.Count() - 1 );
944 }
945
947 {
948 if ( GetFocusedContainer() )
949 {
950 GetFocusedContainer().ResetFocusedContainer();
951 }
952
953 m_ActiveIndex == 0;
954 }
955
957 {
958 HideOwnedTooltip();
959
960 Container active;
961 if (m_OpenedContainers.Count())
962 {
964 }
965
966 if (active && active.IsActive())
967 {
968 active.SetNextActive();
969 }
970 if (!active || !active.IsActive())
971 {
972 Container next;
974 {
976
978 next.SetActive(true);
979 }
980 else if (Container.Cast( GetParent() ))
981 {
982 SetActive(false);
983 }
984 else
985 {
986 SetActive(false);
988 }
989 }
990 }
991
992 void SetPreviousActive(bool force = false)
993 {
994 HideOwnedTooltip();
995 Container active;
996 if (m_OpenedContainers.Count())
997 {
999 }
1000
1001 if (active && active.IsActive())
1002 {
1003 active.SetPreviousActive();
1004 }
1005
1006 if (!active || !active.IsActive())
1007 {
1008 Container prev;
1010 {
1011 m_ActiveIndex--;
1012
1014 prev.SetLastActive();
1015 }
1016 else if (Container.Cast( GetParent() ))
1017 {
1018 SetActive(false);
1019 }
1020 else
1021 {
1022 SetActive(false);
1023 SetLastActive();
1024 }
1025 }
1026 }
1027
1029 {
1030 Container active;
1031 if (m_OpenedContainers.Count())
1032 {
1034 }
1035
1036 if (active)
1037 {
1038 active.SetNextRightActive();
1039 }
1040 }
1041
1043 {
1044 Container active;
1045 if (m_OpenedContainers.Count())
1046 {
1048 }
1049
1050 if (active)
1051 {
1052 active.SetNextLeftActive();
1053 }
1054 }
1055
1057 {
1058 HideOwnedTooltip();
1059 Container active, next;
1060 if (m_OpenedContainers.Count())
1061 {
1063 }
1064
1065 if (active && active.IsActive())
1066 {
1068 if (icon && icon.GetParent() && SlotsContainer.Cast(icon.GetParent()))
1069 {
1070 SlotsContainer sc = SlotsContainer.Cast(icon.GetParent());
1071 AttachmentsGroupContainer agc = AttachmentsGroupContainer.Cast(sc.GetParent());
1072 if (agc)
1073 {
1074 agc.SetActive(false);
1075 }
1076 }
1077
1078 active.SetSameLevelNextActive();
1079 }
1080
1081 if (!active || !active.IsActive())
1082 {
1084 {
1085 m_ActiveIndex++;
1087 next.SetActive(true);
1088 }
1089 else if (Container.Cast(GetParent()))
1090 {
1091 SetActive(false);
1092 }
1093 else
1094 {
1095 SetActive(false);
1097 }
1098 }
1099 }
1100
1102 {
1103 HideOwnedTooltip();
1104 Container active;
1105 if (m_OpenedContainers.Count())
1106 {
1108 }
1109
1110 if (active && active.IsActive())
1111 {
1113 if (icon && icon.GetParent() && SlotsContainer.Cast(icon.GetParent()))
1114 {
1115 SlotsContainer sc = SlotsContainer.Cast(icon.GetParent());
1116 AttachmentsGroupContainer agc = AttachmentsGroupContainer.Cast(sc.GetParent());
1117 if (agc)
1118 {
1119 agc.SetActive(false);
1120 }
1121 }
1122
1123 active.SetSameLevelPreviousActive();
1124 }
1125
1126 if (!active || !active.IsActive())
1127 {
1128 Container prev;
1130 {
1131 m_ActiveIndex--;
1132
1134 prev.SetLastActive();
1135 }
1136 else if (Container.Cast( GetParent() ))
1137 {
1138 SetActive(false);
1139 }
1140 else
1141 {
1142 SetActive(false);
1143 SetLastActive();
1144 }
1145 }
1146 }
1147
1149 {
1150 m_OpenedContainers.Clear();
1151 int i;
1152 bool need_reset_focus = false;
1153 Container c;
1154 for (i = 0; i < m_Body.Count(); i++)
1155 {
1156 c = Container.Cast(m_Body.Get( i ));
1157 if ( c )
1158 {
1159 c.RecomputeOpenedContainers();
1160 if (c.IsDisplayable() && c.IsVisible())
1161 {
1162 m_OpenedContainers.Insert(c);
1163 }
1164 else if (c.IsActive())
1165 {
1166 c.SetActive(false);
1167 need_reset_focus = true;
1168 }
1169
1170 }
1171 }
1172
1173 //In case of removing focused container or change order of containers
1174 if (IsActive())
1175 {
1176 if (!need_reset_focus && ( m_ActiveIndex >= m_OpenedContainers.Count() || !m_OpenedContainers[m_ActiveIndex].IsActive() ))
1177 {
1178 need_reset_focus = true;
1179 for (i = 0; i < m_OpenedContainers.Count(); i++)
1180 {
1182 {
1183 need_reset_focus = false;
1184 m_ActiveIndex = i;
1185 }
1186 }
1187 }
1188
1189 if (need_reset_focus)
1190 {
1192 }
1193 }
1194 }
1195
1196 override void SetLayoutName()
1197 {
1198 m_LayoutName = WidgetLayoutName.Container;
1199 }
1200
1201 void Insert( LayoutHolder container, int pos = -1, bool immedUpdate = true )
1202 {
1203 if ( pos > -1 && pos < m_Body.Count() )
1204 {
1205 if ( pos <= m_ActiveIndex )
1206 m_ActiveIndex++;
1207 m_Body.InsertAt( container, pos );
1208 }
1209 else
1210 m_Body.Insert( container );
1211
1212 if ( immedUpdate )
1213 Refresh();
1214 }
1215
1216 void Remove( LayoutHolder container )
1217 {
1218 if( m_Body )
1219 {
1220 int index = m_Body.Find( container );
1221 if( index > -1 )
1222 {
1223 index = m_OpenedContainers.Find( container );
1224 if (index > -1)
1225 {
1226 if (index <= m_ActiveIndex)
1227 {
1228 if (GetFocusedContainer() == container)
1229 {
1230 SetPreviousActive( true );
1231 }
1232 else
1233 {
1234 m_ActiveIndex--;
1235 }
1236 }
1237 m_OpenedContainers.RemoveItem( container );
1238 }
1239 m_Body.RemoveItem( container );
1240 }
1241 }
1242
1243 Refresh();
1244 }
1245
1247 {
1248 return m_Body.Get( x );
1249 }
1250
1251 override void Refresh()
1252 {
1253 for ( int i = 0; i < m_Body.Count(); i++ )
1254 {
1255 if( m_Body.Get( i ) )
1256 m_Body.Get( i ).Refresh();
1257 }
1258 }
1259
1261 {
1262 for ( int i = 0; i < m_Body.Count(); i++ )
1263 {
1264 Container c = Container.Cast( m_Body.Get( i ) );
1265 if( c && c.IsInherited( Container ) )
1266 {
1267 c.UpdateSpacer();
1268 }
1269 }
1270
1271 UpdateSpacer();
1272 }
1273
1274 void HideContent( bool force_hide = false )
1275 {
1276 if( !m_ForcedHide )
1277 {
1278 m_ForcedHide = force_hide;
1279 }
1280 for(int i = 0; i < m_Body.Count(); i++)
1281 {
1282 if( m_Body.Get( i ) )
1283 m_Body.Get( i ).OnHide();
1284 }
1285 }
1286
1287 void ShowContent( bool force_show = false )
1288 {
1289 if( force_show )
1290 m_ForcedHide = false;
1291
1292 if( !m_ForcedHide )
1293 {
1294 for(int i = 0; i < m_Body.Count(); i++)
1295 {
1296 if( m_Body.Get( i ) )
1297 m_Body.Get( i ).OnShow();
1298 }
1299 }
1300 }
1301
1302 void SetForceShow(bool value)
1303 {
1304 m_ForcedShow = value;
1305 }
1306
1307 override void UpdateSelectionIcons()
1308 {
1309 m_Parent.UpdateSelectionIcons();
1310 }
1311
1313}
Direction
Определения Inventory.c:19
void Inventory(LayoutHolder parent)
Определения Inventory.c:74
bool IsOpened()
Определения BaseBuildingBase.c:1635
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
bool m_IsActive
Определения ModifierBase.c:19
PlayerBase GetPlayer()
Определения ModifierBase.c:51
bool IsActive()
Определения ModifierBase.c:130
override float Get()
Определения PlayerStatBase.c:134
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Определения PluginRemotePlayerDebugClient.c:14
@ Count
Определения RandomGeneratorSyncManager.c:8
Widget m_Parent
Определения SizeToChild.c:92
void SetActive()
Определения TrapBase.c:414
override void SetActive(bool active)
Определения AttachmentsGroupContainer.c:26
proto native DayZPlayer GetPlayer()
override void CheckHeaderDragability()
Определения ClosableContainer.c:181
override void SetLastFocus()
Определения CargoContainer.c:621
override void SetActive(bool active)
Определения CargoContainer.c:769
override void SetNextActive()
Определения CargoContainer.c:647
override void Unfocus()
Определения CargoContainer.c:626
override EntityAI GetFocusedItem()
Определения CargoContainer.c:733
override float GetFocusedContainerHeight(bool contents=false)
Определения CargoContainer.c:436
override void Close()
Определения ClosableContainer.c:79
override bool IsDisplayable()
Определения ClosableContainer.c:17
override void Open()
Определения ClosableContainer.c:67
override void SetPreviousActive(bool force=false)
Определения CargoContainer.c:668
override Header GetHeader()
Определения ClosableContainer.c:62
override float GetFocusedContainerYScreenPos(bool contents=false)
Определения CargoContainer.c:456
override void SetDefaultFocus(bool while_micromanagment_mode=false)
Определения CargoContainer.c:612
override void SetNextLeftActive()
Определения CargoContainer.c:709
override void SetLastActive()
Определения CargoContainer.c:744
override void Refresh()
Определения CargoContainer.c:526
override void SetNextRightActive()
Определения CargoContainer.c:685
Определения Building.c:6
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Определения Inventory.c:628
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
Определения Inventory.c:664
script counterpart to engine's class Inventory
Определения Inventory.c:79
override void SetActive(bool active)
Определения Header.c:64
Определения Header.c:2
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
InventoryLocation.
Определения InventoryLocation.c:29
Определения InventoryItem.c:731
static int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
Определения ItemManager.c:800
bool IsMicromanagmentMode()
Определения ItemManager.c:70
static ItemManager GetInstance()
Определения ItemManager.c:282
Определения ItemManager.c:2
bool Select()
Определения Container.c:350
void Container(LayoutHolder parent)
Определения Container.c:35
bool CanCombineEx(EntityAI focusedEntity)
Определения Container.c:649
bool CanSwapOrTakeToHandsEx(EntityAI focusedEntity)
Определения Container.c:530
void SetSlotIcon(SlotsIcon icon)
Определения Container.c:110
void ExpandCollapseContainer()
Определения Container.c:1312
int Count()
Определения Container.c:338
int GetFocusedColumn()
Определения Container.c:758
override void UpdateInterval()
Определения Container.c:768
ref array< ref LayoutHolder > m_Body
Определения Container.c:3
override void SetFirstActive()
Определения Container.c:823
EntityAI GetFocusedContainerEntity()
Определения Container.c:740
ref array< LayoutHolder > m_OpenedContainers
Определения Container.c:4
int m_ActiveIndex
Определения Container.c:5
override void Refresh()
Определения Container.c:1251
Container GetContainer(int index)
Определения Container.c:57
float GetFocusedContainerYPos(bool contents=false)
Определения Container.c:305
EntityAI GetFocusedItem()
Определения Container.c:731
bool InspectItem()
Определения Container.c:387
bool IsLastIndex()
Определения Container.c:926
override void SetLayoutName()
Определения Container.c:1196
override void SetLastActive()
Определения Container.c:779
void SetFocusedColumn(int column)
Определения Container.c:763
void SetLastFocus()
Определения Container.c:120
bool CanAddToQuickbarEx(EntityAI focusedEntity)
Определения Container.c:672
bool Combine()
Определения Container.c:366
bool CanSwapOrTakeToHands()
Определения Container.c:516
ScrollWidget GetScrollWidget()
Определения Container.c:97
void ResetFocusedContainer()
Определения Container.c:946
bool CanTakeToInventory()
Определения Container.c:608
bool SelectItem()
Определения Container.c:343
bool m_ForcedHide
Определения Container.c:16
const int SORT_CARGO_NEXT_OFFSET
Определения Container.c:25
void Toggle()
Определения Container.c:271
void SetFocusedContainer(Container cont)
Определения Container.c:67
void Unfocus()
Определения Container.c:130
bool m_LastIndex
Определения Container.c:6
int m_ColumnCount
Определения Container.c:13
void SetSameLevelNextActive()
Определения Container.c:1056
float m_PrevAlpha
Определения Container.c:9
void DraggingOver(Widget w, int x, int y, Widget receiver)
void SetNextLeftActive()
Определения Container.c:1042
const int SORT_CARGO_OWN
Определения Container.c:23
bool CanDrop()
Определения Container.c:484
void SetPreviousActive(bool force=false)
Определения Container.c:992
bool m_ForcedShow
Определения Container.c:17
bool CanCombineAmmo()
Определения Container.c:665
bool IsItemActive()
Определения Container.c:717
bool TransferItemToVicinity()
Определения Container.c:373
const int SORT_ATTACHMENTS_NEXT_OFFSET
Определения Container.c:24
bool CanOpenCloseContainer()
Определения Container.c:433
void ScrollToActiveContainer(ScrollWidget sw)
Определения Container.c:175
void Close()
Определения Container.c:242
Container GetFocusedContainer()
Определения Container.c:48
void SetNextActive()
Определения Container.c:956
bool m_Closed
Определения Container.c:7
bool CanSplit()
Определения Container.c:455
void MoveGridCursor(int direction)
Определения Container.c:134
void ScrollToActiveContainer()
Определения Container.c:158
void CheckScrollbarVisibility()
Определения Container.c:204
void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
bool CanEquip()
Определения Container.c:560
bool IsItemWithQuantityActive()
Определения Container.c:724
void SetOpenForSlotIcon(bool open, SlotsIcon icon=null)
Определения Container.c:253
int GetActiveIndex()
Определения Container.c:82
override void UpdateSelectionIcons()
Определения Container.c:1307
EntityAI m_Entity
Определения Container.c:20
bool IsLastContainerFocused()
Определения Container.c:941
void SetForceShow(bool value)
Определения Container.c:1302
bool SplitItem()
Определения Container.c:394
void HideContent(bool force_hide=false)
Определения Container.c:1274
bool CanEquipEx(EntityAI focusedEntity)
Определения Container.c:574
Header GetHeader()
int m_FocusedColumn
Определения Container.c:15
bool IsEmpty()
Определения Container.c:712
void SetDefaultFocus(bool while_micromanagment_mode=false)
Определения Container.c:115
bool OnSelectButton()
Определения Container.c:357
void UnfocusAll()
Определения Container.c:901
void Remove(LayoutHolder container)
Определения Container.c:1216
void Insert(LayoutHolder container, int pos=-1, bool immedUpdate=true)
Определения Container.c:1201
ScrollWidget GetSlotsScrollWidget()
Определения Container.c:92
const int SORT_ATTACHMENTS_OWN
Определения Container.c:22
bool CanCombine()
Определения Container.c:635
bool AddItemToQuickbarRadial(EntityAI itemToAssign)
Определения Container.c:689
bool EquipItem()
Определения Container.c:410
void ShowContent(bool force_show=false)
Определения Container.c:1287
LayoutHolder Get(int x)
Определения Container.c:1246
bool IsFirstIndex()
Определения Container.c:931
void Open()
Определения Container.c:236
void RecomputeOpenedContainers()
Определения Container.c:1148
void SetNextRightActive()
Определения Container.c:1028
override void SetActive(bool active)
Определения Container.c:853
void UpdateBodySpacers()
Определения Container.c:1260
Container m_FocusedContainer
Определения Container.c:8
bool IsOpened()
Определения Container.c:248
void SetHeader(Header header)
SlotsIcon m_SlotIcon
Определения Container.c:19
bool CanOpenCloseContainerEx(EntityAI focusedEntity)
Определения Container.c:450
bool CanDropEx(EntityAI focusedEntity)
Определения Container.c:499
void SetActiveIndex(int index)
Определения Container.c:87
bool CanTakeToInventoryEx(EntityAI focusedEntity)
Определения Container.c:622
void UnfocusGrid()
Определения Container.c:917
const int ITEMS_IN_ROW
Определения Container.c:10
void CheckHeaderDragability()
bool CanSplitEx(EntityAI focusedEntity)
Определения Container.c:469
int GetColumnCount()
Определения Container.c:748
void OnDropReceivedFromHeader(Widget w, int x, int y, Widget receiver)
bool IsFirstContainerFocused()
Определения Container.c:936
void SetColumnCount(int count)
Определения Container.c:753
void SetSameLevelPreviousActive()
Определения Container.c:1101
void CheckScrollbarVisibility(ScrollWidget sw)
Определения Container.c:221
float GetFocusedContainerYScreenPos(bool contents=false)
Определения Container.c:316
bool TransferItem()
Определения Container.c:380
void UpdateRadialIcon()
Определения Container.c:102
SlotsIcon GetFocusedSlotsIcon()
Определения Container.c:72
void UpdateSpacer()
float GetFocusedContainerHeight(bool contents=false)
Определения Container.c:284
Определения Container.c:2
Определения PlayerBaseClient.c:2
Определения SlotsContainer.c:2
Widget GetCursorWidget()
Определения SlotsIcon.c:210
Определения SlotsIcon.c:2
Определения EnWidgets.c:190
const string Container
Определения WidgetLayoutName.c:47
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
const int MENU_INVENTORY
Определения constants.c:180
const int MENU_RADIAL_QUICKBAR
Определения constants.c:198
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407