Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_InventoryAttachmentStorageUI.c
Go to the documentation of this file.
2{
4
5 //------------------------------------------------------------------------------------------------
6 override void HandlerAttached(Widget w)
7 {
8 super.HandlerAttached(w);
9
10 InitPaging();
13 if (CreateSlots() == 0)
14 {
16 return;
17 }
18 SortSlots();
19 ShowPage(0);
20
21 m_widget.FindAnyWidget("HeaderOverlay").SetVisible(false);
23 }
24
25 //------------------------------------------------------------------------------------------------
26 override event void HandlerDeattached(Widget w)
27 {
28 super.HandlerDeattached(w);
30 }
31
32 protected override void SetPreviewItem()
33 {
34 }
35
36 protected override int CreateSlots()
37 {
38 array<IEntity> pItemsInStorage = {};
39 int count = GetRelevantItems(pItemsInStorage);
40 UpdateOwnedSlots(pItemsInStorage);
41
42 return count;
43 }
44
45 protected int GetRelevantItems(out notnull array<IEntity> items)
46 {
48 return m_InventoryManager.FindItems(items, m_SearchPredicate, EStoragePurpose.PURPOSE_ANY);
49
50 return 0;
51 }
52
53 override bool IsTraversalAllowed()
54 {
55 return false;
56 }
57
58 override void Refresh()
59 {
60 if (!m_wGrid)
61 return;
62
63 InitPaging();
66 if (CreateSlots() == 0)
67 {
69 return;
70 }
71 SortSlots();
72 ShowPage(0);
73 }
74
76 {
77 m_wCloseStorageButton = ButtonWidget.Cast(m_widget.FindAnyWidget("CloseStorageBtn"));
79 {
80 m_wCloseStorageButton.SetVisible(true);
82 if (nav)
83 {
84 if (GetGame().GetInputManager().GetLastUsedInputDevice() == EInputDeviceType.GAMEPAD)
85 nav.EnableCloseWithGamepad(false);
86 nav.m_OnActivated.Insert(CloseStorage);
87 }
88 }
89 }
90
91 protected void CloseStorage()
92 {
93 m_MenuHandler.RemoveAttachmentStorage(this);
94 }
95
96 //------------------------------------------------------------------------------------------------
98 BaseInventoryStorageComponent storage,
99 LoadoutAreaType slotID = null,
100 SCR_InventoryMenuUI menuManager = null,
101 int iPage = 0,
102 array<BaseInventoryStorageComponent> aTraverseStorage = null,
103 InventorySearchPredicate searchPredicate = null)
104 {
105 m_Storage = storage;
106 m_MenuHandler = menuManager;
107 m_eSlotAreaType = slotID;
108 m_iMaxRows = 1;
109 m_iMaxColumns = 4;
112 m_SearchPredicate = searchPredicate;
113 }
114}
115
116//------------------------------------------------------------------------------------------------
118{
119 override void HandlerAttached(Widget w)
121 super.HandlerAttached(w);
122 w.FindAnyWidget("HeaderOverlay").SetVisible(false);
123
124 m_aSlots.Insert(CreateSlotUI(null));
125 }
126
128 {
129 return new SCR_InventoryAttachmentSlotUI(null, this);
130 }
131
132 protected override void SetPreviewItem();
133 protected string GetBoneName();
135
136 //------------------------------------------------------------------------------------------------
138 BaseInventoryStorageComponent storage,
139 LoadoutAreaType slotID = null,
140 SCR_InventoryMenuUI menuManager = null,
141 int iPage = 0,
142 array<BaseInventoryStorageComponent> aTraverseStorage = null)
144 m_Storage = storage;
145 m_MenuHandler = menuManager;
146 m_eSlotAreaType = slotID;
147 m_iMaxRows = 1;
148 m_iMaxColumns = 1;
149 m_iMatrix = new SCR_Matrix(m_iMaxColumns, m_iMaxRows);
150 }
151}
152
153//------------------------------------------------------------------------------------------------
155{
156 override void UpdateReferencedComponent(InventoryItemComponent pComponent, SCR_ItemAttributeCollection attributes = null)
157 {
158 Widget wGrid = m_pStorageUI.GetStorageGrid();
159 m_widget = GetGame().GetWorkspace().CreateWidgets(SLOT_LAYOUT_1x1, wGrid);
160 m_widget.AddHandler(this);
161 }
163 override bool OnDrop(SCR_InventorySlotUI slot)
164 {
165 return m_pStorageUI.OnDrop(slot);
166 }
167}
ArmaReforgerScripted GetGame()
Definition game.c:1398
ref array< SCR_WeaponRackSlotEntity > m_aSlots
InputManager GetInputManager()
SCR_DeployMenuBase m_MenuHandler
Main deploy menu with the map present.
override SCR_InventorySlotUI CreateSlotUI(InventoryItemComponent pComponent, SCR_ItemAttributeCollection pAttributes=null)
string GetBoneName()
void SCR_InventoryAttachmentPointUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null)
TNodeId GetBoneIndex()
override void SetPreviewItem()
SCR_InventoryHitZoneUI SCR_InventoryAttachmentPointUI OnDrop(SCR_InventorySlotUI slot)
const string SLOT_LAYOUT_1x1
override void HandlerAttached(Widget w)
BaseInventoryStorageComponent m_Storage
void SCR_InventoryAttachmentStorageUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null, InventorySearchPredicate searchPredicate=null)
int GetRelevantItems(out notnull array< IEntity > items)
Interactive non-focus button showing hint, and triggering actions.
void SCR_InventorySlotUI(InventoryItemComponent pComponent=null, SCR_InventoryStorageBaseUI pStorageUI=null, bool bVisible=true, int iSlotIndex=-1, SCR_ItemAttributeCollection pAttributes=null)
SCR_InventoryStorageBaseUI m_pStorageUI
void ShowPage(int iPage, out int slotToFocus=-1)
void CreateEmptyLayout(bool recreate=false)
void SCR_InventoryStorageBaseUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null)
void UpdateOwnedSlots(notnull array< IEntity > pItemsInStorage)
BaseInventoryStorageComponent m_Storage
SCR_InventoryStorageManagerComponent m_InventoryManager
void DestroyEmptySlots()
Destroys all empty slots which were created by this handler.
bool OnDrop(SCR_InventorySlotUI slot)
int TNodeId
Node global id is a hash of name of the node.
Definition EnEntity.c:18
EStoragePurpose