Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AnalyticsInventory.c
Go to the documentation of this file.
2{
3 protected ref SCR_InventoryData m_Inventory = new SCR_InventoryData();
4 protected ref SCR_AnalyticsDelayedSend m_DelayedSend = new SCR_AnalyticsDelayedSend();
5 protected ref array<float> m_aOpenWeights = {};
6 protected ref array<float> m_aCloseWeights = {};
7
8 //------------------------------------------------------------------------------------------------
11 void OpenInventory(float currentWeight)
12 {
13 m_DelayedSend.Start();
14
15 if (!m_DelayedSend.IsAdditive())
16 {
17 m_Inventory = new SCR_InventoryData();
18 m_aOpenWeights.Clear();
19 m_aCloseWeights.Clear();
20 }
21
22 m_aOpenWeights.Insert(currentWeight);
23 }
24
25 //------------------------------------------------------------------------------------------------
28 void CloseInventory(float currentWeight)
29 {
30 m_DelayedSend.Stop();
31
32 if (m_DelayedSend.IsAdditive())
33 m_Inventory.amt_inv_time_spent += m_DelayedSend.GetTimeSpent();
34 else
35 m_Inventory.amt_inv_time_spent = m_DelayedSend.GetTimeSpent();
36
37 m_aCloseWeights.Insert(currentWeight);
38 }
39
40 //------------------------------------------------------------------------------------------------
44 void Update(float deltaSeconds)
45 {
46 m_DelayedSend.Update(deltaSeconds);
47 }
48
49 //------------------------------------------------------------------------------------------------
53 {
54 return m_DelayedSend.IsReadyToSend();
55 }
56
57 //------------------------------------------------------------------------------------------------
60 {
61 m_DelayedSend.ResetReadyToSend();
62 }
63
64 //------------------------------------------------------------------------------------------------
68 {
69 switch (itemSlotType)
70 {
71 case SCR_EAnalyticalItemSlotType.HORIZONTAL:
72 m_Inventory.cnt_inv_interactions_horizontal += 1;
73 break;
74
75 case SCR_EAnalyticalItemSlotType.VERTICAL:
76 m_Inventory.cnt_inv_interactions_vertical += 1;
77 break;
78
79 case SCR_EAnalyticalItemSlotType.CHARACTER_STORAGE:
80 m_Inventory.cnt_inv_interactions_character_storage += 1;
81 break;
82
83 case SCR_EAnalyticalItemSlotType.VICINITY:
84 m_Inventory.cnt_inv_interactions_vicinity += 1;
85 break;
86
88 // we don't track other types
89 break;
90 }
91 }
92
93 //------------------------------------------------------------------------------------------------
96 {
97 m_Inventory.cnt_inv_healing += 1;
98 }
99
100 //------------------------------------------------------------------------------------------------
103 {
104 m_Inventory.cnt_inv_examination += 1;
105 }
106
107 //------------------------------------------------------------------------------------------------
109 SCR_InventoryData GetClonedData()
110 {
111 SCR_InventoryData data = SCR_InventoryData.Cast(m_Inventory.Clone());
112 data.array_inv_weight_on_open = ArrayToString(m_aOpenWeights);
113 data.array_inv_weight_on_close = ArrayToString(m_aCloseWeights);
114 return data;
115 }
116
117 //------------------------------------------------------------------------------------------------
119 protected string ArrayToString(array<float> arr)
120 {
121 string result = "[";
122 bool firstElement = true;
123 foreach (float val : arr)
124 {
125 if (firstElement)
126 result += val.ToString(lenDec: 3);
127 else
128 result += "," + val.ToString(lenDec: 3);
129
130 firstElement = false;
131 }
132 return result + "]";
133 }
134}
SCR_EAnalyticalItemSlotType
Get all prefabs that have the spawner data
ref SCR_InventoryData m_Inventory
SCR_InventoryData GetClonedData()
void ResetReadyToSend()
We have sended the data, so we reset.
void CloseInventory(float currentWeight)
string ArrayToString(array< float > arr)
void InteractWithItem(SCR_EAnalyticalItemSlotType itemSlotType)
ref array< float > m_aOpenWeights
void UseHealing()
We used healing (bandages) through the inventory. Save it for analytics.
void UseExamination()
We used examination through the inventory. Save it for analytics.
ref array< float > m_aCloseWeights
void OpenInventory(float currentWeight)
void Update(float deltaSeconds)
ref SCR_AnalyticsDelayedSend m_DelayedSend