Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AnalyticsSettings.c
Go to the documentation of this file.
2{
3 protected static const string UNCHANGED = "Unchanged";
5 protected ref map<string /*category*/, ref set<string> /*changes*/> m_ChangedSettings = new map<string, ref set<string>>();
6 protected bool m_WasResetAllKeysUsed = false;
7 protected string m_QualityPreset = UNCHANGED;
8 protected string m_HudVisibility = UNCHANGED;
9
10 //------------------------------------------------------------------------------------------------
12 void Start()
13 {
14 m_Timer.Start();
15 m_ChangedSettings.Clear();
19 }
20
21 //------------------------------------------------------------------------------------------------
25 {
26 array<string> options = {"HUD_Visiblity_Hide_all", "HUD_Visiblity_Show_all", "HUD_Visiblity_Custom"};
27
28 if (options.IsIndexValid(index))
29 m_HudVisibility = options[index];
30 else
31 m_HudVisibility = "HUD_Visiblity_" + index.ToString();
32 }
33
34 //------------------------------------------------------------------------------------------------
38 {
39 array<string> options = {"QualityPreset_Low", "QualityPreset_Medium", "QualityPreset_High", "QualityPreset_Ultra", "QualityPreset_Custom"};
40
41 if (options.IsIndexValid(index))
42 m_QualityPreset = options[index];
43 else
44 m_QualityPreset = "QualityPreset_" + index.ToString();
45 }
46
47 //------------------------------------------------------------------------------------------------
50 {
52 }
53
54 //------------------------------------------------------------------------------------------------
58 void ChangeSetting(string category, string action)
59 {
60 if (!m_ChangedSettings.Contains(category))
61 m_ChangedSettings.Insert(category, new set<string>());
62
63 m_ChangedSettings.Get(category).Insert(action);
64 }
65
66 //------------------------------------------------------------------------------------------------
69 {
70 return m_Timer.GetTimeSpent();
71 }
72
73 //------------------------------------------------------------------------------------------------
76 {
77 string result = "{";
78
79 foreach (string category, set<string> changes : m_ChangedSettings)
80 result += string.Format("'%1': %2,", category, SerializeChanges(changes));
81
82 int resetAll = m_WasResetAllKeysUsed;
83 result += string.Format("'ResetAll':%1,'QualityPreset':'%2','HudVisibility':'%3'}", resetAll, m_QualityPreset, m_HudVisibility);
84
85 return result;
86 }
87
88 //------------------------------------------------------------------------------------------------
89 protected string SerializeChanges(set<string> changes)
90 {
91 string result = "{";
92
93 bool firstElement = true;
94 foreach (string change : changes)
95 {
96 if (firstElement)
97 result += string.Format("'%1'", change);
98 else
99 result += string.Format(",'%1'", change);
100
101 firstElement = false;
102 }
103
104 return result + "}";
105 }
106}
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void UseResetAllButton()
Use a reset all button for keybinds.
static const string UNCHANGED
void ChangeSetting(string category, string action)
ref SCR_AnalyticsTimer m_Timer
string SerializeChanges(set< string > changes)
void Start()
Start tracking changed settings. This CLEARS all previous data.
ref map< string, ref set< string > > m_ChangedSettings
Definition Types.c:486