Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_InventoryOpenedStorageArsenalUI.c
Go to the documentation of this file.
2{
3 //------------------------------------------------------------------------------------------------
4 override protected void GetAllItems(out notnull array<IEntity> pItemsInStorage, BaseInventoryStorageComponent pStorage = null)
5 {
6 if (pStorage)
7 {
8 super.GetAllItems(pItemsInStorage, pStorage);
9
10 return;
11 }
12
13 ChimeraWorld chimeraWorld = GetGame().GetWorld();
14 ItemPreviewManagerEntity itemPreviewManagerEntity = chimeraWorld.GetItemPreviewManager();
15
16 SCR_ArsenalComponent arsenalComponent = SCR_ArsenalComponent.Cast(m_Storage.GetOwner().FindComponent(SCR_ArsenalComponent));
17 array<ResourceName> prefabsToSpawn = new array<ResourceName>();
18
19 if (!arsenalComponent)
20 return;
21
22 arsenalComponent.GetAvailablePrefabs(prefabsToSpawn);
23
24 foreach (ResourceName resourceName: prefabsToSpawn)
25 {
26 pItemsInStorage.Insert(itemPreviewManagerEntity.ResolvePreviewEntityForPrefab(resourceName));
27 }
28
29 }
30
31 //------------------------------------------------------------------------------------------------
32 override void RefreshResources()
33 {
35 return;
36
38 {
39 m_wResourceAvailableDisplay.SetVisible(false);
40 return;
41 }
42
43
44 float availableResources;
45
46 if (!m_ResourceComponent || !m_ResourceComponent.IsResourceTypeEnabled() || !SCR_ResourceSystemHelper.GetAvailableResources(m_ResourceComponent, availableResources))
47 {
48 m_wResourceAvailableDisplay.SetVisible(false);
49 return;
50 }
51
52 m_wResourceAvailableText.SetTextFormat("#AR-Supplies_Arsenal_Availability", SCR_ResourceSystemHelper.SuppliesToString(availableResources));
53
54 m_wResourceAvailableDisplay.SetVisible(true);
55
56 if (!m_wResourceAvailableDisplay.IsVisible())
57 m_wResourceAvailableDisplay.SetVisible(false);
58 }
59
60 //------------------------------------------------------------------------------------------------
61 override void Init()
62 {
63 super.Init();
64
65 m_wWeightDisplay.SetVisible(false);
66 m_wProgressBar.SetVisible(false);
67
68 m_wWeightText = null;
69 m_wWeightDisplay = null;
70 m_wCapacityDisplay = null;
72
73 m_wResourceStoredDisplay = m_widget.FindAnyWidget("ResourceDisplayStored");
75 m_wResourceStoredText = TextWidget.Cast(m_wResourceStoredDisplay.FindAnyWidget("ResourceText"));
76
77 m_wResourceAvailableDisplay = m_widget.FindAnyWidget("ResourceDisplayAvailable");
79 m_wResourceAvailableText = TextWidget.Cast(m_wResourceAvailableDisplay.FindAnyWidget("ResourceText"));
80
82 return;
83
84 if (m_Storage && m_Storage.GetOwner())
85 m_ResourceComponent = SCR_ResourceComponent.FindResourceComponent(m_Storage.GetOwner());
86
88 {
89 m_wResourceAvailableDisplay.SetVisible(false);
90 return;
91 }
92
94 m_ResourceComponent.TEMP_GetOnInteractorReplicated().Insert(RefreshResources);
95
97 m_wResourceStoredDisplay.SetVisible(false);
98 }
99
100 //------------------------------------------------------------------------------------------------
101 override protected SCR_InventorySlotUI CreateSlotUI( InventoryItemComponent pComponent, SCR_ItemAttributeCollection pAttributes = null )
102 {
103 if (!pComponent)
104 {
105 return new SCR_InventorySlotUI(null, this, false, -1, pAttributes);
106 }
107 else
108 {
109 SCR_ArsenalInventorySlotUI slotUI = new SCR_ArsenalInventorySlotUI(pComponent, this, false, -1, null); //creates the slot
110
112 SCR_InventoryStorageBaseUI.ARSENAL_SLOT_STORAGES.Insert(slotUI, GetCurrentNavigationStorage().GetOwner());
113
114 return slotUI;
115 }
116 }
117
118 //------------------------------------------------------------------------------------------------
119 override void Refresh()
120 {
121 super.Refresh();
122
124 }
125};
ArmaReforgerScripted GetGame()
Definition game.c:1398
ResourceName resourceName
Definition SCR_AIGroup.c:66
EResourceGeneratorID
bool GetAvailablePrefabs(out notnull array< ResourceName > availablePrefabs)
void SetArsenalResourceComponent(SCR_ResourceComponent component)
SCR_InventorySlotUI CreateSlotUI(InventoryItemComponent pComponent, SCR_ItemAttributeCollection pAttributes=null)
void GetAllItems(out notnull array< IEntity > pItemsInStorage, BaseInventoryStorageComponent pStorage=null)
void SCR_InventoryOpenedStorageUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null, int cols=6, int rows=3, bool fromVicinity=false)
SCR_ResourceComponent m_ResourceComponent
void SCR_InventoryStorageBaseUI(BaseInventoryStorageComponent storage, LoadoutAreaType slotID=null, SCR_InventoryMenuUI menuManager=null, int iPage=0, array< BaseInventoryStorageComponent > aTraverseStorage=null)
BaseInventoryStorageComponent m_Storage
IEntity GetOwner()
Owner entity of the fuel tank.