Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventoryStorageBaseUI.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
2 
5 
6 class SCR_InventoryStorageBaseUI : ScriptedWidgetComponent
7 {
8  static ref map<SCR_ArsenalInventorySlotUI, IEntity> ARSENAL_SLOT_STORAGES = new map<SCR_ArsenalInventorySlotUI, IEntity>();
9 
10  const float STORAGE_NON_HIGHLIGHTED_OPACITY = 0.35;
11  const string ARSENAL_TITLE_LAYOUT ="{E0C9EDCB8E63F10A}UI/layouts/Menus/Inventory/ArsenalInventoryTraverseTitlePanel.layout";
12  const string SUPPLY_TITLE_LAYOUT ="{FCE2E160F8C0D4D4}UI/layouts/Menus/Inventory/SupplyInventoryTraverseTitlePanel.layout";
13  const string GENERIC_CONTAINER_PREFAB = "{9F0C54A3740F7FC9}Prefabs/Props/Military/SupplyBox/SupplyPortableContainers/SupplyPortableContainer_01/SupplyContainerGeneric.et";
14  const string STORAGE_TITLE_LAYOUT = "{EBBF9E10DB195DB0}UI/layouts/Menus/Inventory/InventoryTraverseTitlePanel.layout";
15  const string SLOT_LAYOUT_1x1_EMPTY = "{B11F8BE49DFB62A1}UI/layouts/Menus/Inventory/Inventory20Slot_1x1_empty.layout";
16  protected const int SLOT_LAYOUT_WIDTH = 70;
17  protected ChimeraCharacter m_Player;
18  protected SCR_InventoryStorageManagerComponent m_InventoryManager; //manager - handles all the adding / removing operations
19  protected SCR_CharacterInventoryStorageComponent m_InventoryStorage; //top-most character's inventory component
20  protected InputManager m_pInputManager;
21  protected BaseInventoryStorageComponent m_Storage; //linked storage
22  protected SCR_ResourceComponent m_ResourceComponent;
23  protected SCR_ResourceConsumer m_ResourceConsumer;
24  protected SCR_InventoryMenuUI m_MenuHandler;
25  protected ref array<SCR_InventorySlotUI> m_aSlots = {};
26  protected SCR_InventorySlotUI m_pSelectedSlot = null;
27  protected SCR_InventorySlotUI m_pPrevSelectedSlot = null;
28  protected SCR_InventorySlotUI m_pFocusedSlot = null;
29  protected SCR_InventorySlotUI m_pLastFocusedSlot = null; //memorize the last focused slot before leaving the actual UI storage
30 
31  protected WorkspaceWidget m_workspaceWidget = null;
32  protected Widget m_widget = null;
33  protected GridLayoutWidget m_wGrid; //non-uniform grid
34  //protected string m_sGridPath = "centerFrame.gridFrame.size.grid";
35  protected string m_sGridPath = "GridLayout0";
36  protected PanelWidget m_wDropContainer;
37  protected LoadoutAreaType m_eSlotAreaType = null;
38  protected bool m_bEnabled = false; //if it is enabled for manipulation ( can be removed or an item can be moved into )
39  protected bool m_bSelected = false;
40  protected bool m_bShown = true;
41  protected ItemPreviewWidget m_wItemStorage, m_wTraverseItemStorage;
42  protected RenderTargetWidget m_wPreviewImage, m_wTraversePreviewImage;
43 
44  protected ref SCR_Matrix m_iMatrix;
45  protected int m_iMaxRows, m_iMaxColumns, m_iPageSize;
46  //protected int m_iPage = 0;
47  protected int m_iNrOfPages = 0;
48  protected TextWidget m_wStorageName, m_wCapacityPercentageText, m_wWeightText, m_wResourceAvailableText, m_wResourceStoredText;
49  protected Widget m_wCapacityDisplay, m_wWeightDisplay, m_wResourceAvailableDisplay, m_wResourceStoredDisplay;
50  protected SizeLayoutWidget m_wWidthOverride;
51  protected int m_iLastShownPage = 0;
52  protected SCR_SpinBoxPagingComponent m_wPagingSpinboxComponent;
53  protected ref array<BaseInventoryStorageComponent> m_aTraverseStorage = {};
54  protected ref array<Widget> m_aTraverseTitle = {};
55  protected ref array<SCR_ResourceComponent> m_aResourceCompsInStorage = {};
56  protected ButtonWidget m_wButton, m_wLastCloseTraverseButton, m_wCloseStorageButton;
57  protected ref SCR_ResourceSystemSubscriptionHandleBase m_ResourceSubscriptionHandleConsumer;
58 
59  protected LocalizedString m_sSuppliesStoredFormat = "#AR-Campaign_BaseSuppliesAmount";
60  protected LocalizedString m_sSuppliesAvailableFormat = "#AR-Supplies_Arsenal_Availability";
61 
62  //------------------------------------------------------------------------ USER METHODS ------------------------------------------------------------------------
63 
64  //------------------------------------------------------------------------------------------------
65  void Init()
66  {
67  m_pInputManager = GetGame().GetInputManager();
68  //get the workspace
69  if ( m_workspaceWidget == null )
70  m_workspaceWidget = GetGame().GetWorkspace();
71 
72  //Get player
73  // TODO: make it independent on player ( might be used for example in editor to change the loadout of a character )
74  PlayerController pPlayerController = GetGame().GetPlayerController();
75  if( !pPlayerController )
76  return;
77  m_Player = ChimeraCharacter.Cast(pPlayerController.GetControlledEntity());
78  if( !m_Player )
79  return;
80 
81  //Get inventory manager and the actual character's topmost storage
82  m_InventoryManager = SCR_InventoryStorageManagerComponent.Cast( m_Player.FindComponent( SCR_InventoryStorageManagerComponent ) );
83  m_InventoryStorage = SCR_CharacterInventoryStorageComponent.Cast( m_Player.FindComponent( SCR_CharacterInventoryStorageComponent ) );
84  m_wGrid = GridLayoutWidget.Cast( m_widget.FindAnyWidget( m_sGridPath ) );
85  m_wStorageName = TextWidget.Cast( m_widget.FindAnyWidget( "TextC" ) );
86  m_wItemStorage = ItemPreviewWidget.Cast( m_widget.FindAnyWidget( "itemStorage" ) );
87  m_wCapacityPercentageText = TextWidget.Cast(m_widget.FindAnyWidget("CapacityPercentageText"));
88  m_wWeightText = TextWidget.Cast(m_widget.FindAnyWidget("WeightText"));
89  m_wCapacityDisplay = Widget.Cast(m_widget.FindAnyWidget("CapacityDisplay"));
90  m_wWeightDisplay = Widget.Cast(m_widget.FindAnyWidget("WeightDisplay"));
91  m_wWidthOverride = SizeLayoutWidget.Cast(m_widget.FindWidget("TitleWidthOverride"));
92 
93  InitPaging();
94  SetRowsAndColumns();
95 
96  //Set the proper ratio according to the number of columns and rows
97  SizeLayoutWidget wSizeContainer = SizeLayoutWidget.Cast( m_widget.FindAnyWidget( "SizeLayout0" ) );
98  if ( wSizeContainer )
99  wSizeContainer.SetAspectRatio( m_iMaxColumns / m_iMaxRows );
100 
101  if (m_wWidthOverride)
102  m_wWidthOverride.SetWidthOverride(m_iMaxColumns * SLOT_LAYOUT_WIDTH);
103 
104  //Get the storage the UI container will be showing the content from
105  if (!m_InventoryStorage)
106  m_Storage = m_InventoryStorage.GetStorageFromLoadoutSlot( m_eSlotAreaType );
107  if (!m_Storage)
108  m_Storage = m_InventoryStorage.GetWeaponStorage();
109  if (!m_Storage)
110  return;
111 
112  if (Type() != SCR_InventoryStorageLootUI && m_wWeightDisplay)
113  {
114  if (Type() != SCR_InventoryStorageWeaponsUI && m_wCapacityDisplay)
115  {
116  m_wCapacityDisplay.SetVisible(true);
117  UpdateVolumePercentage( GetOccupiedVolumePercentage( m_Storage ) );
118  }
119 
120  m_wWeightDisplay.SetVisible(true);
121  UpdateTotalWeight( GetTotalRoundedUpWeight( m_Storage ) );
122  }
123 
124  SetPreviewItem();
125  if (!m_wStorageName)
126  return;
127  ItemAttributeCollection attributes = m_Storage.GetAttributes();
128  if (!attributes)
129  return;
130  UIInfo uiInfo = attributes.GetUIInfo();
131  if (!uiInfo)
132  return;
133  m_wStorageName.SetText(uiInfo.GetName());
134 
135  m_wResourceStoredDisplay = Widget.Cast(m_widget.FindAnyWidget("ResourceDisplayStored"));
136  if (m_wResourceStoredDisplay)
137  m_wResourceStoredText = TextWidget.Cast(m_wResourceStoredDisplay.FindAnyWidget("ResourceText"));
138 
139  m_wResourceAvailableDisplay = Widget.Cast(m_widget.FindAnyWidget("ResourceDisplayAvailable"));
140  if (m_wResourceAvailableDisplay)
141  m_wResourceAvailableText = TextWidget.Cast(m_wResourceAvailableDisplay.FindAnyWidget("ResourceText"));
142 
143  if (!m_wResourceStoredText || !m_wResourceAvailableText)
144  return;
145 
146  //~ Will ignore storage components of vehicle slots if they already have a storage assigned
147  if (m_Storage && m_Storage.GetOwner())
148  m_ResourceComponent = SCR_ResourceComponent.FindResourceComponent(m_Storage.GetOwner(), true);
149 
151  RefreshConsumer();
152 
153  if (!m_ResourceConsumer)
154  return;
155 
157 
158  if (!resourceInventoryPlayerComponent)
159  return;
160 
161  m_ResourceComponent.TEMP_GetOnInteractorReplicated().Insert(RefreshConsumer);
162 
163  RplId resourceInventoryPlayerComponentRplId = Replication.FindId(resourceInventoryPlayerComponent);
164 
165  if (!resourceInventoryPlayerComponentRplId.IsValid())
166  return;
167 
168  m_ResourceSubscriptionHandleConsumer = GetGame().GetResourceSystemSubscriptionManager().RequestSubscriptionListenerHandle(m_ResourceConsumer, resourceInventoryPlayerComponentRplId);
169  }
170 
171  //------------------------------------------------------------------------------------------------
172  void InitPaging()
173  {
174  if( m_InventoryStorage )
175  {
176  m_wPagingSpinboxComponent = SCR_SpinBoxPagingComponent.GetSpinBoxPagingComponent("SpinBoxContainer", m_widget);
177  if ( m_wPagingSpinboxComponent )
178  {
179  m_wPagingSpinboxComponent.SetPageCount( 0 );
180  m_wPagingSpinboxComponent.SetCurrentItem( 0, false );
181  m_wPagingSpinboxComponent.SetButtonsActive(false);
182  SetPagingActive(false);
183  }
184 
185  }
186  }
187 
188  //------------------------------------------------------------------------------------------------
189  void SetPagingActive(bool active)
190  {
191  if (!m_wPagingSpinboxComponent)
192  return;
193 
194  m_wPagingSpinboxComponent.m_OnChanged.Remove(Action_ChangePage);
195  if (active)
196  m_wPagingSpinboxComponent.m_OnChanged.Insert(Action_ChangePage);
197 
198  m_wPagingSpinboxComponent.SetButtonsActive(active);
199  m_wPagingSpinboxComponent.SetButtonsVisible(active);
200  }
201 
202  //------------------------------------------------------------------------------------------------
203  override bool OnFocus( Widget w, int x, int y )
204  {
205  if ( m_MenuHandler )
206  m_MenuHandler.OnContainerHovered( this );
207  return false;
208  }
209 
210  //------------------------------------------------------------------------------------------------
211  override bool OnFocusLost( Widget w, int x, int y )
212  {
213  if ( m_MenuHandler )
214  m_MenuHandler.OnContainerLeft( this );
215  return false;
216  }
217 
218  //------------------------------------------------------------------------------------------------
219  override bool OnMouseEnter(Widget w, int x, int y)
220  {
221  if ( m_MenuHandler )
222  m_MenuHandler.OnContainerHovered( this );
223 
224  return false;
225  }
226 
227  //------------------------------------------------------------------------------------------------
228  override bool OnMouseLeave( Widget w, Widget enterW, int x, int y)
229  {
230  if (enterW && w && w.FindAnyWidget(enterW.GetName()))
231  return false;
232 
233  if ( m_MenuHandler )
234  m_MenuHandler.OnContainerLeft( this );
235 
236  return false;
237  }
238 
239  bool OnDrop(SCR_InventorySlotUI slot)
240  {
241  return false;
242  }
243 /*
244  override bool OnUpdate(Widget w)
245  {
246  Widget w2 = w;
247  PrintFormat( "INV: widget: %1", WidgetManager.GetWidgetUnderCursor() );
248  return false;
249  }
250 */
251 
252  //------------------------------------------------------------------------------------------------
253  void SetRowsAndColumns()
254  {
255  for ( int m = 0; m < m_iMaxRows; m++ )
256  {
257  m_wGrid.SetRowFillWeight( m, 0 );
258  for ( int n = 0; n < m_iMaxColumns; n++ )
259  {
260  m_wGrid.SetColumnFillWeight( n, 0 );
261  }
262  }
263  }
264 
265  //------------------------------------------------------------------------------------------------
266  private BaseInventoryStorageComponent PushState(BaseInventoryStorageComponent storage)
267  {
268  m_aTraverseStorage.Insert(storage);
269  return storage;
270  }
271 
272  //------------------------------------------------------------------------------------------------
273  private BaseInventoryStorageComponent PopState(int traverseStorageIndex)
274  {
275  if ( m_aTraverseStorage.IsEmpty() )
276  return null;
277 
278  if ( traverseStorageIndex == -1 )
279  return null;
280 
281  for ( int i = m_aTraverseStorage.Count() - 1; i >= traverseStorageIndex; --i)
282  {
283  m_aTraverseStorage.Remove(i);
284  if (m_aTraverseStorage.IsEmpty())
285  return null;
286  }
287  return m_aTraverseStorage[ m_aTraverseStorage.Count() - 1 ];
288  }
289 
290  //------------------------------------------------------------------------------------------------
291  BaseInventoryStorageComponent GetCurrentNavigationStorage()
292  {
293  if (m_aTraverseStorage.Count() > 0)
294  {
295  return m_aTraverseStorage[m_aTraverseStorage.Count() - 1];
296  }
297  return m_Storage;
298  }
299 
300  //------------------------------------------------------------------------------------------------
301  bool IsTraversalAllowed()
302  {
303  return true;
304  }
305 
306  //------------------------------------------------------------------------------------------------
307  void Traverse(BaseInventoryStorageComponent storage)
308  {
309  DeleteSlots();
310  PushState( storage );
311  FillItemsFromStorage( storage );
312  SortSlots();
313  ShowPage( 0 );
314 
315  //play open sound
316  if (!m_aTraverseStorage.Find(storage))
317  {
318  IEntity entity = storage.GetOwner();
319  m_InventoryManager.PlayItemSound(entity, SCR_SoundEvent.SOUND_CONTAINER_OPEN);
320  }
321 
322  SCR_InventoryMenuUI inventoryMenu = GetInventoryMenuHandler();
323  if (inventoryMenu)
324  inventoryMenu.OpenLinkedStorages(storage, false);
325  }
326 
327  //------------------------------------------------------------------------------------------------
328  void Back(int traverseStorageIndex)
329  {
330  DeleteSlots();
331 
332  BaseInventoryStorageComponent lastStorage = m_aTraverseStorage.Get(traverseStorageIndex);
333  if (lastStorage)
334  {
335  //play CLOSE sound
336  IEntity entity = lastStorage.GetOwner();
337  m_InventoryManager.PlayItemSound(entity, SCR_SoundEvent.SOUND_CONTAINER_CLOSE);
338 
339  //~ Close any linked storages
340  SCR_InventoryMenuUI inventoryMenu = GetInventoryMenuHandler();
341  if (inventoryMenu)
342  inventoryMenu.CloseLinkedStorages(lastStorage);
343  }
344 
345  auto storage = PopState( traverseStorageIndex );
346 
347  if (!storage)
348  {
349  Home();
350  return;
351  }
352 
353  FillItemsFromStorage( storage );
354  SortSlots();
355  ShowPage( 0 );
356  }
357 
358  //------------------------------------------------------------------------------------------------
359  void Home()
360  {
361  DeleteSlots();
362  m_aTraverseStorage.Clear();
363  ClearTraverseTitles();
364  CreateSlots();
365  SortSlots();
366  ShowPage(0);
367  }
368 
369  //------------------------------------------------------------------------------------------------
370  float GetTotalResources(notnull SCR_ResourceConsumer resourceContainer)
371  {
372  return resourceContainer.GetAggregatedResourceValue();
373  }
374 
375  //------------------------------------------------------------------------------------------------
376  float GetMaxResources(notnull SCR_ResourceConsumer resourceContainer)
377  {
378  return resourceContainer.GetAggregatedMaxResourceValue();
379  }
380 
381  //------------------------------------------------------------------------------------------------
382  void GetTraverseStorage( out notnull array<BaseInventoryStorageComponent> aTraverseStorage )
383  {
384  aTraverseStorage.Copy( m_aTraverseStorage );
385  }
386 
387  //------------------------------------------------------------------------------------------------
388  void Action_ChangePage( SCR_SpinBoxPagingComponent pSpinBox, int page )
389  {
390  int slotToFocus = -1;
391 
392  SortSlots();
393  ShowPage(m_wPagingSpinboxComponent.GetCurrentIndex(), slotToFocus);
394 
395  GetGame().GetCallqueue().CallLater(m_MenuHandler.FocusOnSlotInStorage, 0, false, this, slotToFocus); // call later, otherwise ShowPage() would get triggered again right away
396  }
397 
398  //------------------------------------------------------------------------------------------------
399  void Action_PrevPage()
400  {
401  int slotToFocus = -1;
402 
403  SortSlots();
404  ShowPage(m_iLastShownPage - 1, slotToFocus);
405 
406  GetGame().GetCallqueue().CallLater(m_MenuHandler.FocusOnSlotInStorage, 0, false, this, slotToFocus); // call later, otherwise ShowPage() would get triggered again right away
407  }
408  //------------------------------------------------------------------------------------------------
409  void Action_NextPage()
410  {
411  int slotToFocus = -1;
412 
413  SortSlots();
414  ShowPage(m_iLastShownPage + 1, slotToFocus);
415 
416  GetGame().GetCallqueue().CallLater(m_MenuHandler.FocusOnSlotInStorage, 0, false, this, slotToFocus); // call later, otherwise ShowPage() would get triggered again right away
417  }
418 
419  //------------------------------------------------------------------------------------------------
420  bool IsStorageEnabled() { return m_bEnabled; }
421  //------------------------------------------------------------------------------------------------
422  bool IsStorageSelected() { return m_bSelected; }
423  //------------------------------------------------------------------------------------------------
424  bool GetLastShownPage() { return m_iLastShownPage; }
425 
426  //------------------------------------------------------------------------------------------------
427  BaseInventoryStorageComponent GetStorage() { return m_Storage; }
428 
429  //------------------------------------------------------------------------------------------------
430  EquipedWeaponStorageComponent GetWeaponStorage() { return EquipedWeaponStorageComponent.Cast( m_Storage ); }
431 
432  //------------------------------------------------------------------------------------------------
433  string GetStorageName()
434  {
435  ItemAttributeCollection attributes = m_Storage.GetAttributes();
436  if( !attributes )
437  return "none";
438  UIInfo uiInfo = attributes.GetUIInfo();
439  if( !uiInfo )
440  return "none";
441  return uiInfo.GetName();
442  }
443 
444  //------------------------------------------------------------------------------------------------
445  // !
446  SCR_InventorySlotUI GetSelectedSlot() { return m_pSelectedSlot; }
447  SCR_InventorySlotUI GetPrevSelectedSlot() { return m_pPrevSelectedSlot; }
448 
449  //------------------------------------------------------------------------------------------------
450  // ! Hides / unhides the storage container
451  void Show( bool bShow )
452  {
453  /* Enable to have the expand / collapse feature
454  m_bShown = bShow;
455  m_wGrid.SetVisible( m_bShown );
456  if ( m_bShown )
457  {
458  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_OPEN, true);
459  m_InventoryStorage.SetStorageAsShown( m_Storage );
460  if ( m_iNrOfPages > 1 && m_wPagingSpinboxComponent )
461  {
462  ShowPagesCounter( true, 0, m_iNrOfPages );
463  }
464  }
465  else
466  {
467  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.SOUND_INV_CONTAINER_CLOSE, true);
468  m_InventoryStorage.SetStorageAsHidden( m_Storage );
469  ShowPagesCounter( false );
470  }
471  */
472  }
473 
474  //------------------------------------------------------------------------------------------------
475  // ! Hides / unhides the storage container
476  void ToggleShow()
477  {
478  Show( !m_bShown );
479  }
480 
481 
482  //------------------------------------------------------------------------------------------------
483  // !
484  SCR_InventorySlotUI GetFocusedSlot() { return m_pFocusedSlot; }
485 
486  //------------------------------------------------------------------------------------------------
487  // !
488  SCR_InventorySlotUI GetLastFocusedSlot() { return m_pLastFocusedSlot; }
489 
490  //------------------------------------------------------------------------------------------------
491  // ! returns the grid widget of the storage
492  Widget GetStorageGrid() { return m_wGrid; }
493  //------------------------------------------------------------------------------------------------
494  // ! returns the root widget
495  Widget GetRootWidget() { return m_widget; }
496 
497  //------------------------------------------------------------------------------------------------
498  // ! returns the inventory menu handler
499  SCR_InventoryMenuUI GetInventoryMenuHandler() { return m_MenuHandler; }
500 
501  //------------------------------------------------------------------------------------------------
502  SCR_InventoryStorageManagerComponent GetInventoryManager() { return m_InventoryManager; }
503 
504  //------------------------------------------------------------------------------------------------
505  // ! set the slot id of the storage the content will be shown from
506  protected void SetSlotAreaType( LoadoutAreaType eSlotType ) { m_eSlotAreaType = eSlotType; }
507 
508  //------------------------------------------------------------------------------------------------
509  // !
510  LoadoutAreaType GetSlotAreaType() { return m_eSlotAreaType; }
511 
512  //------------------------------------------------------------------------------------------------
513  // !
514  void GetUISlots( out array<SCR_InventorySlotUI> outArray)
515  {
516  outArray.Copy( m_aSlots );
517  }
518 
519  //------------------------------------------------------------------------------------------------
520  // !
521  array<SCR_InventorySlotUI> GetUISlots()
522  {
523  return m_aSlots;
524  }
525 
526  //------------------------------------------------------------------------------------------------
527  // !
528  void RemoveSlotUI( SCR_InventorySlotUI pSlot )
529  {
530  m_aSlots.RemoveItem( pSlot );
531  SortSlots();
532  }
533 
534  //------------------------------------------------------------------------------------------------
535  void RefreshSlot(int index);
536 
537  //------------------------------------------------------------------------------------------------
538  // ! creates empty slot - just visual of the matrix layout
539  protected Widget CreateEmptySlotUI( int iRow, int iCol )
540  {
541  Widget pWidget = m_workspaceWidget.CreateWidgets( SLOT_LAYOUT_1x1_EMPTY, m_wGrid );
542  GridSlot.SetColumn( pWidget, iCol );
543  GridSlot.SetRow( pWidget, iRow );
544  //SizeLayoutSlot.SetHorizontalAlign( pWidget, LayoutHorizontalAlign.Center );
545 
546  return pWidget;
547  }
548 
549  //------------------------------------------------------------------------------------------------
550  // ! creates the slot
551  protected SCR_InventorySlotUI CreateSlotUI( InventoryItemComponent pComponent, SCR_ItemAttributeCollection pAttributes = null )
552  {
553  if ( !pComponent )
554  {
555  return new SCR_InventorySlotUI( null, this, false, -1, pAttributes );
556  }
557  else if ( WeaponAttachmentsStorageComponent.Cast( pComponent ) )
558  {
559  return SCR_InventorySlotWeaponUI( pComponent, this, false ); //creates the slot
560  }
561  else if (SCR_ResourceComponent.FindResourceComponent(pComponent.GetOwner()))
562  {
563  return SCR_SupplyInventorySlotUI(pComponent, this, false); //creates the slot
564  }
565  else if ( BaseInventoryStorageComponent.Cast( pComponent ) )
566  {
567  return SCR_InventorySlotStorageEmbeddedUI( pComponent, this, false ); //creates the slot
568  }
569  else if (pComponent.GetOwner().FindComponent(SCR_ArsenalInventoryStorageManagerComponent))
570  {
571  SCR_ArsenalInventorySlotUI slotUI = SCR_ArsenalInventorySlotUI(pComponent, this, false, -1, null);
572  BaseInventoryStorageComponent inventoryStorageComponent = GetCurrentNavigationStorage();
573 
574  if (inventoryStorageComponent)
575  {
576  slotUI.SetArsenalResourceComponent(SCR_ResourceComponent.FindResourceComponent(inventoryStorageComponent.GetOwner()));
577  SCR_InventoryStorageBaseUI.ARSENAL_SLOT_STORAGES.Insert(slotUI, inventoryStorageComponent.GetOwner());
578  }
579 
580  return slotUI;
581  }
582  else
583  {
584  return new SCR_InventorySlotUI( pComponent, this, false ); //creates the slot
585  }
586  }
587 
588  //------------------------------------------------------------------------------------------------
589  // !
590  protected void DeleteSlots()
591  {
592  foreach ( SCR_InventorySlotUI pSlot: m_aSlots )
593  {
594  if( pSlot )
595  {
596  pSlot.Destroy();
597  }
598 
599  }
600  m_aSlots.Clear();
601  }
602 
603  //------------------------------------------------------------------------------------------------
604  // !
605  private bool ValidateNavigationQueue()
606  {
607  int traverseSize = m_aTraverseStorage.Count();
608 
609  if (traverseSize > 0)
610  {
611  BaseInventoryStorageComponent lastStorage = null;
612  ref array<IEntity> rootItems = new array<IEntity>();
613  GetAllItems(rootItems);
614 
615  for (int i = 0; i < traverseSize; i++)
616  {
617  BaseInventoryStorageComponent current = m_aTraverseStorage[i];
618 
619  if (!current)
620  break;
621  bool found = false;
622  for (int j = 0; j < rootItems.Count(); j++)
623  {
624  if (!rootItems[j])
625  continue;
626 
627  auto storage = BaseInventoryStorageComponent.Cast(
628  rootItems[j].FindComponent(BaseInventoryStorageComponent)
629  );
630  if (!storage)
631  continue;
632  BaseInventoryStorageComponent parentStorage;
633  if ( current.GetParentSlot() )
634  parentStorage = current.GetParentSlot().GetStorage();
635 
636  found = storage == current || parentStorage == storage;
637  if (found)
638  break;
639  }
640 
641  if (!found)
642  break;
643 
644 
645  // Last storage in queue
646  if (i == traverseSize - 1)
647  {
648  lastStorage = current;
649  return true;
650  }
651 
652  rootItems.Clear();
653  current.GetAll(rootItems);
654  }
655  return false;
656  }
657  return true;
658  }
659 
660  //------------------------------------------------------------------------------------------------
661  protected void RefreshConsumer()
662  {
663  m_ResourceConsumer = m_ResourceComponent.GetConsumer(EResourceGeneratorID.VEHICLE_UNLOAD, EResourceType.SUPPLIES);
664 
665  if (!m_ResourceConsumer)
666  m_ResourceConsumer = m_ResourceComponent.GetConsumer(EResourceGeneratorID.DEFAULT_STORAGE, EResourceType.SUPPLIES);
667 
668  Refresh();
669  }
670 
671  //------------------------------------------------------------------------------------------------
672  void RefreshResources()
673  {
675  {
676  float resources, maxResources;
677  bool hasStored = false;
678 
679  //~ Display stored resources
680  if (SCR_ResourceSystemHelper.GetStoredAndMaxResources(m_ResourceComponent, resources, maxResources))
681  {
682  UpdateStoredResources(resources, maxResources);
683  hasStored = true;
684  m_wResourceStoredDisplay.SetVisible(true);
685  }
686  else
687  {
688  m_wResourceStoredDisplay.SetVisible(false);
689  }
690 
691  //~ Display available resources
692  if (m_ResourceComponent.IsResourceTypeEnabled() && SCR_ResourceSystemHelper.GetAvailableResources(m_ResourceComponent, resources))
693  {
694  UpdateAvailableResources(resources, hasStored);
695  m_wResourceAvailableDisplay.SetVisible(true);
696  }
697  else
698  {
699  m_wResourceAvailableDisplay.SetVisible(false);
700  }
701 
702  }
703  }
704 
705  //------------------------------------------------------------------------------------------------
706  // !
707  void Refresh()
708  {
709  if ( ValidateNavigationQueue() )
710  {
711  int traverseSize = m_aTraverseStorage.Count();
712  if (traverseSize > 0)
713  {
714  ClearTraverseTitles();
715  FillItemsFromStorage(m_aTraverseStorage[traverseSize - 1]);
716  }
717  else
718  {
719  // Create root layout
720  CreateSlots();
721  }
722  }
723  else
724  {
725  m_iLastShownPage = 0;
726  m_aTraverseStorage.Clear();
727  ClearTraverseTitles();
728 
729  // Create root layout
730  CreateSlots();
731  }
732  SortSlots();
733  ShowPage(m_iLastShownPage);
734 
735  if ( m_Storage )
736  {
737  UpdateVolumePercentage( GetOccupiedVolumePercentage( m_Storage ) );
738  UpdateTotalWeight( GetTotalRoundedUpWeight( m_Storage ) );
739  }
740 
741  array<IEntity> tmpAItemsInStorage = new array<IEntity>();
742  BaseInventoryStorageComponent tmpStorage = m_Storage;
743  GetAllItemsFromDepth( tmpAItemsInStorage );
744  m_Storage = tmpStorage;
745 
746  SetStorageAsHighlighted(true);
747 
748  if ( m_pSelectedSlot )
749  m_pSelectedSlot.Refresh();
750 
751  array<IEntity> itemsInStorage = {};
752  GetAllItems(itemsInStorage); // Needs a better solution. Very wasteful.
753  CheckIfAnyItemInStorageHasResources(itemsInStorage);
754  RefreshResources();
755  }
756 
757  //------------------------------------------------------------------------------------------------
758  protected void UpdateStoredResources(float totalResources, float maxResources)
759  {
760  if (!m_wResourceStoredText)
761  return;
762 
763  /*if (m_wWeightDisplay)
764  m_wWeightDisplay.SetVisible(false);
765  if (m_wCapacityDisplay)
766  m_wCapacityDisplay.SetVisible(false);*/
767 
768  m_wResourceStoredText.SetTextFormat(m_sSuppliesStoredFormat, SCR_ResourceSystemHelper.SuppliesToString(totalResources), SCR_ResourceSystemHelper.SuppliesToString(maxResources));
769  }
770 
771  //------------------------------------------------------------------------------------------------
772  protected void UpdateAvailableResources(float totalResources, bool hasStored)
773  {
774  if (!m_wResourceAvailableText)
775  return;
776 
777  /*if (m_wWeightDisplay)
778  m_wWeightDisplay.SetVisible(false);
779  if (m_wCapacityDisplay)
780  m_wCapacityDisplay.SetVisible(false);*/
781 
782  if (!hasStored)
783  m_wResourceAvailableText.SetTextFormat(m_sSuppliesAvailableFormat, SCR_ResourceSystemHelper.SuppliesToString(totalResources));
784  else
785  m_wResourceAvailableText.SetText(SCR_ResourceSystemHelper.SuppliesToString(totalResources));
786  }
787 
788  //------------------------------------------------------------------------------------------------
789  protected void UpdateContainerResources(notnull Widget targetTitle, notnull BaseInventoryStorageComponent targetStorage)
790  {
791  SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.FindResourceComponent(targetStorage.GetOwner());
792  if(!resourceComponent)
793  return;
794 
795  float totalResources, maxResources;
796 
797  Widget resourceDisplay = targetTitle.FindAnyWidget("ResourceDisplayStored");
798  TextWidget resourceText;
799 
800  if (resourceDisplay)
801  {
802  resourceText = TextWidget.Cast(resourceDisplay.FindAnyWidget("ResourceText"));
803 
804  //~ Display stored resources
805  if (resourceText && SCR_ResourceSystemHelper.GetStoredAndMaxResources(resourceComponent, totalResources, maxResources))
806  {
807  resourceText.SetTextFormat(m_sSuppliesStoredFormat, SCR_ResourceSystemHelper.SuppliesToString(totalResources), SCR_ResourceSystemHelper.SuppliesToString(maxResources));
808  resourceDisplay.SetVisible(true);
809  }
810  else
811  {
812  resourceDisplay.SetVisible(false);
813  }
814  }
815 
816  resourceDisplay = targetTitle.FindAnyWidget("ResourceDisplayAvailable");
817 
818  if (resourceDisplay)
819  {
820  resourceText = TextWidget.Cast(resourceDisplay.FindAnyWidget("ResourceText"));
821 
822  //~ Display available resources
823  if (resourceText && SCR_ResourceSystemHelper.GetAvailableResources(resourceComponent, totalResources) && resourceComponent.IsResourceTypeEnabled())
824  {
825  resourceText.SetTextFormat(m_sSuppliesAvailableFormat, SCR_ResourceSystemHelper.SuppliesToString(totalResources));
826  resourceDisplay.SetVisible(true);
827  return;
828  }
829  else
830  {
831  resourceDisplay.SetVisible(false);
832  }
833  }
834  }
835 
836  protected void UpdateOwnedSlots(notnull array<IEntity> pItemsInStorage)
837  {
838  // TODO: optimize? ( the existing slots must be deleted. The previous algorithm doesn't work any more, since the number of slots is unknown due to the aggregation-stacking of the items of the same type )
839  DeleteSlots();
840 
841  int iCompensationOffset = 0;
842 
843  for (int i = 0; i < pItemsInStorage.Count(); i++)
844  {
845  InventoryItemComponent pComponent = GetItemComponentFromEntity( pItemsInStorage[i] );
846 
847  if ( !pComponent )
848  continue;
849 
850  SCR_ItemAttributeCollection attributes = SCR_ItemAttributeCollection.Cast(pComponent.GetAttributes());
851  bool stackable = (attributes && attributes.IsStackable());
852 
853  int m = FindItem( pComponent ); //does the item already exist in the same inventory container?
854 
855  if ( m != -1 && stackable )
856  {
857  m_aSlots[ m ].IncreaseStackNumber(); //if it exists, just increase the stacked number and don't create new slot
858  iCompensationOffset++;
859  }
860  else
861  {
862  if ( i - iCompensationOffset > m_aSlots.Count()-1 ) //otherwise if the item is not identical, create a new slow
863  m_aSlots.Insert( CreateSlotUI(pComponent) );
864  else
865  m_aSlots[ i - iCompensationOffset++ ] = CreateSlotUI(pComponent);
866  }
867  }
868  }
869 
870  //------------------------------------------------------------------------------------------------
871  void UpdateSlotUI(ResourceName item)
872  {
873  int id = GetSlotIdForItem(item);
874 
875  array<IEntity> pItemsInStorage = {};
876 
877  BaseInventoryStorageComponent storage = GetCurrentNavigationStorage();
878 
879  GetAllItems(pItemsInStorage, storage);
880 
881  int count = pItemsInStorage.Count();
882  int newStackCount = 0;
884 
885  for (int i = 0; i < count; ++i)
886  {
887  if (pItemsInStorage[i].GetPrefabData().GetPrefabName() == item)
888  {
889  comp = GetItemComponentFromEntity(pItemsInStorage[i]);
890  newStackCount++;
891  }
892  }
893 
894  m_aSlots[id].UpdateInventorySlot(comp, newStackCount);
895  }
896 
897  //------------------------------------------------------------------------------------------------
898  // !
899  protected void UpdateOwnedSlots(notnull array<BaseInventoryStorageComponent> pItemsInStorage)
900  {
901  int count = pItemsInStorage.Count();
902  if (count < m_aSlots.Count())
903  {
904  for (int i = m_aSlots.Count() - count; i > 0; i--)
905  {
906  auto slotUI = m_aSlots[m_aSlots.Count() - 1];
907  if (slotUI)
908  slotUI.Destroy();
909  }
910 
911  }
912  m_aSlots.Resize(count);
913  for (int i = 0; i < count; i++)
914  {
915  if (m_aSlots[i])
916  m_aSlots[i].UpdateReferencedComponent(pItemsInStorage[i]);
917  else
918  m_aSlots[i] = CreateSlotUI(pItemsInStorage[i]);
919  }
920  }
921 
922  //------------------------------------------------------------------------------------------------
923  /*protected void FindAndSetResourceCount(Widget targetTitle, BaseInventoryStorageComponent targetStorage)
924  {
925  TextWidget resourceText = TextWidget.Cast(targetTitle.FindAnyWidget("ResourceText"));
926  if(!resourceText)
927  return;
928 
929  SCR_ResourceComponent resourceComponent = SCR_ResourceComponent.FindResourceComponent(targetStorage.GetOwner());
930  if(!resourceComponent)
931  return;
932 
933  SCR_ResourceConsumer resourceConsumer = resourceComponent.GetConsumer(EResourceGeneratorID.DEFAULT_STORAGE, EResourceType.SUPPLIES);
934 
935  if (!resourceConsumer)
936  resourceConsumer = resourceComponent.GetConsumer(EResourceGeneratorID.VEHICLE_UNLOAD, EResourceType.SUPPLIES);
937 
938  if (!resourceConsumer)
939  resourceConsumer = resourceComponent.GetConsumer(EResourceGeneratorID.DEFAULT, EResourceType.SUPPLIES);
940 
941  if (!resourceConsumer)
942  return;
943 
944  resourceText.SetText(resourceConsumer.GetAggregatedResourceValue().ToString());
945  }*/
946 
947  //------------------------------------------------------------------------------------------------
948  // ! Looks for the very same item, including attachements and its content. Actually, it uses
949  // ! the total weight to compare it. Not 100% reliable, but cheap ( instead of comparing the contents and attachements )
950  // ! TODO: generate a key/hash for the items state
951  protected int FindItem( notnull InventoryItemComponent pInvItem )
952  {
953  IEntity pEntity = pInvItem.GetOwner();
954  if ( !pEntity )
955  return -1;
956  EntityPrefabData pEntPrefabData = pEntity.GetPrefabData();
957  if ( !pEntPrefabData )
958  return -1;
959  float fWeight = pInvItem.GetTotalWeight();
960 
961  MagazineComponent pMagazine = MagazineComponent.Cast( pEntity.FindComponent( MagazineComponent ) );
962 
963  for ( int i = m_aSlots.Count() - 1; i >= 0; i-- )
964  {
965  if ( !m_aSlots[ i ] )
966  continue;
967  InventoryItemComponent pInvItemActual = m_aSlots[ i ].GetInventoryItemComponent();
968 
969  if ( fWeight != pInvItemActual.GetTotalWeight() )
970  continue;
971 
972  IEntity pEnt = pInvItemActual.GetOwner();
973  if ( pEnt && ( pEntPrefabData == pEnt.GetPrefabData() ) ) //is it the same prefab?
974  {
975  MagazineComponent pMagazineActual = MagazineComponent.Cast( pEnt.FindComponent( MagazineComponent ) );
976  if ( pMagazineActual ) //TODO: we actually don't have the ammo in magazines physically. So comparing weight won't help here. We need to count the bullets. Later to remove and use the weight.
977  if ( m_aSlots[ i ].GetAmmoCount() != pMagazine.GetAmmoCount() )
978  continue;
979  return i;
980  }
981  }
982  return -1;
983  }
984 
985  //------------------------------------------------------------------------------------------------
986  // !
987  protected int FindItemByName( string sItemName, int iActualIndex )
988  {
989  int iCount = m_aSlots.Count();
990  for ( int i = 0; i < iCount; i++ )
991  {
992  if ( !m_aSlots[ i ] )
993  continue;
994  string sName = m_aSlots[ i ].GetItemName();
995  if ( sName.Compare( sItemName, false ) == 0 )
996  return i;
997  }
998  return -1;
999  }
1000 
1001  //------------------------------------------------------------------------------------------------
1002  // !
1003  protected string GetNameFromComponent( notnull InventoryItemComponent pComponent )
1004  {
1005  ItemAttributeCollection pAttributes = pComponent.GetAttributes();
1006  if ( !pAttributes )
1007  return string.Empty;
1008  if ( !pAttributes.GetUIInfo() )
1009  return string.Empty;
1010  return pAttributes.GetUIInfo().GetName();
1011  }
1012 
1013  //------------------------------------------------------------------------------------------------
1014  // !
1015  protected int CreateSlots( )
1016  {
1017  ref array<IEntity> pItemsInStorage = new array<IEntity>();
1018  GetAllItems( pItemsInStorage );
1019  UpdateOwnedSlots(pItemsInStorage);
1020  return 0;
1021  }
1022 
1023  //------------------------------------------------------------------------------------------------
1024  // ! creates the the grid from array of UI items
1025  protected void SortSlots()
1026  {
1027  array<int> aCoordinates;
1028  int iWidgetColumnSize, iWidgetRowSize;
1029  int iPageCounter = 0;
1030 
1031  //reset all elements to 0 - free it
1032  m_iMatrix.Reset();
1033 
1034  foreach ( SCR_InventorySlotUI pSlot: m_aSlots )
1035  {
1036 
1037  if( !pSlot )
1038  continue;
1039  Widget w = pSlot.GetWidget();
1040  if( !w )
1041  continue;
1042 
1043  iWidgetColumnSize = pSlot.GetColumnSize();
1044  iWidgetRowSize = pSlot.GetRowSize();
1045 
1046  //find the 1st suitable position
1047  aCoordinates = m_iMatrix.Reserve1stFreePlace( iWidgetColumnSize, iWidgetRowSize );
1048 
1049  if( ( aCoordinates[0] != -1 ) && ( aCoordinates[1] != -1 ) )
1050  {
1051  GridSlot.SetColumn( w, aCoordinates[0] );
1052  GridSlot.SetRow( w, aCoordinates[1] );
1053  pSlot.SetPage( iPageCounter );
1054  }
1055  else
1056  {
1057  iPageCounter++;
1058  m_iMatrix.Reset();
1059  //find the 1st suitable position
1060  aCoordinates = m_iMatrix.Reserve1stFreePlace( iWidgetColumnSize, iWidgetRowSize );
1061  if( ( aCoordinates[0] == -1 ) || ( aCoordinates[1] == -1 ) )
1062  return;
1063  GridSlot.SetColumn( w, aCoordinates[0] );
1064  GridSlot.SetRow( w, aCoordinates[1] );
1065  pSlot.SetPage( iPageCounter );
1066  }
1067  GridSlot.SetColumnSpan( w, iWidgetColumnSize );
1068  GridSlot.SetRowSpan( w, iWidgetRowSize );
1069  }
1070  m_iNrOfPages = iPageCounter + 1;
1071  }
1072 
1073  //------------------------------------------------------------------------------------------------
1074  protected void FillWithEmptySlots()
1075  {
1076  array<int> aCoordinates = {};
1077 
1078  foreach ( int iIndex, SCR_InventorySlotUI pSlot: m_aSlots )
1079  {
1080  if ( pSlot )
1081  continue;
1082  ReserveAndSetSlot( iIndex );
1083  }
1084  }
1085 
1086  //------------------------------------------------------------------------------------------------
1087  // !
1088  void ReserveAndSetSlot( int iIndex, )
1089  {
1090  array<int> aCoordinates = m_iMatrix.Reserve1stFreePlace( 1, 1 );
1092  pAttrib.SetSlotType( ESlotID.SLOT_ANY );
1093  pAttrib.SetSlotSize( ESlotSize.SLOT_1x1 );
1094  SCR_InventorySlotUI pSlotNew = CreateSlotUI( null, pAttrib );
1095  m_aSlots.Set( iIndex, pSlotNew );
1096  GridSlot.SetColumn( pSlotNew.GetWidget(), aCoordinates[0] );
1097  GridSlot.SetRow( pSlotNew.GetWidget(), aCoordinates[1] );
1098  }
1099 
1100 
1101  //------------------------------------------------------------------------------------------------
1102  // !
1103  protected void ShowPage( int iPage, out int slotToFocus = -1 )
1104  {
1105  if( iPage >= m_iNrOfPages )
1106  iPage = m_iNrOfPages - 1;
1107  if( iPage < 0 )
1108  iPage = 0;
1109 
1110  foreach ( int i, SCR_InventorySlotUI pSlot: m_aSlots )
1111  {
1112  if ( pSlot )
1113  {
1114  bool visible = (pSlot.GetPage() == iPage);
1115  pSlot.SetSlotVisible(visible);
1116  if (visible && slotToFocus == -1)
1117  slotToFocus = i;
1118  }
1119  }
1120 
1121  if( m_iNrOfPages > 1 )
1122  ShowPagesCounter( true, iPage+1, m_iNrOfPages );
1123  else
1124  ShowPagesCounter( false );
1125 
1126  if ( m_wPagingSpinboxComponent )
1127  m_wPagingSpinboxComponent.SetCurrentItem( iPage, false );
1128 
1129  m_iLastShownPage = iPage;
1130  }
1131 
1132  //------------------------------------------------------------------------------------------------
1133  // ! Removes all of the existing titles and clears the array.
1134  protected void ClearTraverseTitles()
1135  {
1136  if (m_aTraverseTitle.IsEmpty())
1137  return;
1138 
1139  Widget titleLayout = m_widget.FindAnyWidget("titleLayout");
1140  if (!titleLayout)
1141  return;
1142 
1143  foreach (Widget title: m_aTraverseTitle)
1144  {
1145  titleLayout.RemoveChild(title);
1146  }
1147 
1148  m_aTraverseTitle.Clear();
1149  }
1150 
1151  //------------------------------------------------------------------------------------------------
1152  // ! Fills out the storage with items from the storage param. Also creates traverse titles if traversing.
1153  protected void FillItemsFromStorage(BaseInventoryStorageComponent storage)
1154  {
1155  ClearTraverseTitles();
1156 
1157  int count = m_aTraverseStorage.Count();
1158 
1159  array<IEntity> pItemsInStorage = new array<IEntity>();
1160  GetAllItems(pItemsInStorage, GetCurrentNavigationStorage());
1161  UpdateOwnedSlots(pItemsInStorage);
1162 
1163  BaseInventoryStorageComponent currentStorage;
1164  Widget titleLayout = m_widget.FindAnyWidget("titleLayout");;
1165  Widget title;
1166  RenderTargetWidget previewImage;
1167  ItemPreviewManagerEntity manager;
1168  ItemPreviewWidget renderPreview;
1169  IEntity previewEntity;
1170  SCR_InventoryNavigationButtonBack closeContainerButton;
1171  ButtonWidget navigationHelperWidget;
1172  SCR_EventHandlerComponent navigationHandler;
1173 
1174  for (int i = 0; i < count; ++i)
1175  {
1176  currentStorage = m_aTraverseStorage[i];
1177 
1178  if (currentStorage.GetOwner().FindComponent(SCR_ArsenalInventoryStorageManagerComponent))
1179  title = GetGame().GetWorkspace().CreateWidgets(ARSENAL_TITLE_LAYOUT, titleLayout);
1180  else if (SCR_ResourceComponent.FindResourceComponent(currentStorage.GetOwner(), true))
1181  title = GetGame().GetWorkspace().CreateWidgets(SUPPLY_TITLE_LAYOUT, titleLayout);
1182  else
1183  title = GetGame().GetWorkspace().CreateWidgets(STORAGE_TITLE_LAYOUT, titleLayout);
1184 
1185  if (!title)
1186  return;
1187 
1188  m_aTraverseTitle.Insert( title );
1189 
1190  previewImage = RenderTargetWidget.Cast(title.FindAnyWidget("itemStorage"));
1191  manager = GetInventoryMenuHandler().GetItemPreviewManager();
1192  if (manager)
1193  {
1194  renderPreview = ItemPreviewWidget.Cast(previewImage);
1195  previewEntity = null;
1196  if (renderPreview && currentStorage)
1197  manager.SetPreviewItem(renderPreview, currentStorage.GetOwner(), null, true);
1198  }
1199 
1200  FindAndSetTitleName(title, currentStorage);
1201  UpdateContainerResources(title, currentStorage);
1202 
1203  closeContainerButton = SCR_InventoryNavigationButtonBack.Cast(SCR_InventoryNavigationButtonBack.GetInputButtonComponent("ButtonTraverseBack", title));
1204  if (!closeContainerButton)
1205  return;
1206 
1207  closeContainerButton.m_OnActivated.Insert(m_MenuHandler.OnAction);
1208  closeContainerButton.SetParentStorage(this);
1209  closeContainerButton.SetStorageIndex(i);
1210  closeContainerButton.SetVisible(true);
1211 
1212  navigationHelperWidget = ButtonWidget.Cast(title.FindAnyWidget("navigationHelper"));
1213 
1214  if (!navigationHelperWidget)
1215  return;
1216 
1217  if (i == count - 1)
1218  m_wLastCloseTraverseButton = navigationHelperWidget;
1219 
1220  navigationHelperWidget.AddHandler(new SCR_EventHandlerComponent);
1221  navigationHandler = SCR_EventHandlerComponent.Cast(navigationHelperWidget.FindHandler(SCR_EventHandlerComponent));
1222 
1223  if(!navigationHandler)
1224  return;
1225 
1226  navigationHandler.GetOnClick().Insert(closeContainerButton.OnActivate);
1227  }
1228  }
1229 
1230  //------------------------------------------------------------------------------------------------
1231  protected void FindAndSetTitleName(Widget targetTitle, BaseInventoryStorageComponent targetStorage)
1232  {
1233  TextWidget titleNameWidget = TextWidget.Cast(targetTitle.FindAnyWidget("TextC"));
1234  if(!titleNameWidget)
1235  return;
1236  ItemAttributeCollection attributes = targetStorage.GetAttributes();
1237  if(!attributes)
1238  return;
1239  UIInfo uiInfo = attributes.GetUIInfo();
1240  if(!uiInfo)
1241  return;
1242  titleNameWidget.SetText(uiInfo.GetName());
1243  }
1244 
1245  //------------------------------------------------------------------------------------------------
1246  // !
1247  protected void GetAllItems( out notnull array<IEntity> pItemsInStorage, BaseInventoryStorageComponent pStorage = null )
1248  {
1249  if (pStorage)
1250  {
1251  IEntity ownerEntity = pStorage.GetOwner();
1252  SCR_ArsenalInventoryStorageManagerComponent arsenalManagerComponent = SCR_ArsenalInventoryStorageManagerComponent.Cast(ownerEntity.FindComponent(SCR_ArsenalInventoryStorageManagerComponent));
1253 
1254  if (arsenalManagerComponent)
1255  {
1256  if (!pStorage)
1257  return;
1258 
1259  ChimeraWorld chimeraWorld = GetGame().GetWorld();
1260  ItemPreviewManagerEntity itemPreviewManagerEntity = chimeraWorld.GetItemPreviewManager();
1261 
1262  SCR_ArsenalComponent arsenalComponent = SCR_ArsenalComponent.Cast(ownerEntity.FindComponent(SCR_ArsenalComponent));
1263  array<ResourceName> prefabsToSpawn = new array<ResourceName>();
1264 
1265  if (!arsenalComponent)
1266  return;
1267 
1268  arsenalComponent.GetAvailablePrefabs(prefabsToSpawn);
1269 
1270  foreach (ResourceName resourceName: prefabsToSpawn)
1271  {
1272  pItemsInStorage.Insert(itemPreviewManagerEntity.ResolvePreviewEntityForPrefab(resourceName));
1273  }
1274 
1275  return;
1276  }
1277 
1278  if (ClothNodeStorageComponent.Cast(pStorage))
1279  {
1280  array<BaseInventoryStorageComponent> pStorages = {};
1281  array<IEntity> pItems = {};
1282  pStorage.GetOwnedStorages(pStorages, 1, false);
1283 
1284  foreach (BaseInventoryStorageComponent pStor : pStorages)
1285  {
1286  if (!pStor)
1287  continue;
1288  pStor.GetAll(pItems);
1289  pItemsInStorage.Copy(pItems);
1290  }
1291  return;
1292  }
1293 
1294  pStorage.GetAll(pItemsInStorage);
1295  return;
1296  }
1297 
1298  if (m_Storage)
1299  m_Storage.GetAll(pItemsInStorage);
1300  }
1301 
1302 
1303  //------------------------------------------------------------------------------------------------
1304  // ! gets all the items only from the given depth. I.e. all items inserted in LBS pouches
1305  // ! changes the m_Storage, back it up !!!
1306  protected void GetAllItemsFromDepth( out notnull array<IEntity> pItemsInStorages, int iDepth = 3, int iDepthDefault = 0 )
1307  {
1308 
1309  if ( !m_Storage )
1310  return;
1311 
1312  if ( iDepthDefault == 0 )
1313  iDepthDefault = iDepth;
1314 
1315  #ifdef DEBUG_INVENTORY20
1316  if ( iDepthDefault == iDepth )
1317  {
1318  LocalizedString sStorageName = "";
1319  ItemAttributeCollection pAttribs = m_Storage.GetAttributes();
1320  if ( pAttribs )
1321  {
1322  UIInfo pInfo = pAttribs.GetUIInfo();
1323  if ( pInfo )
1324  sStorageName = pInfo.GetName();
1325  Print( "-----------------------------------------------" );
1326  PrintFormat( "%1 ( %2 )", sStorageName, BaseInventoryStorageComponent.Cast( m_Storage ) );
1327  }
1328  }
1329  #endif
1330 
1331  array<IEntity> aTraverseStorageTmp = new array<IEntity>();
1332  m_Storage.GetAll( aTraverseStorageTmp );
1333 
1334  IEntity pEntity;
1335 
1336  for ( int m = 0; m < aTraverseStorageTmp.Count(); m++ )
1337  {
1338  pEntity = aTraverseStorageTmp[ m ];
1339  //BaseInventoryStorageComponent tmpStorage
1340  m_Storage = BaseInventoryStorageComponent.Cast( pEntity.FindComponent( BaseInventoryStorageComponent ) );
1341  InventoryItemComponent pInventoryComponent = InventoryItemComponent.Cast( pEntity.FindComponent( InventoryItemComponent ) );
1342  if ( iDepth == 1 )
1343  pItemsInStorages.Insert( pEntity );
1344  if ( m_Storage )
1345  {
1346  #ifdef DEBUG_INVENTORY20
1347  ItemAttributeCollection pAttrs = m_Storage.GetAttributes();
1348  if ( !pAttrs )
1349  return;
1350  LocalizedString sName = pAttrs.GetUIInfo().GetName();
1351  string sTextIn = "";
1352  ConstructSlashes( sTextIn, iDepthDefault-iDepth );
1353  PrintFormat( "|%1 %2 ( %3 )", sTextIn, sName, m_Storage );
1354  #endif
1355  GetAllItemsFromDepth( pItemsInStorages, iDepth - 1, iDepthDefault );
1356  }
1357  #ifdef DEBUG_INVENTORY20
1358  else
1359  {
1360  if ( pInventoryComponent )
1361  {
1362  LocalizedString sName = "";
1363  if ( pInventoryComponent.GetAttributes() )
1364  if ( pInventoryComponent.GetAttributes().GetUIInfo() )
1365  sName = pInventoryComponent.GetAttributes().GetUIInfo().GetName();
1366  string sTextIn = "";
1367  ConstructSlashes( sTextIn, iDepthDefault-iDepth );
1368  PrintFormat( "|%1 %2 ( %3 )", sTextIn, sName, pInventoryComponent );
1369  }
1370  }
1371  #endif
1372  }
1373  }
1374 
1375  //------------------------------------------------------------------------------------------------
1376  void UpdateTotalWeight(float totalWeight, Color fontColor = Color.Gray25)
1377  {
1378  if (!m_wWeightText)
1379  return;
1380 
1381  m_wWeightText.SetTextFormat("#AR-ValueUnit_Short_Kilograms", totalWeight);
1382 
1383  if (fontColor != m_wWeightText.GetColor())
1384  m_wWeightText.SetColor(Color.FromInt(fontColor.PackToInt()));
1385  }
1386 
1387  //------------------------------------------------------------------------------------------------
1388  float GetTotalRoundedUpWeight(BaseInventoryStorageComponent storage)
1389  {
1390  if (!storage)
1391  return -1;
1392 
1393  float totalWeight = storage.GetTotalWeight();
1394 
1395  totalWeight = Math.Round(totalWeight * 100); // totalWeight * 100 here to not lose the weight precision
1396 
1397  return totalWeight / 100;
1398  }
1399 
1400  //------------------------------------------------------------------------------------------------
1401  void UpdateVolumePercentage(float percentage, Color fontColor = Color.Gray25)
1402  {
1403  if (!m_wCapacityPercentageText)
1404  return;
1405 
1406  if (fontColor != m_wCapacityPercentageText.GetColor())
1407  m_wCapacityPercentageText.SetColor(Color.FromInt(fontColor.PackToInt()));
1408 
1409  m_wCapacityPercentageText.SetText(percentage.ToString() + "%");
1410  }
1411 
1412  //------------------------------------------------------------------------------------------------
1413  protected bool CheckIfAnyItemInStorageHasResources(array<IEntity> items)
1414  {
1415  SCR_ResourceComponent resComp;
1416 
1417  foreach(SCR_ResourceComponent oldResComp: m_aResourceCompsInStorage)
1418  {
1419  if (!oldResComp)
1420  continue;
1421 
1422  SCR_ResourceConsumer oldResCont = oldResComp.GetConsumer(EResourceGeneratorID.DEFAULT_STORAGE, EResourceType.SUPPLIES);
1423 
1424  if (!oldResCont)
1425  continue;
1426 
1427  oldResComp.TEMP_GetOnInteractorReplicated().Remove(RefreshResources);
1428  }
1429 
1430  m_aResourceCompsInStorage.Clear();
1431 
1432  foreach (IEntity item: items)
1433  {
1434  if (!item)
1435  continue;
1436 
1437  resComp = SCR_ResourceComponent.FindResourceComponent(item);
1438 
1439  if (!resComp)
1440  continue;
1441 
1442  m_aResourceCompsInStorage.Insert(resComp);
1443 
1444  SCR_ResourceConsumer resCont = resComp.GetConsumer(EResourceGeneratorID.DEFAULT_STORAGE, EResourceType.SUPPLIES);
1445 
1446  if (!resCont)
1447  continue;
1448 
1449  resComp.TEMP_GetOnInteractorReplicated().Insert(RefreshResources);
1450  }
1451 
1452  if (m_aResourceCompsInStorage.IsEmpty())
1453  return false;
1454 
1455  return true;
1456  }
1457 
1458  //------------------------------------------------------------------------------------------------
1459  float GetOccupiedVolumePercentage(BaseInventoryStorageComponent storage, float occupiedSpace = 0)
1460  {
1461  if (!storage)
1462  return -1;
1463 
1464  float occupiedVolumePercantage;
1465  float capacity = GetMaxVolumeCapacity(storage);
1466 
1467  if (capacity == 0)
1468  return 0;
1469 
1470  if (occupiedSpace != 0)
1471  occupiedVolumePercantage = Math.Round(occupiedSpace / (capacity / 100));
1472  else
1473  occupiedVolumePercantage = Math.Round(GetOccupiedVolume(storage) / (capacity / 100));
1474 
1475  return occupiedVolumePercantage;
1476  }
1477 
1478  //------------------------------------------------------------------------------------------------
1479  float GetOccupiedVolume(BaseInventoryStorageComponent storage)
1480  {
1481  if (!storage)
1482  return -1;
1483 
1484  float fOccupied = 0.0;
1485  if (ClothNodeStorageComponent.Cast(storage))
1486  {
1487  array<BaseInventoryStorageComponent> pOwnedStorages = {};
1488  storage.GetOwnedStorages(pOwnedStorages, 1, false);
1489  foreach (BaseInventoryStorageComponent pSubStorage : pOwnedStorages)
1490  if (SCR_UniversalInventoryStorageComponent.Cast(pSubStorage))
1491  fOccupied += pSubStorage.GetOccupiedSpace();
1492  }
1493  else
1494  {
1495  fOccupied = storage.GetOccupiedSpace();
1496  }
1497 
1498  return fOccupied;
1499  }
1500 
1501  //------------------------------------------------------------------------------------------------
1502  float GetMaxVolumeCapacity(BaseInventoryStorageComponent storage)
1503  {
1504  if (!storage)
1505  return -1;
1506 
1507  float fMaxCapacity = 0.0;
1508  if (ClothNodeStorageComponent.Cast(storage))
1509  {
1510  array<BaseInventoryStorageComponent> pOwnedStorages = {};
1511  storage.GetOwnedStorages(pOwnedStorages, 1, false);
1512  foreach (BaseInventoryStorageComponent pSubStorage : pOwnedStorages)
1513  if (SCR_UniversalInventoryStorageComponent.Cast(pSubStorage))
1514  fMaxCapacity += pSubStorage.GetMaxVolumeCapacity();
1515  }
1516  else
1517  {
1518  fMaxCapacity = storage.GetMaxVolumeCapacity();
1519  }
1520 
1521  return fMaxCapacity;
1522  }
1523 
1524  //------------------------------------------------------------------------------------------------
1525  void SetStorageAsHighlighted(bool isVisible)
1526  {
1527  if (!m_widget)
1528  return;
1529 
1530  if (isVisible)
1531  m_widget.SetOpacity(1);
1532  else
1533  m_widget.SetOpacity(STORAGE_NON_HIGHLIGHTED_OPACITY);
1534  }
1535 
1536  //------------------------------------------------------------------------------------------------
1537  bool IsStorageHighlighted()
1538  {
1539  return (m_widget.GetOpacity() == 1);
1540  }
1541 
1542  //------------------------------------------------------------------------------------------------
1543  // ! formating helper
1544  private void ConstructSlashes( out string sText, int iSlashes )
1545  {
1546  for ( int m = 0; m <= ( iSlashes * 2 ); m++ )
1547  {
1548  sText += "-";
1549  }
1550  }
1551 
1552  //------------------------------------------------------------------------------------------------
1553  // ! creates the simple matrix of dimension [ m_iMaxRows, m_iMaxColumns ]
1554  protected void CreateEmptyLayout()
1555  {
1556  for( int iLoop = 0; iLoop < m_iMaxRows; iLoop++ )
1557  for( int jLoop = 0; jLoop < m_iMaxColumns; jLoop++ )
1558  CreateEmptySlotUI( iLoop, jLoop );
1559  }
1560 
1561 
1562  //------------------------------------------------------------------------------------------------
1563  // ! get the item inventory component
1564  InventoryItemComponent GetItemComponentFromEntity( IEntity pEntity )
1565  {
1566  if ( pEntity == null )
1567  return null;
1568  return InventoryItemComponent.Cast(pEntity.FindComponent( InventoryItemComponent ));
1569  }
1570 
1571  //------------------------------------------------------------------------------------------------
1572  // !
1573  void GetSlots( out notnull array<SCR_InventorySlotUI> outSlots )
1574  {
1575  outSlots.InsertAll( m_aSlots );
1576  }
1577 
1578  //------------------------------------------------------------------------------------------------
1579  // ! displays the info in details
1580  void ShowItemDetails( string sName, string sDescription, string sWeight );
1581 
1582  //------------------------------------------------------------------------------------------------
1583  // ! helper for showing the number of pages
1584  private void ShowPagesCounter( bool bShow = false, int iPage = 0, int iNumberOfPages = 0 )
1585  {
1586  if ( !m_wPagingSpinboxComponent )
1587  return;
1588 
1589  m_wPagingSpinboxComponent.SetVisible( bShow, false );
1590 
1591  if ( bShow )
1592  {
1593  m_wPagingSpinboxComponent.SetCanNavigate( true );
1594  m_wPagingSpinboxComponent.SetPageCount( iNumberOfPages );
1595  m_wPagingSpinboxComponent.SetCurrentItem( iPage, false );
1596  }
1597  else
1598  {
1599  m_wPagingSpinboxComponent.SetCanNavigate( true );
1600  }
1601  }
1602 
1603  //-------------------------------------- MOVE MANAGEMENT -----------------------------------------
1604 
1605  //------------------------------------------------------------------------------------------------
1607  void SetLastFocusedSlot( SCR_InventorySlotUI pSlot )
1608  {
1609  m_pLastFocusedSlot = pSlot;
1610  }
1611 
1612  //------------------------------------------------------------------------------------------------
1614  void SetSlotFocused( SCR_InventorySlotUI pSlotUI = null, bool bSelected = true )
1615  {
1616  SCR_InventoryMenuUI menuHandler = GetInventoryMenuHandler();
1617 
1618  if( bSelected )
1619  {
1620  m_pFocusedSlot = pSlotUI;
1621  /*
1622  if( menuHandler )
1623  menuHandler.SetActiveStorage( this );
1624  */
1625  }
1626  else
1627  {
1628  m_pFocusedSlot = null;
1629  /*
1630  if( menuHandler )
1631  menuHandler.SetActiveStorage( null );
1632  */
1633  }
1634  }
1635 
1636  //------------------------------------------------------------------------------------------------
1637  // ! selects the actual slot
1638  void SetSlotSelected( SCR_InventorySlotUI pSlot = null, bool bSelected = true )
1639  {
1640  m_pPrevSelectedSlot = m_pSelectedSlot;
1641 
1642  if( bSelected )
1643  {
1644  m_pSelectedSlot = pSlot;
1645  }
1646  else
1647  m_pSelectedSlot = null;
1648  }
1649 
1650  //------------------------------------------------------------------------------------------------
1651  void ShowContainerBorder( bool bShow )
1652  {
1653  if ( m_wDropContainer )
1654  m_wDropContainer.SetVisible( bShow );
1655  }
1656 
1657  //------------------------------------------------------------------------------------------------
1658  void ActivateStorageButton(bool active)
1659  {
1660  if (m_wButton)
1661  {
1662  m_wButton.SetEnabled(active);
1663  m_wButton.SetVisible(active);
1664  foreach (SCR_InventorySlotUI slot : m_aSlots)
1665  {
1666  if (slot && slot.GetButtonWidget())
1667  slot.GetButtonWidget().SetEnabled(!active);
1668  }
1669  }
1670 
1671  if (m_wLastCloseTraverseButton)
1672  m_wLastCloseTraverseButton.SetEnabled(!active);
1673  }
1674 
1675  //------------------------------------------------------------------------------------------------
1676  int GetFocusedSlotId()
1677  {
1678  if (!m_pFocusedSlot)
1679  return -1;
1680  return m_aSlots.Find(m_pFocusedSlot);
1681  }
1682 
1683  //------------------------------------------------------------------------------------------------
1684  int GetSlotIdForItem(ResourceName itemName)
1685  {
1686  int slotCount = m_aSlots.Count();
1687  SCR_InventorySlotUI slot;
1688 
1689  for (int slotId = 0; slotId < slotCount; ++slotId)
1690  {
1691  slot = m_aSlots[slotId];
1692  if (slot && slot.GetItemResource() == itemName)
1693  {
1694  return slotId;
1695  }
1696  }
1697 
1698  return 0;
1699  }
1700 
1701  //------------------------------------------------------------------------------------------------
1702  protected void SetPreviewItem()
1703  {
1704  m_wPreviewImage = RenderTargetWidget.Cast( m_widget.FindAnyWidget( "itemStorage" ) );
1705 
1706  ChimeraWorld world = ChimeraWorld.CastFrom(GetGame().GetWorld());
1707  if (!world)
1708  return;
1709 
1710  ItemPreviewManagerEntity manager = world.GetItemPreviewManager();
1711  if (!manager)
1712  return;
1713 
1714  ItemPreviewWidget renderPreview = ItemPreviewWidget.Cast( m_wPreviewImage );
1715  if (!renderPreview)
1716  return;
1717 
1718  IEntity previewEntity = null;
1719  if (m_Storage)
1720  previewEntity = m_Storage.GetOwner();
1721 
1722  manager.SetPreviewItem(renderPreview, previewEntity, null, true);
1723  }
1724 
1725  //------------------------------------------------------------------------ COMMON METHODS ----------------------------------------------------------------------
1726 
1727  //------------------------------------------------------------------------------------------------
1728  void DimSlots( bool bDim )
1729  {
1730  foreach ( SCR_InventorySlotUI pSlot : m_aSlots )
1731  {
1732  if ( pSlot )
1733  {
1734  if ( !pSlot.IsSlotSelected() )
1735  {
1736  pSlot.SetEnabledForMove( !bDim );
1737  }
1738  }
1739  }
1740  }
1741  //------------------------------------------------------------------------------------------------
1742  override void HandlerAttached( Widget w )
1743  {
1744  if( !w )
1745  return;
1746 
1747  m_wDropContainer = PanelWidget.Cast( w.FindAnyWidget( "DropContainer" ) );
1748  m_wButton = ButtonWidget.Cast(w.FindAnyWidget("Button"));
1749  if (m_wButton)
1750  {
1752  if (btn)
1753  {
1754  btn.SetParent(this);
1755  }
1756  else
1757  {
1759  newBtn.SetParent(this);
1760  m_wButton.AddHandler(newBtn);
1761  }
1762 
1763  m_wButton.SetOpacity(0.1);
1764  }
1765 
1766  m_widget = w;
1767  Init();
1768  }
1769 
1770  //------------------------------------------------------------------------------------------------
1771  override event void HandlerDeattached(Widget w)
1772  {
1773  if (m_ResourceComponent)
1774  m_ResourceComponent.TEMP_GetOnInteractorReplicated().Remove(RefreshConsumer);
1775 
1777  }
1778 
1779  //------------------------------------------------------------------------------------------------
1780  Widget GetButtonWidget()
1781  {
1782  return m_wButton;
1783  }
1784 
1785  //------------------------------------------------------------------------------------------------
1786  ButtonWidget GetLastCloseTraverseButton()
1787  {
1788  return m_wLastCloseTraverseButton;
1789  }
1790 
1791  //------------------------------------------------------------------------------------------------
1793  BaseInventoryStorageComponent storage,
1794  LoadoutAreaType slotID = null,
1795  SCR_InventoryMenuUI menuManager = null,
1796  int iPage = 0,
1797  array<BaseInventoryStorageComponent> aTraverseStorage = null)
1798  {
1799  m_Storage = storage;
1800  m_MenuHandler = menuManager;
1801  m_eSlotAreaType = slotID;
1802  m_iMaxRows = 3;
1803  m_iMaxColumns = 4;
1804  m_iMatrix = new SCR_Matrix( m_iMaxColumns, m_iMaxRows );
1805  m_iPageSize = m_iMaxRows * m_iMaxColumns;
1806  m_iLastShownPage = iPage;
1807  if ( aTraverseStorage )
1808  m_aTraverseStorage.Copy( aTraverseStorage );
1809  }
1810 
1811  //------------------------------------------------------------------------------------------------
1813  {
1814  if( m_aSlots )
1815  delete m_aSlots;
1816  if( m_iMatrix )
1817  delete m_iMatrix;
1818  }
1819 };
1820 
1821 //------------------------------------------------------------------------------------------------
1822 class SCR_InventoryStorageButton : ScriptedWidgetComponent
1823 {
1824  protected SCR_InventoryStorageBaseUI m_Parent;
1825 
1826  //------------------------------------------------------------------------------------------------
1827  override bool OnFocus(Widget w, int x, int y)
1828  {
1829  m_Parent.GetInventoryMenuHandler().OnContainerFocused(m_Parent);
1830  return false;
1831  }
1832 
1833  //------------------------------------------------------------------------------------------------
1834  override bool OnFocusLost(Widget w, int x, int y)
1835  {
1836  m_Parent.GetInventoryMenuHandler().OnContainerFocusLeft(m_Parent);
1837  return false;
1838  }
1839 
1840  //------------------------------------------------------------------------------------------------
1841  void SetParent(SCR_InventoryStorageBaseUI parent)
1842  {
1843  m_Parent = parent;
1844  }
1845 };
m_bShown
protected bool m_bShown
Definition: SCR_InfoDisplay.c:61
SCR_SupplyInventorySlotUI
Definition: SCR_SupplyInventorySlotUI.c:2
ChimeraWorld
Definition: ChimeraWorld.c:12
m_ResourceConsumer
protected SCR_ResourceConsumer m_ResourceConsumer
Definition: SCR_BaseSupportStationComponent.c:114
SCR_InventoryStorageWeaponsUI
Definition: SCR_InventoryStorageWeaponsUI.c:4
GetPrefabData
SCR_VehicleDamageManagerComponentClass GetPrefabData()
Definition: SCR_VehicleDamageManagerComponent.c:260
SCR_InventoryStorageLootUI
Definition: SCR_InventoryStorageLootUI.c:4
SCR_ResourceSystemHelper
Definition: SCR_ResourceSystemHelper.c:1
ESlotID
ESlotID
Definition: InventoryConstants.c:14
GetAmmoCount
proto external int GetAmmoCount()
Returns the remaining ammo.
ItemAttributeCollection
Definition: ItemAttributeCollection.c:12
SCR_SpinBoxPagingComponent
Definition: SCR_SpinBoxPaging.c:2
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
UIInfo
UIInfo - declare object, allows to define UI elements.
Definition: UIInfo.c:13
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
SCR_UniversalInventoryStorageComponent
void SCR_UniversalInventoryStorageComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_UniversalInventoryStorageComponent.c:259
SCR_ArsenalInventorySlotUI
Definition: SCR_ArsenalInventorySlotUI.c:2
SCR_InventorySlotWeaponUI
Definition: SCR_InventorySlotWeaponUI.c:6
m_InventoryManager
SCR_InventoryStorageManagerComponent m_InventoryManager
Definition: SCR_AttachementAction.c:15
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
SCR_InventoryStorageButton
Definition: SCR_InventoryStorageBaseUI.c:1822
SCR_InventoryStorageBaseUI
Definition: SCR_InventoryStorageBaseUI.c:6
m_ResourceSubscriptionHandleConsumer
protected SCR_ResourceSystemSubscriptionHandleBase m_ResourceSubscriptionHandleConsumer
Definition: SCR_BaseSupportStationComponent.c:125
m_Player
protected ChimeraCharacter m_Player
Definition: SCR_CampaignTutorialComponentArland.c:40
SCR_InventoryNavigationButtonBack
Interactive non-focus button showing hint, and triggering actions.
Definition: SCR_InventoryNavigationButtonBack.c:4
SCR_EventHandlerComponent
Definition: SCR_EventHandlerComponent.c:5
ESlotSize
ESlotSize
Definition: InventoryConstants.c:1
SCR_InventorySlotStorageEmbeddedUI
Definition: SCR_InventorySlotStorageEmbeddedUI.c:5
EResourceType
EResourceType
Definition: SCR_ResourceContainer.c:1
m_aSlots
protected ref array< SCR_WeaponRackSlotEntity > m_aSlots
Definition: SCR_ArsenalDisplayComponent.c:13
m_ResourceComponent
protected SCR_ResourceComponent m_ResourceComponent
Definition: SCR_CampaignBuildingProviderComponent.c:51
SCR_InventoryMenuUI
Definition: SCR_InventoryMenuUI.c:247
InventoryItemComponent
Definition: InventoryItemComponent.c:12
SCR_ItemAttributeCollection
Definition: SCR_ItemAttributeCollection.c:2
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_Matrix
Definition: SCR_Matrix.c:2
m_bSelected
protected bool m_bSelected
Definition: SCR_InventoryHitZonePointUI.c:396
ItemPreviewWidget
Definition: ItemPreviewWidget.c:12
m_bEnabled
private bool m_bEnabled
Definition: SCR_BaseManualCameraComponent.c:3
SCR_ResourcePlayerControllerInventoryComponent
Definition: SCR_ResourcePlayerControllerInventoryComponent.c:20
LoadoutAreaType
Definition: LoadoutAreaType.c:12
m_MenuHandler
SCR_DeployMenuBase m_MenuHandler
Main deploy menu with the map present.
SCR_ResourceSystemSubscriptionHandleBase
Definition: SCR_ResourceSystemSubscriptionHandleBase.c:1
SCR_ArsenalComponent
Definition: SCR_ArsenalComponent.c:9
LocalizedString
Definition: LocalizedString.c:21
SCR_InventorySlotUI
Definition: SCR_InventorySlotUI.c:27
m_Storage
BaseInventoryStorageComponent m_Storage
Definition: SCR_TourniquetStorageComponent.c:10
m_wButton
protected ButtonWidget m_wButton
Definition: SCR_InventoryHitZonePointUI.c:393
EResourceGeneratorID
EResourceGeneratorID
Definition: SCR_ResourceGenerator.c:1