DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Класс ClosableContainer
+ Граф наследования:ClosableContainer:

Защищенные члены

void ContainerWithCargo (Container parent, int sort=-1)
 
override bool IsDisplayable ()
 
override bool IsEmpty ()
 
override bool IsItemActive ()
 
override bool CanCombine ()
 
override bool CanCombineAmmo ()
 
override bool IsItemWithQuantityActive ()
 
void LockCargo (bool value)
 
override void Open ()
 
override void Close ()
 
override bool IsOpened ()
 
override void UpdateInterval ()
 
override bool IsFirstContainerFocused ()
 
override bool IsLastContainerFocused ()
 
override void SetDefaultFocus (bool while_micromanagment_mode=false)
 
override void UnfocusAll ()
 
override bool SplitItem ()
 
override bool EquipItem ()
 
override bool TransferItem ()
 
override bool TransferItemToVicinity ()
 
override bool InspectItem ()
 
void SetEntity (EntityAI entity, int cargo_index=0, bool immedUpdate=true)
 
EntityAI GetEntity ()
 
override EntityAI GetFocusedContainerEntity ()
 
EntityAI GetItemPreviewItem (Widget w)
 
bool DraggingOverGrid (Widget w, int x, int y, Widget reciever)
 
void DropReceived (Widget w, int x, int y)
 
void TakeIntoHands (notnull PlayerBase player, notnull EntityAI item)
 
override void DraggingOverHeader (Widget w, int x, int y, Widget receiver)
 
override void DraggingOver (Widget w, int x, int y, Widget receiver)
 
override void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
CargoContainer GetCargo ()
 
void ContainerWithCargoAndAttachments (LayoutHolder parent, int sort=-1)
 
void ~ContainerWithCargoAndAttachments ()
 
void RecomputeContainers ()
 
void AttachmentAddedEx (EntityAI item, string slot, EntityAI parent, bool immedUpdate=true)
 
void AttachmentAdded (EntityAI item, string slot, EntityAI parent)
 
void AttachmentRemoved (EntityAI item, string slot, EntityAI parent)
 
override void UpdateInterval ()
 
override EntityAI GetFocusedContainerEntity ()
 
override void UnfocusAll ()
 
override bool IsLastIndex ()
 
override bool IsFirstContainerFocused ()
 
override bool IsLastContainerFocused ()
 
override void MoveGridCursor (int direction)
 
void SetEntity (EntityAI entity, bool immedUpdate=true)
 
void HideCargo ()
 
void ShowCargo ()
 
EntityAI GetEntity ()
 
ItemPreviewWidget GetItemPreviewWidgetDragOrDrop (Widget w)
 
EntityAI GetItemPreviewItem (Widget w)
 
Widget GetItemPreviewWidget (Widget w)
 
void MouseClick2 (Widget w, int x, int y, int button)
 
void DropReceived (Widget w, int x, int y, CargoContainer cargo)
 NOTE Used for mouse only.
 
void TakeAsAttachment (Widget w, Widget receiver)
 
override void OnDropReceivedFromHeader (Widget w, int x, int y, Widget receiver)
 
void OnDropReceivedFromHeader2 (Widget w, int x, int y, Widget receiver)
 
void DoubleClick (Widget w, int x, int y, int button)
 
bool DraggingOverGrid (Widget w, int x, int y, Widget reciever, CargoContainer cargo)
 
override void DraggingOver (Widget w, int x, int y, Widget receiver)
 
override void DraggingOverHeader (Widget w, int x, int y, Widget receiver)
 
CargoContainer GetCargo ()
 
map< EntityAI, ref CargoContainer > GetAttachmentCargos ()
 
map< EntityAI, ref AttachmentsWrapperGetAttachmentAttachmentsContainers ()
 

Защищенные данные

ref CargoContainer m_CargoGrid
 
int m_CargoIndex = -1
 
ref Attachments m_Atts
 
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
 
ref map< EntityAI, ref AttachmentsWrapperm_AttachmentAttachmentsContainers
 
ref map< EntityAI, ref Attachmentsm_AttachmentAttachments
 
ref array< intm_AttachmentSlotsSorted
 

Подробное описание

Конструктор(ы)

◆ ~ContainerWithCargoAndAttachments()

void ~ContainerWithCargoAndAttachments ( )
inlineprotected
17 {
18 if ( m_Entity )
19 {
20 m_Entity.GetOnItemAttached().Remove( AttachmentAdded );
21 m_Entity.GetOnItemDetached().Remove( AttachmentRemoved );
22 }
23
24 if ( m_Atts )
25 delete m_Atts;
26
28 {
29 delete att;
30 }
31
34
37
39 m_AttachmentCargos.Clear();
40 }
EntityAI m_Entity
Definition ActionDebug.c:11
Definition Attachments.c:4
void AttachmentAdded(EntityAI item, string slot, EntityAI parent)
Definition ContainerWithCargoAndAttachments.c:192
ref map< EntityAI, ref Attachments > m_AttachmentAttachments
Definition ContainerWithCargoAndAttachments.c:8
void AttachmentRemoved(EntityAI item, string slot, EntityAI parent)
Definition ContainerWithCargoAndAttachments.c:197
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
Definition ContainerWithCargoAndAttachments.c:6
ref map< EntityAI, ref AttachmentsWrapper > m_AttachmentAttachmentsContainers
Definition ContainerWithCargoAndAttachments.c:7
ref Attachments m_Atts
Definition ContainerWithCargoAndAttachments.c:3
Definition Building.c:6
Definition EntityAI.c:95

Перекрестные ссылки m_Entity.

Методы

◆ AttachmentAdded()

void AttachmentAdded ( EntityAI item,
string slot,
EntityAI parent )
inlineprotected
193 {
194 AttachmentAddedEx(item, slot, parent);
195 }
void AttachmentAddedEx(EntityAI item, string slot, EntityAI parent, bool immedUpdate=true)
Definition ContainerWithCargoAndAttachments.c:128

◆ AttachmentAddedEx()

void AttachmentAddedEx ( EntityAI item,
string slot,
EntityAI parent,
bool immedUpdate = true )
inlineprotected
129 {
131 int sort = -1;
132 bool updateNeeded = false;
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
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 }
181
183 RecomputeOpenedContainers();
184
185 Inventory.GetInstance().UpdateConsoleToolbar();
186
187 if (m_Parent && immedUpdate)
188 m_Parent.Refresh();
189 }
190 }
void Inventory(LayoutHolder parent)
Definition Inventory.c:76
Widget m_Parent
Definition SizeToChild.c:92
ref array< int > m_AttachmentSlotsSorted
Definition ContainerWithCargoAndAttachments.c:9
void RecomputeContainers()
Definition ContainerWithCargoAndAttachments.c:42
provides access to slot configuration
Definition InventorySlots.c:6
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

Перекрестные ссылки InventorySlots::GetSlotIdFromString(), Inventory() и m_Parent.

◆ AttachmentRemoved()

void AttachmentRemoved ( EntityAI item,
string slot,
EntityAI parent )
inlineprotected
198 {
200
201 CargoContainer old_cont = m_AttachmentCargos.Get( item );
202 if( old_cont )
203 {
204 m_AttachmentCargos.Remove( item );
205 delete old_cont;
206
207 if( m_Parent )
208 m_Parent.Refresh();
209 Inventory.GetInstance().UpdateConsoleToolbar();
210 }
211
212
214 if( old_att_cont )
215 {
218 delete old_att_cont;
219
220 if( m_Parent )
221 m_Parent.Refresh();
222 Inventory.GetInstance().UpdateConsoleToolbar();
223 }
224
226 RecomputeOpenedContainers();
227 }
Definition AttachmentsWrapper.c:2

Перекрестные ссылки InventorySlots::GetSlotIdFromString(), Inventory() и m_Parent.

◆ CanCombine()

override bool CanCombine ( )
inlineprotected
38 {
39 return m_CargoGrid.CanCombine();
40 }
ref CargoContainer m_CargoGrid
Definition ContainerWithCargo.c:3

◆ CanCombineAmmo()

override bool CanCombineAmmo ( )
inlineprotected
43 {
44 return m_CargoGrid.CanCombineAmmo();
45 }

◆ Close()

override void Close ( )
inlineprotected
87 {
88 if( !m_LockCargo )
89 {
90 ItemManager.GetInstance().SetDefaultOpenState( m_Entity.GetType(), false );
91 m_Closed = true;
92 SetOpenForSlotIcon(false);
93 OnHide();
94 m_Parent.m_Parent.Refresh();
95 }
96
97 if ( m_SlotIcon )
98 {
99 m_SlotIcon.GetRadialIconPanel().Show( !m_LockCargo );
100 }
101 }
override void OnHide()
Definition InventoryMenu.c:141
Definition ItemManager.c:2
static ItemManager GetInstance()
Definition ItemManager.c:283

Перекрестные ссылки ItemManager::GetInstance(), m_Entity, m_Parent и OnHide().

Используется в Container::CloseButtonOnMouseButtonDown().

◆ ContainerWithCargo()

void ContainerWithCargo ( Container parent,
int sort = -1 )
inlineprotected
7 {
8 m_LockCargo = false;
9 m_Parent = parent;
10
11 m_CargoGrid = new CargoContainer( this );
12 Insert( m_CargoGrid );
13
14 m_CargoGrid.GetRootWidget().SetSort( 1 );
15
16 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( m_MainWidget, this, "DraggingOverGrid" );
17 RecomputeOpenedContainers();
18 }
Definition WidgetEventHandler.c:2
static WidgetEventHandler GetInstance()
Definition WidgetEventHandler.c:22

Перекрестные ссылки WidgetEventHandler::GetInstance() и m_Parent.

Используется в AttachmentCategoriesRow::RefreshSlot().

◆ ContainerWithCargoAndAttachments()

void ContainerWithCargoAndAttachments ( LayoutHolder parent,
int sort = -1 )
inlineprotected
12 {
13 WidgetEventHandler.GetInstance().RegisterOnDraggingOver( m_MainWidget, this, "DraggingOverHeader2" );
14 }

Перекрестные ссылки WidgetEventHandler::GetInstance().

◆ DoubleClick()

void DoubleClick ( Widget w,
int x,
int y,
int button )
inlineprotected
689 {
690 if( button == MouseState.LEFT && !g_Game.IsLeftCtrlDown())
691 {
693 if( w == NULL || player.GetInventory().IsInventoryLocked() )
694 {
695 return;
696 }
697 ItemPreviewWidget iw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
698 if( !iw )
699 {
700 string name = w.GetName();
701 name.Replace( "PanelWidget", "Render" );
702 iw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
703 }
704
705 if( !iw )
706 {
707 iw = ItemPreviewWidget.Cast( w );
708 }
709
710 EntityAI item = iw.GetItem();
711
712 if( !item )
713 {
714 return;
715 }
716
718 iw.GetUserData(icon);
719
720 if(icon && icon.IsReserved())
721 {
722 return;
723 }
724
725 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
726 return;
727
728 if( player.GetInventory().HasEntityInInventory( item ) && player.GetHumanInventory().CanAddEntityInHands( item ) )
729 {
730 player.PredictiveTakeEntityToHands( item );
731 }
732 else
733 {
734 if(player.GetInventory().CanAddEntityToInventory( item ) && item.GetInventory().CanRemoveEntity())
735 {
736 player.PredictiveTakeEntityToInventory( FindInventoryLocationType.ANY, InventoryItem.Cast( item ) );
737 }
738 else
739 {
740 if( player.GetHumanInventory().CanAddEntityInHands( item ) )
741 {
742 player.PredictiveTakeEntityToHands( item );
743 }
744 }
745 }
746
747 HideOwnedTooltip();
748
749 name = w.GetName();
750 name.Replace( "PanelWidget", "Temperature" );
751 w.FindAnyWidget( name ).Show( false );
752 }
753 }
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Definition DayZGame.c:3815
FindInventoryLocationType
flags for searching locations in inventory
Definition InventoryLocation.c:17
PlayerBase GetPlayer()
Definition ModifierBase.c:51
Definition ItemBase.c:15
Definition gameplay.c:276
Definition PlayerBaseClient.c:2
Definition SlotsIcon.c:2
proto native CGame GetGame()
MouseState
Definition EnSystem.c:311

Перекрестные ссылки g_Game, GetGame(), GetPlayer() и name.

◆ DraggingOver() [1/2]

override void DraggingOver ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
436 {
437 if( !w )
438 return;
440 if( !item )
441 return;
442
444 if( item.GetInventory().CanRemoveEntity() && player.CanManipulateInventory() && m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && !m_Entity.GetInventory().HasEntityInCargo( item ) )
445 {
447 ItemManager.GetInstance().HideDropzones();
448 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
449 {
450 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
451 }
452 else
453 {
454 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
455 }
456 }
457 else
458 {
460 ItemManager.GetInstance().ShowSourceDropzone( item );
461 }
462 }
EntityAI GetItemPreviewItem(Widget w)
Definition ContainerWithCargo.c:225
Definition ColorManager.c:2
static int GREEN_COLOR
Definition ColorManager.c:17
static ColorManager GetInstance()
Definition ColorManager.c:27
static int RED_COLOR
Definition ColorManager.c:16

Перекрестные ссылки GetGame(), ColorManager::GetInstance(), ItemManager::GetInstance(), GetItemPreviewItem(), GetPlayer(), ColorManager::GREEN_COLOR, m_Entity и ColorManager::RED_COLOR.

Используется в DraggingOverHeader().

◆ DraggingOver() [2/2]

override void DraggingOver ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
835 {
837 }
Icon x
Icon y
override void DraggingOverHeader(Widget w, int x, int y, Widget receiver)
Definition ContainerWithCargo.c:430

Перекрестные ссылки x и y.

◆ DraggingOverGrid() [1/2]

bool DraggingOverGrid ( Widget w,
int x,
int y,
Widget reciever )
inlineprotected
246 {
247 if( w == null )
248 {
249 return false;
250 }
251
253 if( !player.CanManipulateInventory() )
254 {
255 return false;
256 }
257
259
260 if( !item )
261 {
262 return false;
263 }
264
265 if( !item.GetInventory().CanRemoveEntity() )
266 {
267 return false;
268 }
269
270 int color, c_x, c_y;
271
272 #ifdef PLATFORM_CONSOLE
273 int idx = -1;
274 #else
275 int idx = 0;
276 #endif
277
278 CargoBase cargo = m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex);
279 if( cargo )
280 {
281 c_x = cargo.GetHeight();
282 c_y = cargo.GetWidth();
283 }
284
286 #ifdef PLATFORM_CONSOLE
287 x = 0;
288 y = cargo.GetItemCount();
289 m_Entity.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.CARGO, dst );
290 #else
291 dst.SetCargoAuto(cargo, item, x, y, item.GetInventory().GetFlipCargo());
292 #endif
293
294 #ifdef PLATFORM_CONSOLE
295 if( dst.IsValid() && m_Entity.GetInventory().LocationCanAddEntityEx(dst))
296 #else
297 if( m_Entity && c_x > x && c_y > y && m_Entity.GetInventory().LocationCanAddEntityEx(dst))
298 #endif
299 {
300 ItemManager.GetInstance().HideDropzones();
301 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
302 {
303 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
304 }
305 else
306 {
307 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
308 }
310 }
311 else
312 {
314 ItemManager.GetInstance().ShowSourceDropzone( item );
315 }
316
317 if( w.FindAnyWidget("Cursor") )
318 {
319 w.FindAnyWidget("Cursor").SetColor( color );
320 }
321 else
322 {
323 string name = w.GetName();
324 name.Replace( "PanelWidget", "Cursor" );
325 if( w.FindAnyWidget( name ) )
326 {
327 w.FindAnyWidget( name ).SetColor( color );
328 }
329 }
330
331 return true;
332 }
represents base for cargo storage for entities
Definition Cargo.c:7
int m_CargoIndex
Definition ContainerWithCargo.c:4
InventoryLocation.
Definition InventoryLocation.c:29

Перекрестные ссылки GetGame(), ItemManager::GetInstance(), GetItemPreviewItem(), GetPlayer(), ColorManager::GREEN_COLOR, m_Entity, name, ColorManager::RED_COLOR, x и y.

◆ DraggingOverGrid() [2/2]

bool DraggingOverGrid ( Widget w,
int x,
int y,
Widget reciever,
CargoContainer cargo )
inlineprotected
756 {
757 if( w == NULL )
758 {
759 return false;
760 }
761
763
764 if( !item )
765 {
766 return false;
767 }
768
769 int color;
770 int idx = 0;
771 int c_x, c_y;
772
775
776 if( cargo == m_CargoGrid )
777 {
779 target_cargo = m_Entity.GetInventory().GetCargo();
780 }
781 else
782 {
783 target_entity = m_AttachmentCargos.GetKeyByValue( cargo );
784 if( target_entity )
785 {
786 target_cargo = target_entity.GetInventory().GetCargo();
787 }
788 else
789 return false;
790 }
791
793 {
794 c_x = target_cargo.GetHeight();
795 c_y = target_cargo.GetWidth();
796 }
797 else
798 return false;
799
800 if( c_x > x && c_y > y && target_entity.GetInventory().CanAddEntityInCargoEx( item, idx, x, y, item.GetInventory().GetFlipCargo() ) )
801 {
803 if( target_entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
804 {
805 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
806 }
807 else
808 {
809 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
810 }
811 }
812 else
813 {
815 }
816
817 if( w.FindAnyWidget("Cursor") )
818 {
819 w.FindAnyWidget("Cursor").SetColor( color );
820 }
821 else
822 {
823 string name = w.GetName();
824 name.Replace( "PanelWidget", "Cursor" );
825 if( w.FindAnyWidget( name ) )
826 {
827 w.FindAnyWidget( name ).SetColor( color );
828 }
829 }
830
831 return true;
832 }

Перекрестные ссылки GetGame(), ItemManager::GetInstance(), GetPlayer(), ColorManager::GREEN_COLOR, m_Entity, name, ColorManager::RED_COLOR, x и y.

◆ DraggingOverHeader() [1/2]

override void DraggingOverHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
431 {
432 DraggingOver( w, x, y, receiver );
433 }
override void DraggingOver(Widget w, int x, int y, Widget receiver)
Definition ContainerWithCargo.c:435

Перекрестные ссылки DraggingOver(), x и y.

◆ DraggingOverHeader() [2/2]

override void DraggingOverHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
840 {
841 if( w == NULL )
842 {
843 return;
844 }
846 if( !item )
847 {
848 return;
849 }
850
852 receiver.GetUserData(slots_icon);
853
856 bool is_reserved = false;
857 int slot_id = -1;
858
859 if(slots_icon)
860 {
861 attached_entity = slots_icon.GetSlotParent();
862 slot_id = slots_icon.GetSlotID();
863 receiver_item = slots_icon.GetEntity();
864 is_reserved = slots_icon.IsReserved();
865 }
866
867
871 if( m_Entity )
872 {
873 if( Class.CastTo(wpn, m_Entity ) && Class.CastTo(mag, item ) )
874 {
875 if( player.GetWeaponManager().CanAttachMagazine( wpn, mag ) )
876 {
877 ItemManager.GetInstance().HideDropzones();
878 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
879 {
880 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
881 }
882 else
883 {
884 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
885 }
887 }
888 }
889 else if( receiver_item && !is_reserved )
890 {
892 ItemBase itemIB = ItemBase.Cast( item );
893 if( receiver_itemIB && itemIB && receiver_itemIB.CanBeCombined( itemIB ) )
894 {
895 ItemManager.GetInstance().HideDropzones();
896 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
897 {
898 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
899 }
900 else
901 {
902 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
903 }
905 }
907 {
908 ItemManager.GetInstance().HideDropzones();
909 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
910 {
911 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
912 }
913 else
914 {
915 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
916 }
918 }
919 else if( receiver_itemIB.GetInventory().CanAddAttachment( item ) )
920 {
921 ItemManager.GetInstance().HideDropzones();
922 if( receiver_itemIB.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
923 {
924 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
925 }
926 else
927 {
928 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
929 }
931 }
932 }
933 else if( attached_entity && attached_entity.GetInventory().CanAddAttachmentEx( item, slot_id ) )
934 {
935 ItemManager.GetInstance().HideDropzones();
936 if( attached_entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
937 {
938 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
939 }
940 else
941 {
942 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
943 }
945 }
946 else if( m_Entity.GetInventory().CanAddAttachment( item ) )
947 {
948 ItemManager.GetInstance().HideDropzones();
949 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
950 {
951 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
952 }
953 else
954 {
955 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
956 }
958 }
959 else if( ( m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && !m_Entity.GetInventory().HasEntityInCargo( item ) ) /*|| player.GetHumanInventory().HasEntityInHands( item )*/ )
960 {
961 ItemManager.GetInstance().HideDropzones();
962 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
963 {
964 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
965 }
966 else
967 {
968 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
969 }
971 }
972 else
973 {
974 ItemManager.GetInstance().ShowSourceDropzone( item );
976 }
977 }
978 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
static int SWAP_COLOR
Definition ColorManager.c:18
static int COMBINE_COLOR
Definition ColorManager.c:20
script counterpart to engine's class Inventory
Definition Inventory.c:79
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Definition Inventory.c:628
Definition InventoryItem.c:731
shorthand
Definition BoltActionRifle_Base.c:6
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), Class::CastTo(), ColorManager::COMBINE_COLOR, GetGame(), ColorManager::GetInstance(), ItemManager::GetInstance(), GetPlayer(), ColorManager::GREEN_COLOR, m_Entity, ColorManager::RED_COLOR и ColorManager::SWAP_COLOR.

◆ DropReceived() [1/2]

void DropReceived ( Widget w,
int x,
int y )
inlineprotected
335 {
336 float xx, yy;
337 GetMainWidget().Update();
338 GetMainWidget().GetScreenSize( xx, yy );
339 if( GetMainWidget().FindAnyWidget("Background") )
340 {
341 GetMainWidget().FindAnyWidget("Background").Show( true );
342 GetMainWidget().FindAnyWidget("Background").SetSize( xx, yy );
343 }
345 if( !item )
346 {
347 return;
348 }
349
350 #ifdef PLATFORM_CONSOLE
351 if( m_CargoGrid.HasItem( item ) )
352 {
353 return;
354 }
355 #endif
356
357 #ifdef PLATFORM_CONSOLE
358 int idx = -1;
359 #else
360 int idx = 0;
361 #endif
362 int c_x, c_y;
363
364 CargoBase cargo = m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex);
365
366 if( cargo )
367 {
368 c_x = cargo.GetHeight();
369 c_y = cargo.GetWidth();
370 }
371
373 #ifdef PLATFORM_CONSOLE
374 x = 0;
375 y = cargo.GetItemCount();
376 m_Entity.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.CARGO, dst );
377 #else
378 dst.SetCargoAuto(cargo, item, x, y, item.GetInventory().GetFlipCargo());
379 #endif
380
382 item.GetInventory().GetCurrentInventoryLocation(src);
383
384 if(src.CompareLocationOnly(dst) && src.GetFlip() == dst.GetFlip())
385 return;
386
387 #ifdef PLATFORM_CONSOLE
388 if(dst.IsValid() && m_Entity.GetInventory().LocationCanAddEntityEx(dst))
389 #else
390 if( c_x > x && c_y > y && m_Entity.GetInventory().LocationCanAddEntityEx(dst))
391 #endif
392 {
394
396
397 Icon icon = m_CargoGrid.GetIcon( item );
398
399 if( icon && w && w.FindAnyWidget("Cursor") )
400 {
401 w.FindAnyWidget("Cursor").SetColor( ColorManager.BASE_COLOR );
402 icon.Refresh();
403 Refresh();
404 }
405 }
406
407 ItemManager.GetInstance().HideDropzones();
408 ItemManager.GetInstance().SetIsDragging( false );
409 }
void Refresh()
Definition SizeToChild.c:108
static int BASE_COLOR
Definition ColorManager.c:15
Definition Icon.c:2
Definition SplitItemUtils.c:2
static void TakeOrSplitToInventoryLocation(notnull PlayerBase player, notnull InventoryLocation dst)
Definition SplitItemUtils.c:34
proto native Widget FindAnyWidget(string pathname)

Перекрестные ссылки ColorManager::BASE_COLOR, FindAnyWidget(), GetGame(), ItemManager::GetInstance(), GetItemPreviewItem(), GetPlayer(), m_Entity, Refresh(), SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.

◆ DropReceived() [2/2]

void DropReceived ( Widget w,
int x,
int y,
CargoContainer cargo )
inlineprotected

NOTE Used for mouse only.

521 {
523 if (!item)
524 return;
525
526 #ifndef PLATFORM_CONSOLE
527 int c_x, c_y;
528 #endif
529
532
533 if (cargo != m_CargoGrid)
534 {
535 targetEntity = m_AttachmentCargos.GetKeyByValue(cargo);
536 }
537
538 if (targetEntity)
539 {
540 targetCargo = targetEntity.GetInventory().GetCargo();
541 #ifdef PLATFORM_CONSOLE
542 if (m_CargoGrid && m_CargoGrid.HasItem(item))
543 return;
544 #endif
545 }
546
547 if (!targetCargo || !targetEntity)
548 return;
549
551 #ifdef PLATFORM_CONSOLE
552 x = 0;
553 y = targetCargo.GetItemCount();
554 targetEntity.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.CARGO, dst);
555 #else
556 c_x = targetCargo.GetHeight();
557 c_y = targetCargo.GetWidth();
558
559 dst.SetCargoAuto(targetCargo, item, x, y, item.GetInventory().GetFlipCargo());
560 #endif
561
563 item.GetInventory().GetCurrentInventoryLocation(src);
564 if (src.CompareLocationOnly(dst) && src.GetFlip() == dst.GetFlip())
565 return;
566
567 #ifdef PLATFORM_CONSOLE
568 if (dst.IsValid() && targetEntity.GetInventory().LocationCanAddEntity(dst))
569 #else
570 if (c_x > x && c_y > y && targetEntity.GetInventory().LocationCanAddEntity(dst))
571 #endif
572 {
574
576
577 Icon icon = cargo.GetIcon(item);
578 if (icon)
579 {
580 if (w && w.FindAnyWidget("Cursor"))
581 w.FindAnyWidget("Cursor").SetColor(ColorManager.BASE_COLOR);
582
583 icon.Refresh();
584 Refresh();
585 }
586 }
587
588 ItemManager.GetInstance().HideDropzones();
589 ItemManager.GetInstance().SetIsDragging(false);
590 }

Перекрестные ссылки ColorManager::BASE_COLOR, GetGame(), ItemManager::GetInstance(), GetPlayer(), m_Entity, Refresh(), SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.

◆ EquipItem()

override bool EquipItem ( )
inlineprotected
171 {
172 return m_CargoGrid.EquipItem();
173 }

◆ GetAttachmentAttachmentsContainers()

map< EntityAI, ref AttachmentsWrapper > GetAttachmentAttachmentsContainers ( )
inlineprotected
991 {
993 }

◆ GetAttachmentCargos()

map< EntityAI, ref CargoContainer > GetAttachmentCargos ( )
inlineprotected
986 {
987 return m_AttachmentCargos;
988 }

◆ GetCargo() [1/2]

CargoContainer GetCargo ( )
inlineprotected
492 {
493 return m_CargoGrid;
494 }

Перекрестные ссылки m_CargoGrid.

◆ GetCargo() [2/2]

CargoContainer GetCargo ( )
inlineprotected
981 {
982 return m_CargoGrid;
983 }

◆ GetEntity() [1/2]

EntityAI GetEntity ( )
inlineprotected
216 {
217 return m_Entity;
218 }

Перекрестные ссылки m_Entity.

Используется в OnDropReceivedFromHeader().

◆ GetEntity() [2/2]

EntityAI GetEntity ( )
inlineprotected
410 {
411 return m_Entity;
412 }

Перекрестные ссылки m_Entity.

◆ GetFocusedContainerEntity() [1/2]

override EntityAI GetFocusedContainerEntity ( )
inlineprotected
221 {
222 return m_Entity;
223 }

Перекрестные ссылки m_Entity.

◆ GetFocusedContainerEntity() [2/2]

override EntityAI GetFocusedContainerEntity ( )
inlineprotected
264 {
265 return m_Entity;
266 }

Перекрестные ссылки m_Entity.

◆ GetItemPreviewItem() [1/2]

EntityAI GetItemPreviewItem ( Widget w)
inlineprotected
226 {
227 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
228 if( !ipw )
229 {
230 string name = w.GetName();
231 name.Replace( "PanelWidget", "Render" );
232 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
233 }
234 if( !ipw )
235 {
236 ipw = ItemPreviewWidget.Cast( w );
237 }
238 if( !ipw || !ipw.IsInherited( ItemPreviewWidget ) )
239 {
240 return null;
241 }
242 return ipw.GetItem();
243 }

Перекрестные ссылки name.

Используется в DraggingOver(), DraggingOverGrid(), DropReceived() и OnDropReceivedFromHeader().

◆ GetItemPreviewItem() [2/2]

EntityAI GetItemPreviewItem ( Widget w)
inlineprotected
422 {
423 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
424 if( !ipw )
425 {
426 string name = w.GetName();
427 name.Replace( "PanelWidget", "Render" );
428 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
429 }
430 if( !ipw )
431 {
432 ipw = ItemPreviewWidget.Cast( w );
433 }
434 if( !ipw || !ipw.IsInherited( ItemPreviewWidget ) )
435 {
436 return NULL;
437 }
438 return ipw.GetItem();
439 }

Перекрестные ссылки name.

◆ GetItemPreviewWidget()

Widget GetItemPreviewWidget ( Widget w)
inlineprotected
442 {
443 ItemPreviewWidget ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( "Render" ) );
444 if( !ipw )
445 {
446 string name = w.GetName();
447 name.Replace( "PanelWidget", "Render" );
448 ipw = ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
449 }
450 if( !ipw )
451 {
452 ipw = ItemPreviewWidget.Cast( w );
453 }
454 return ipw;
455 }

Перекрестные ссылки name.

◆ GetItemPreviewWidgetDragOrDrop()

ItemPreviewWidget GetItemPreviewWidgetDragOrDrop ( Widget w)
inlineprotected
415 {
416 string name = w.GetName();
417 name.Replace( "PanelWidget", "Render" );
418 return ItemPreviewWidget.Cast( w.FindAnyWidget( name ) );
419 }

Перекрестные ссылки name.

◆ HideCargo()

void HideCargo ( )
inlineprotected
386 {
387 if( m_CargoGrid )
388 {
389 if(m_CargoGrid.IsVisible())
390 {
391 m_CargoGrid.OnHide();
392 RecomputeOpenedContainers();
393 }
394 }
395 }

◆ InspectItem()

override bool InspectItem ( )
inlineprotected
186 {
187 return m_CargoGrid.InspectItem();
188 }

Используется в AttachmentCategoriesRow::MouseClick().

◆ IsDisplayable()

override bool IsDisplayable ( )
inlineprotected
21 {
22 if (m_Entity)
23 return m_Entity.CanDisplayCargo();
24 return false;
25 }

Перекрестные ссылки m_Entity.

Используется в Container::Open() и Container::UpdateRadialIcon().

◆ IsEmpty()

override bool IsEmpty ( )
inlineprotected
28 {
29 return m_CargoGrid.IsEmpty();
30 }

◆ IsFirstContainerFocused() [1/2]

override bool IsFirstContainerFocused ( )
inlineprotected
146 {
147 return m_CargoGrid.IsFirstContainerFocused();
148 }

◆ IsFirstContainerFocused() [2/2]

override bool IsFirstContainerFocused ( )
inlineprotected
298 {
299 return IsFirstIndex();
300 }

◆ IsItemActive()

override bool IsItemActive ( )
inlineprotected
33 {
34 return m_CargoGrid.IsItemActive();
35 }

◆ IsItemWithQuantityActive()

override bool IsItemWithQuantityActive ( )
inlineprotected
48 {
49 return m_CargoGrid.IsItemWithQuantityActive();
50 }

◆ IsLastContainerFocused() [1/2]

override bool IsLastContainerFocused ( )
inlineprotected
151 {
152 return m_CargoGrid.IsLastContainerFocused();
153 }

◆ IsLastContainerFocused() [2/2]

override bool IsLastContainerFocused ( )
inlineprotected
303 {
304 return IsLastIndex();
305 }
override bool IsLastIndex()
Definition ContainerWithCargoAndAttachments.c:292

◆ IsLastIndex()

override bool IsLastIndex ( )
inlineprotected
293 {
294 return m_ActiveIndex == ( m_OpenedContainers.Count() - 1 );
295 }

◆ IsOpened()

override bool IsOpened ( )
inlineprotected
104 {
105 return !m_Closed && !m_LockCargo;
106 }

Используется в Container::OnShow(), UpdateInterval() и Container::UpdateRadialIcon().

◆ LockCargo()

void LockCargo ( bool value)
inlineprotected
53 {
54 if( value != m_LockCargo )
55 {
56 if( value )
57 {
58 m_LockCargo = true;
59 OnHide();
60 }
61 else
62 {
63 m_LockCargo = false;
64 SetOpenState(!m_Closed);
65 }
66 }
67 }

Перекрестные ссылки OnHide().

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

◆ MouseClick2()

void MouseClick2 ( Widget w,
int x,
int y,
int button )
inlineprotected
458 {
460 w.GetUserData(icon);
461
463 if (icon)
464 selectedItem = ItemBase.Cast(icon.GetEntity());
465
466 if (selectedItem)
467 {
468 bool isReserved = icon.IsReserved();
469
470 switch (button)
471 {
472 case MouseState.RIGHT:
473 #ifdef DIAG_DEVELOPER
474 if (GetDayZGame().IsLeftCtrlDown())
475 ShowActionMenu(selectedItem);
476 #endif
477
478 if (isReserved)
479 {
480 EntityAI attachmentParent = icon.GetSlotParent();
481 GetGame().GetPlayer().GetHumanInventory().ClearUserReservedLocationSynced(selectedItem);
482 attachmentParent.GetOnAttachmentReleaseLock().Invoke(selectedItem, icon.GetSlotID());
483 }
484
485 break;
486
487 case MouseState.MIDDLE:
488 if (!isReserved)
490
491 break;
492
493 case MouseState.LEFT:
494 if (!isReserved)
495 {
497 if (g_Game.IsLeftCtrlDown())
498 {
499 if (controlledPlayer.CanDropEntity(selectedItem))
500 {
501 if (selectedItem.CanBeSplit() && selectedItem.GetTargetQuantityMax() < selectedItem.GetQuantity())
502 selectedItem.SplitIntoStackMaxClient(null, -1);
503 else
504 controlledPlayer.PhysicalPredictiveDropItem(selectedItem);
505 }
506 }
507 else
508 {
509 bool draggable = !controlledPlayer.GetInventory().HasInventoryReservation(selectedItem, null ) && !controlledPlayer.GetInventory().IsInventoryLocked() && selectedItem.GetInventory().CanRemoveEntity() && !controlledPlayer.IsItemsToDelete();
510 ItemManager.GetInstance().SetWidgetDraggable(w, draggable);
511 }
512 }
513
514 break;
515 }
516 }
517 }
DayZGame GetDayZGame()
Definition DayZGame.c:3817
override bool InspectItem()
Definition ContainerWithCargo.c:185

Перекрестные ссылки g_Game, GetDayZGame(), GetGame(), ItemManager::GetInstance() и GetPlayer().

◆ MoveGridCursor()

override void MoveGridCursor ( int direction)
inlineprotected
308 {
309 Container c = GetFocusedContainer();
310 if ( c )
311 {
312 c.MoveGridCursor( direction );
313 Inventory.GetInstance().UpdateConsoleToolbar();
314 }
315 }
Definition CargoContainer.c:3

Перекрестные ссылки Inventory().

◆ OnDropReceivedFromHeader() [1/2]

override void OnDropReceivedFromHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
465 {
467 if( !item )
468 {
469 return;
470 }
471
474 if( GetEntity() && item.GetInventory().GetCurrentInventoryLocation(src))
475 {
477 if (m_Entity.GetInventory().FindFreeLocationFor(item, FindInventoryLocationType.ATTACHMENT, dst))
478 {
479 player.PredictiveTakeToDst(src, dst);
480 }
481
482 bool can_add = m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() );
483 bool in_cargo = !player.GetInventory().HasEntityInInventory( item ) || !m_Entity.GetInventory().HasEntityInCargo( item );
484 if( can_add && in_cargo )
485 {
487 }
488 }
489 }
EntityAI GetEntity()
Definition ContainerWithCargo.c:215
static void TakeOrSplitToInventory(notnull PlayerBase player, notnull EntityAI target, notnull EntityAI item)
Definition SplitItemUtils.c:3

Перекрестные ссылки GetEntity(), GetGame(), GetItemPreviewItem(), GetPlayer(), m_Entity и SplitItemUtils::TakeOrSplitToInventory().

◆ OnDropReceivedFromHeader() [2/2]

override void OnDropReceivedFromHeader ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
679 {
681 }
void TakeAsAttachment(Widget w, Widget receiver)
Definition ContainerWithCargoAndAttachments.c:592

◆ OnDropReceivedFromHeader2()

void OnDropReceivedFromHeader2 ( Widget w,
int x,
int y,
Widget receiver )
inlineprotected
684 {
686 }

◆ Open()

override void Open ( )
inlineprotected
70 {
71 if( !m_LockCargo )
72 {
73 ItemManager.GetInstance().SetDefaultOpenState( m_Entity.GetType(), true );
74 m_Closed = false;
75 SetOpenForSlotIcon(true);
76 OnShow();
77 m_Parent.m_Parent.Refresh();
78 }
79
80 if ( m_SlotIcon )
81 {
82 m_SlotIcon.GetRadialIconPanel().Show( !m_LockCargo );
83 }
84 }
override void OnShow()
Definition ControlsXbox.c:349

Перекрестные ссылки ItemManager::GetInstance(), m_Entity, m_Parent и OnShow().

◆ RecomputeContainers()

void RecomputeContainers ( )
inlineprotected
43 {
44 int currentIndex = -1;
46
47 m_Body.Clear();
48
49 if(m_Atts)
50 {
51 currentIndex = m_Body.Insert(m_Atts.GetWrapper());
52 }
53
54 if(m_CargoGrid)
55 {
56 currentIndex = m_Body.Insert(m_CargoGrid);
57 }
58
59 GameInventory inv = m_Entity.GetInventory();
60 for (int i = 0; i < inv.AttachmentCount(); i++)
61 {
62 int slotIndex = -1;
63 int sortIndex = -1;
64 EntityAI ent = inv.GetAttachmentFromIndex(i);
65 if(ent)
66 {
68 if(att)
69 {
70 if(m_Atts && m_Atts.GetSlotsSorted().Count())
71 {
72 sortIndex = m_Atts.GetSlotsSorted().Find(att.m_Attachments.GetAttachmentSlotID());
73 }
74
76 {
78 {
79 m_Body.InsertAt(att, currentIndex);
81 }
82 else
83 {
84 currentIndex = m_Body.Insert(att);
86 }
87 }
88 else
89 {
90 currentIndex = m_Body.Insert(att);
92 }
93 }
94
95 CargoContainer cargo = m_AttachmentCargos.Get(ent);
96 if(cargo)
97 {
98 if(m_Atts && m_Atts.GetSlotsSorted().Count())
99 {
100 sortIndex = m_Atts.GetSlotsSorted().Find(cargo.GetAttachmentSlotID());
101 }
102
104 {
105 if(slotIndex > sortIndex)
106 {
107 m_Body.InsertAt(cargo, currentIndex);
109 }
110 else
111 {
112 currentIndex = m_Body.Insert(cargo);
114 }
115 }
116 else
117 {
118 currentIndex = m_Body.Insert(cargo);
120 }
121 }
122 }
123 }
124
126 }

Перекрестные ссылки m_Entity.

◆ SetDefaultFocus()

override void SetDefaultFocus ( bool while_micromanagment_mode = false)
inlineprotected
156 {
157 m_CargoGrid.SetDefaultFocus( while_micromanagment_mode );
158 }

◆ SetEntity() [1/2]

void SetEntity ( EntityAI entity,
bool immedUpdate = true )
inlineprotected
318 {
320
321 m_Atts = new Attachments( this, m_Entity );
322 m_Atts.InitAttachmentGrid( SORT_ATTACHMENTS_OWN );
323 m_AttachmentSlotsSorted = m_Atts.GetSlotsSorted();
324
325 m_Entity.GetOnItemAttached().Insert( AttachmentAdded );
326 m_Entity.GetOnItemDetached().Insert( AttachmentRemoved );
327
328 m_ClosableHeader.SetItemPreview( m_Entity );
329 CheckHeaderDragability();
330
331 if ( m_Entity.GetInventory().GetCargo() )
332 {
333 m_CargoGrid = new CargoContainer( this, false );
334 m_CargoGrid.GetRootWidget().SetSort( SORT_CARGO_OWN );
335 m_CargoGrid.SetEntity( m_Entity, 0, immedUpdate );
336 m_CargoGrid.UpdateHeaderText(); // TODO: refresh?
337 Insert( m_CargoGrid );
338 }
339 else
340 {
341 string name = m_Entity.GetDisplayName();
342 name.ToUpper();
343 m_ClosableHeader.SetName( name );
344 }
345
349
350 (Container.Cast( m_Parent )).Insert( this );
351
352 foreach ( int slot_id : m_AttachmentSlotsSorted )
353 {
354 EntityAI item = m_Entity.GetInventory().FindAttachment( slot_id );
355 if ( item )
357 }
358
360
361 if (m_CargoGrid)
362 {
363 bool hideCargo = m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !m_Entity.CanDisplayCargo() || m_ForcedHide;
364 if (m_CargoGrid.IsVisible() && hideCargo)
365 {
366 HideCargo();
367 }
368 else if (!m_CargoGrid.IsVisible() && !hideCargo)
369 {
370 ShowCargo();
371 }
372 }
373
374 if( IsDisplayable() )
375 SetOpenState( true );
376 else
377 SetOpenState( false );
378
379 if (immedUpdate)
380 m_Parent.m_Parent.Refresh();
381
382 RecomputeOpenedContainers();
383 }
void ShowCargo()
Definition ContainerWithCargoAndAttachments.c:397
void HideCargo()
Definition ContainerWithCargoAndAttachments.c:385
override bool IsDisplayable()
Definition ContainerWithCargo.c:20
static proto native owned string GetSlotName(int id)
converts slot_id to string

Перекрестные ссылки InventorySlots::GetSlotName(), m_Entity, m_Parent и name.

◆ SetEntity() [2/2]

void SetEntity ( EntityAI entity,
int cargo_index = 0,
bool immedUpdate = true )
inlineprotected
191 {
194
195 SetOpenState( true );
196
197 m_CargoGrid.SetEntity( entity, immedUpdate );
198 m_CargoGrid.UpdateHeaderText();
199 m_ClosableHeader.SetItemPreview( entity );
200 CheckHeaderDragability();
201 ( Container.Cast( m_Parent ) ).Insert( this, -1, false );
202
203 if ( m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !m_Entity.CanDisplayCargo() )
204 LockCargo(true);
205 else
206 LockCargo(false);
207
208 if ( immedUpdate )
209 {
210 Refresh();
211 GetMainWidget().Update();
212 }
213 }
void LockCargo(bool value)
Definition ContainerWithCargo.c:52

Перекрестные ссылки LockCargo(), m_Entity, m_Parent и Refresh().

◆ ShowCargo()

void ShowCargo ( )
inlineprotected
398 {
399 if( m_CargoGrid )
400 {
401 if(!m_CargoGrid.IsVisible())
402 {
403 m_CargoGrid.OnShow();
404 RecomputeOpenedContainers();
405 }
406 }
407 }

◆ SplitItem()

override bool SplitItem ( )
inlineprotected
166 {
167 return m_CargoGrid.SplitItem();
168 }

◆ TakeAsAttachment()

void TakeAsAttachment ( Widget w,
Widget receiver )
inlineprotected
593 {
594 ItemManager.GetInstance().HideDropzones();
595 ItemManager.GetInstance().SetIsDragging( false );
598 int slot_id = -1;
599 bool is_reserved = false;
601 receiver.GetUserData(slots_icon);
602 //string name = receiver.GetName();
603 //name.Replace("PanelWidget", "Render");
604
605 //ItemPreviewWidget receiver_iw = ItemPreviewWidget.Cast( receiver.FindAnyWidget(name) );
606 if( slots_icon )
607 {
608 receiver_item = slots_icon.GetEntity();
609 slot_id = slots_icon.GetSlotID();
610 attached_entity = slots_icon.GetSlotParent();
611 is_reserved = slots_icon.IsReserved();
612 }
613
615 if( !item )
616 {
617 return;
618 }
621 float stackable;
622
624 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
625 return;
626
630 if( Class.CastTo(wpn, m_Entity ) && Class.CastTo(mag, item ) )
631 {
632 if( player.GetWeaponManager().CanAttachMagazine( wpn, mag ) )
633 {
634 player.GetWeaponManager().AttachMagazine( mag );
635 }
636 }
637 else if( receiver_item && !is_reserved )
638 {
639 if( ( ItemBase.Cast( receiver_item ) ).CanBeCombined( ItemBase.Cast( item ) ) )
640 {
642 }
644 {
645 if( !receiver_item.GetInventory().CanRemoveEntity() )
646 return;
647 GetGame().GetPlayer().PredictiveSwapEntities( receiver_item, item );
648 }
649 else if( receiver_item.GetInventory().CanAddAttachment( item ) )
650 {
651 player.PredictiveTakeEntityToTargetAttachment(receiver_item, item);
652 }
653 }
654 else if( attached_entity && attached_entity.GetInventory().CanAddAttachmentEx( item, slot_id ) )
655 {
656 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, slot_id);
657 }
658 else if(attached_entity && attached_entity.GetInventory().CanAddAttachment(item))
659 {
660 attached_entity.GetInventory().FindFreeLocationFor(item,FindInventoryLocationType.ATTACHMENT,il);
661 player.PredictiveTakeEntityToTargetAttachmentEx(attached_entity, item, il.GetSlot());
662 }
663 else if( m_Entity.GetInventory().CanAddAttachment(item) )
664 {
665 m_Entity.GetInventory().FindFreeLocationFor(item,FindInventoryLocationType.ATTACHMENT,il);
666 player.PredictiveTakeEntityToTargetAttachmentEx(m_Entity, item, il.GetSlot());
667 }
668 else if( m_Entity.GetInventory().CanAddEntityInCargo( item, item.GetInventory().GetFlipCargo() ) && !m_Entity.GetInventory().HasEntityInCargo( item ) )
669 {
671 }
672 /*else if( !player.GetInventory().HasEntityInInventory( item ) || !m_Entity.GetInventory().HasEntityInCargo( item ) )
673 {
674 SplitItemUtils.TakeOrSplitToInventory( PlayerBase.Cast( GetGame().GetPlayer() ), m_Entity, item );
675 }*/
676 }
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Definition ItemBase.c:5642

Перекрестные ссылки GameInventory::CanSwapEntitiesEx(), Class::CastTo(), CombineItemsClient(), GetGame(), ItemManager::GetInstance(), GetPlayer(), m_Entity и SplitItemUtils::TakeOrSplitToInventory().

◆ TakeIntoHands()

void TakeIntoHands ( notnull PlayerBase player,
notnull EntityAI item )
inlineprotected
412 {
414
415 if( !item.GetInventory().CanRemoveEntity() || !player.CanManipulateInventory() )
416 return;
417
418 float stackable = item_base.GetTargetQuantityMax();
419
420 if( stackable == 0 || stackable >= item_base.GetQuantity() )
421 {
422 player.PredictiveTakeEntityToHands( item );
423 }
424 else if( stackable != 0 && stackable < item_base.GetQuantity() )
425 {
426 item_base.SplitIntoStackMaxHandsClient( player );
427 }
428 }

◆ TransferItem()

override bool TransferItem ( )
inlineprotected
176 {
177 return m_CargoGrid.TransferItem();
178 }

◆ TransferItemToVicinity()

override bool TransferItemToVicinity ( )
inlineprotected
181 {
182 return m_CargoGrid.TransferItemToVicinity();
183 }

◆ UnfocusAll() [1/2]

override void UnfocusAll ( )
inlineprotected
161 {
162 m_CargoGrid.Unfocus();
163 }

◆ UnfocusAll() [2/2]

override void UnfocusAll ( )
inlineprotected
269 {
270 if( m_Atts )
271 {
272 m_Atts.UnfocusAll();
273 }
274
275 if( m_CargoGrid )
276 {
277 m_CargoGrid.UnfocusAll();
278 }
279
280 foreach( EntityAI e1, CargoContainer cargo : m_AttachmentCargos )
281 {
282 cargo.UnfocusAll();
283
284 }
285
287 {
288 att.UnfocusAll();
289 }
290 }

◆ UpdateInterval() [1/2]

override void UpdateInterval ( )
inlineprotected
109 {
110 if ( m_Entity )
111 {
112 if ( m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !m_Entity.CanDisplayCargo() )
113 {
114 LockCargo(true);
115 if ( m_CargoGrid.IsVisible() )
116 {
117 RecomputeOpenedContainers();
118 }
119 }
120 else
121 {
122 LockCargo(false);
123 if ( !m_CargoGrid.IsVisible() )
124 {
125 RecomputeOpenedContainers();
126 }
127 }
128
129 super.UpdateInterval();
130 m_CargoGrid.UpdateInterval();
131
132 bool hide = m_LockCargo || ItemManager.GetInstance().GetDraggedItem() == m_Entity;
133 if (!hide)
134 {
135 SetOpenForSlotIcon(IsOpened());
136 }
137
138 if ( m_SlotIcon )
139 {
140 m_SlotIcon.GetRadialIconPanel().Show( !hide );
141 }
142 }
143 }
override bool IsOpened()
Definition ContainerWithCargo.c:103

Перекрестные ссылки ItemManager::GetInstance(), IsOpened(), LockCargo() и m_Entity.

◆ UpdateInterval() [2/2]

override void UpdateInterval ( )
inlineprotected
230 {
231 if ( m_Entity )
232 {
233 if (m_CargoGrid)
234 {
235 bool hideCargo = m_Entity.GetInventory().IsInventoryLockedForLockType( HIDE_INV_FROM_SCRIPT ) || !m_Entity.CanDisplayCargo() || m_ForcedHide;
236 if (m_CargoGrid.IsVisible() && hideCargo)
237 {
238 HideCargo();
239 }
240 else if (!m_CargoGrid.IsVisible() && !hideCargo)
241 {
242 ShowCargo();
243 }
244
245 m_CargoGrid.UpdateInterval();
246 }
247
248 if ( m_SlotIcon )
249 {
250 bool hide = m_LockCargo || ItemManager.GetInstance().GetDraggedItem() == m_Entity;
251 if (!hide)
252 {
253 SetOpenForSlotIcon(IsOpened());
254 }
255 m_SlotIcon.GetRadialIconPanel().Show( !hide );
256
257 }
258
259 super.UpdateInterval();
260 }
261 }

Перекрестные ссылки ItemManager::GetInstance(), IsOpened() и m_Entity.

Поля

◆ m_AttachmentAttachments

ref map<EntityAI, ref Attachments> m_AttachmentAttachments
protected

◆ m_AttachmentAttachmentsContainers

ref map<EntityAI, ref AttachmentsWrapper> m_AttachmentAttachmentsContainers
protected

◆ m_AttachmentCargos

ref map<EntityAI, ref CargoContainer> m_AttachmentCargos
protected

◆ m_AttachmentSlotsSorted

ref array<int> m_AttachmentSlotsSorted
protected

◆ m_Atts

ref Attachments m_Atts
protected

◆ m_CargoGrid

ref CargoContainer m_CargoGrid
protected

Используется в GetCargo().

◆ m_CargoIndex

int m_CargoIndex = -1
protected

Объявления и описания членов классов находятся в файлах: