Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventoryAttachmentStorageUI.c
Go to the documentation of this file.
2 {
3  protected ref InventorySearchPredicate m_SearchPredicate;
4 
5  //------------------------------------------------------------------------------------------------
6  override void HandlerAttached(Widget w)
7  {
8  super.HandlerAttached(w);
9 
10  InitPaging();
11  SetRowsAndColumns();
12  CreateEmptyLayout();
13  if (CreateSlots() == 0)
14  {
15  CloseStorage();
16  return;
17  }
18  SortSlots();
19  ShowPage(0);
20 
21  m_widget.FindAnyWidget("CategoryPanel").SetVisible(false);
22  ActivateCloseStorageButton();
23  }
24 
25  override void Init()
26  {
27  super.Init();
28 
29  m_wItemStorage.SetVisible(false);
30  m_wCapacityPercentageText.SetVisible(false);
31  m_wWeightText.SetVisible(false);
32  m_wCapacityDisplay.SetVisible(false);
33  m_wWeightDisplay.SetVisible(false);
34  }
35 
36  protected override void SetPreviewItem()
37  {
38  }
39 
40  protected override int CreateSlots()
41  {
42  array<IEntity> pItemsInStorage = {};
43  int count = GetRelevantItems(pItemsInStorage);
44  UpdateOwnedSlots(pItemsInStorage);
45 
46  return count;
47  }
48 
49  protected int GetRelevantItems(out notnull array<IEntity> items)
50  {
52  return m_InventoryManager.FindItems(items, m_SearchPredicate);
53 
54  return 0;
55  }
56 
57  override bool IsTraversalAllowed()
58  {
59  return false;
60  }
61 
62  override void Refresh()
63  {
64  if (!m_wGrid)
65  return;
66 
67  InitPaging();
68  SetRowsAndColumns();
69  CreateEmptyLayout();
70  if (CreateSlots() == 0)
71  {
72  CloseStorage();
73  return;
74  }
75  SortSlots();
76  ShowPage(0);
77  }
78 
79  protected void ActivateCloseStorageButton()
80  {
81  m_wCloseStorageButton = ButtonWidget.Cast(m_widget.FindAnyWidget("CloseStorageBtn"));
82  if (m_wCloseStorageButton)
83  {
84  m_wCloseStorageButton.SetVisible(true);
86  if (nav)
87  {
88  if (GetGame().GetInputManager().GetLastUsedInputDevice() == EInputDeviceType.GAMEPAD)
89  nav.EnableCloseWithGamepad(false);
90  nav.m_OnActivated.Insert(CloseStorage);
91  }
92  }
93  }
94 
95  protected void CloseStorage()
96  {
97  m_MenuHandler.RemoveAttachmentStorage(this);
98  }
99 
100  //------------------------------------------------------------------------------------------------
102  BaseInventoryStorageComponent storage,
103  LoadoutAreaType slotID = null,
104  SCR_InventoryMenuUI menuManager = null,
105  int iPage = 0,
106  array<BaseInventoryStorageComponent> aTraverseStorage = null,
107  InventorySearchPredicate searchPredicate = null)
108  {
109  m_Storage = storage;
110  m_MenuHandler = menuManager;
111  m_eSlotAreaType = slotID;
112  m_iMaxRows = 1;
113  m_iMaxColumns = 4;
114  m_iMatrix = new SCR_Matrix(m_iMaxColumns, m_iMaxRows);
115  m_iPageSize = m_iMaxRows * m_iMaxColumns;
116  m_SearchPredicate = searchPredicate;
117  }
118 }
119 
120 //------------------------------------------------------------------------------------------------
122 {
123  override void HandlerAttached(Widget w)
124  {
125  super.HandlerAttached(w);
126  w.FindAnyWidget("CategoryPanel").SetVisible(false);
127 
128  m_aSlots.Insert(CreateSlotUI(null));
129  }
130 
131  protected override SCR_InventorySlotUI CreateSlotUI(InventoryItemComponent pComponent, SCR_ItemAttributeCollection pAttributes = null)
132  {
133  return new SCR_InventoryAttachmentSlotUI(null, this);
134  }
135 
136  protected string GetBoneName();
137  TNodeId GetBoneIndex();
138 
139  //------------------------------------------------------------------------------------------------
141  BaseInventoryStorageComponent storage,
142  LoadoutAreaType slotID = null,
143  SCR_InventoryMenuUI menuManager = null,
144  int iPage = 0,
145  array<BaseInventoryStorageComponent> aTraverseStorage = null)
146  {
147  m_Storage = storage;
148  m_MenuHandler = menuManager;
149  m_eSlotAreaType = slotID;
150  m_iMaxRows = 1;
151  m_iMaxColumns = 1;
152  m_iMatrix = new SCR_Matrix(m_iMaxColumns, m_iMaxRows);
153  }
154 }
155 
156 //------------------------------------------------------------------------------------------------
158 {
159  override void UpdateReferencedComponent(InventoryItemComponent pComponent, SCR_ItemAttributeCollection attributes = null)
160  {
161  Widget wGrid = m_pStorageUI.GetStorageGrid();
162  m_widget = GetGame().GetWorkspace().CreateWidgets("{F437ACE2BD5F11E1}UI/layouts/Menus/Inventory/InventoryItemSlot.layout", wGrid);
163  m_widget.AddHandler(this);
164  }
165 
166  override bool OnDrop(SCR_InventorySlotUI slot)
167  {
168  return m_pStorageUI.OnDrop(slot);
169  }
170 }
SCR_InventoryAttachmentPointUI
void SCR_InventoryAttachmentPointUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null)
Definition: SCR_InventoryAttachmentStorageUI.c:140
GetBoneName
protected string GetBoneName()
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetBoneIndex
TNodeId GetBoneIndex()
m_InventoryManager
SCR_InventoryStorageManagerComponent m_InventoryManager
Definition: SCR_AttachementAction.c:15
SCR_InventoryStorageBaseUI
Definition: SCR_InventoryStorageBaseUI.c:6
SCR_InventoryNavigationButtonBack
Interactive non-focus button showing hint, and triggering actions.
Definition: SCR_InventoryNavigationButtonBack.c:4
m_aSlots
protected ref array< SCR_WeaponRackSlotEntity > m_aSlots
Definition: SCR_ArsenalDisplayComponent.c:13
SCR_InventoryMenuUI
Definition: SCR_InventoryMenuUI.c:247
HandlerAttached
SCR_InventoryAttachmentStorageUI SCR_InventoryStorageBaseUI HandlerAttached(Widget w)
Definition: SCR_InventoryAttachmentStorageUI.c:123
InventoryItemComponent
Definition: InventoryItemComponent.c:12
SCR_ItemAttributeCollection
Definition: SCR_ItemAttributeCollection.c:2
CreateSlotUI
protected override SCR_InventorySlotUI CreateSlotUI(InventoryItemComponent pComponent, SCR_ItemAttributeCollection pAttributes=null)
Definition: SCR_InventoryAttachmentStorageUI.c:131
GetInputManager
protected InputManager GetInputManager()
Definition: SCR_BaseManualCameraComponent.c:65
SCR_Matrix
Definition: SCR_Matrix.c:2
SCR_InventoryAttachmentSlotUI
Definition: SCR_InventoryAttachmentStorageUI.c:157
LoadoutAreaType
Definition: LoadoutAreaType.c:12
m_MenuHandler
SCR_DeployMenuBase m_MenuHandler
Main deploy menu with the map present.
SCR_InventoryAttachmentStorageUI
Definition: SCR_InventoryAttachmentStorageUI.c:1
SCR_InventorySlotUI
Definition: SCR_InventorySlotUI.c:27
m_Storage
BaseInventoryStorageComponent m_Storage
Definition: SCR_TourniquetStorageComponent.c:10
m_SearchPredicate
protected ref InventorySearchPredicate m_SearchPredicate
Definition: SCR_InventoryAttachmentStorageUI.c:2