Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_InventoryStorageWeaponsUI.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
5 {
6  protected ref array<InventoryItemComponent> m_pInventoryItemsComponent = new array<InventoryItemComponent>();
7  private array<IEntity> m_pItems;
8 // protected string sGridPath = "centerFrame.gridFrame.size.grid";
9 
10 
11 
12  //------------------------------------------------------------------------ USER METHODS ------------------------------------------------------------------------
13 
14  //------------------------------------------------------------------------------------------------
15  override void Init()
16  {
17  super.Init();
18  if ( m_InventoryStorage )
19  m_Storage = m_InventoryStorage.GetWeaponStorage();
20 
21  m_wStorageName.SetText( "#AR-Editor_TooltipDetail_Weapons_Name" );
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  // ! creates the slot
26  protected SCR_InventorySlotUI CreateWeaponSlotUI( InventoryItemComponent pStorageComponent )
27  {
28  return new SCR_InventorySlotWeaponUI( pStorageComponent, this );
29  }
30 
31  //------------------------------------------------------------------------------------------------
32  // !
33  override int CreateSlots( )
34  {
35  if ( !m_aSlots.IsEmpty() )
36  DeleteSlots();
37  array<IEntity> pItemsInStorage = new array<IEntity>();
38  m_Storage.GetAll(pItemsInStorage);
39 
40  if( !pItemsInStorage )
41  return -1;
42 
43  foreach ( IEntity pItem: pItemsInStorage )
44  {
45  InventoryItemComponent pComponent = GetItemComponentFromEntity( pItem );
46  if( pComponent )
47  m_aSlots.Insert( CreateWeaponSlotUI( pComponent ) );
48  }
49  return m_aSlots.Count()-1;
50  }
51  //------------------------------------------------------------------------ COMMON METHODS ----------------------------------------------------------------------
52 
53  //------------------------------------------------------------------------------------------------
54  override void HandlerAttached( Widget w )
55  {
56  super.HandlerAttached( w );
57 
58  CreateEmptyLayout();
59  CreateSlots();
60  SortSlots();
61  }
62 
63 
64  //------------------------------------------------------------------------------------------------
65  void SCR_InventoryStorageWeaponsUI( BaseInventoryStorageComponent storage, LoadoutAreaType slotID = null, SCR_InventoryMenuUI menuManager = null, int iPage = 0,array<BaseInventoryStorageComponent> aTraverseStorage = null )
66  {
67  //TODO: make consistent the visibility of variable ( SetSlotID vs m_iMaxRows )
68  SetSlotAreaType( slotID );
69  m_iMaxRows = 3;
70  m_iMaxColumns = 4;
71  m_iMatrix = new SCR_Matrix( m_iMaxColumns, m_iMaxRows );
72  m_sGridPath = "GridLayout0";
73  m_Storage = storage;
74  }
75 
76  //------------------------------------------------------------------------------------------------
78  {
79  }
80 };
SCR_InventoryStorageWeaponsUI
Definition: SCR_InventoryStorageWeaponsUI.c:4
SCR_InventorySlotWeaponUI
Definition: SCR_InventorySlotWeaponUI.c:6
SCR_InventoryStorageBaseUI
Definition: SCR_InventoryStorageBaseUI.c:6
m_aSlots
protected ref array< SCR_WeaponRackSlotEntity > m_aSlots
Definition: SCR_ArsenalDisplayComponent.c:13
SCR_InventoryMenuUI
Definition: SCR_InventoryMenuUI.c:247
InventoryItemComponent
Definition: InventoryItemComponent.c:12
SCR_Matrix
Definition: SCR_Matrix.c:2
LoadoutAreaType
Definition: LoadoutAreaType.c:12
SCR_InventorySlotUI
Definition: SCR_InventorySlotUI.c:27
m_Storage
BaseInventoryStorageComponent m_Storage
Definition: SCR_TourniquetStorageComponent.c:10