Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SaveLoadEntryComponent.c
Go to the documentation of this file.
1void ScriptInvokerButtonMethod(SCR_InputButtonComponent button, string actionName);
3typedef ScriptInvokerBase<ScriptInvokerButtonMethod> ScriptInvokerButton;
4
6{
8
12
13 protected bool m_bCanSave;
14 protected bool m_bCanLoad;
15 protected bool m_bCanDelete;
16
17 protected string m_sFileName;
18 protected string m_sDisplayName;
19
20 protected SaveGame m_Save;
21
22 protected bool m_bHasIssue;
23 protected bool m_bIsFocused;
24 protected bool m_bIsDownloaded;
25
26 //------------------------------------------------------------------------------------------------
27 protected void OnInputDeviceChange(EInputDeviceType oldDevice, EInputDeviceType newDevice)
28 {
29 if (newDevice != EInputDeviceType.MOUSE && m_bIsFocused)
30 UpdateAllWidgets(true);
31 }
32
33 //------------------------------------------------------------------------------------------------
34 override bool OnFocus(Widget w, int x, int y)
35 {
36 bool result = super.OnFocus(w, x, y);
37
38 UpdateAllWidgets(true);
39
40 return result;
41 }
42
43 //------------------------------------------------------------------------------------------------
44 override bool OnFocusLost(Widget w, int x, int y)
45 {
46 bool result = super.OnFocusLost(w, x, y);
47
48 UpdateAllWidgets(false);
49
50 return result;
51 }
52
53 //------------------------------------------------------------------------------------------------
55 protected void UpdateAllWidgets(bool visibility)
56 {
57 m_bIsFocused = visibility;
58
59 if (visibility)
60 visibility = GetGame().GetInputManager().GetLastUsedInputDevice() == EInputDeviceType.MOUSE;
61
62 m_Widgets.m_SaveButtonComponent0.SetVisible(visibility && m_bCanSave);
63 m_Widgets.m_LoadButtonComponent0.SetVisible(visibility && m_bCanLoad);
64 m_Widgets.m_DeleteButtonComponent0.SetVisible(visibility && m_bCanDelete);
65 }
66
67 //------------------------------------------------------------------------------------------------
68 protected void OnClickSave()
69 {
70 if (m_OnSave)
71 m_OnSave.Invoke(null, "");
72 }
73
74 //------------------------------------------------------------------------------------------------
75 protected void OnClickLoad()
76 {
77 if (m_OnLoad)
78 m_OnLoad.Invoke(null, "");
79 }
80
81 //------------------------------------------------------------------------------------------------
82 protected void OnClickDelete()
83 {
84 if (m_OnDelete)
85 m_OnDelete.Invoke(null, "");
86 }
87
88 //------------------------------------------------------------------------------------------------
89 // --- Setters ---
90 //------------------------------------------------------------------------------------------------
91
92 //------------------------------------------------------------------------------------------------
93 void SetCanSave(bool state)
94 {
95 m_bCanSave = state;
96 }
97
98 //------------------------------------------------------------------------------------------------
99 void SetCanLoad(bool state)
100 {
101 m_bCanLoad = state;
102 }
103
104 //------------------------------------------------------------------------------------------------
105 void SetCanDelete(bool state)
106 {
107 m_bCanDelete = state;
108 }
109
110 //------------------------------------------------------------------------------------------------
111 void SetScenarioDataVisible(bool state)
112 {
113 //m_Widgets.m_wScenarioInfoList.SetVisibile(state);
114 }
115
116 //------------------------------------------------------------------------------------------------
117 void SetScenarioName(string name)
118 {
119 //m_Widgets.m_wScenarioName.SetText(name);
120 }
121
122 //------------------------------------------------------------------------------------------------
123 void SetScenarioIcon(Color imageColor, string icon)
124 {
125 //m_Widgets.m_wScenarioImage.LoadImageTexture(0, icon);
126 //m_Widgets.m_wScenarioImage.SetColor(imageColor);
127 }
128
129 //------------------------------------------------------------------------------------------------
130 void SetDateTime(string date, string time)
131 {
132 m_Widgets.m_wPreviewDate.SetText(date);
133 m_Widgets.m_wPreviewTime.SetText(time);
134 }
135
136 //------------------------------------------------------------------------------------------------
137 void SetVersion(string version, bool isVersionCompatible)
138 {
139 m_Widgets.m_wEntryVersion.SetText(version);
140
141 if (!isVersionCompatible)
142 m_Widgets.m_wEntryVersion.SetColor(UIColors.WARNING);
143 }
144
145 //------------------------------------------------------------------------------------------------
147 {
148 m_bHasIssue = true;
149 m_Widgets.m_wSaveImage.SetColor(UIColors.WARNING);
150 }
151
152 //------------------------------------------------------------------------------------------------
153 void SetIsDownloaded(bool state)
154 {
155 m_bIsDownloaded = state;
156 }
157
158 //------------------------------------------------------------------------------------------------
159 void SetSaveData(SaveGame saveData)
160 {
161 m_Save = saveData;
162 }
163
164 //------------------------------------------------------------------------------------------------
165 void SetSaveIcon(Color imageColor, string icon)
166 {
167 m_Widgets.m_wSaveImage.LoadImageFromSet(0, UIConstants.ICONS_IMAGE_SET, icon);
168 m_Widgets.m_wSaveImage.SetColor(imageColor);
169 }
170
171 //------------------------------------------------------------------------------------------------
172 void SetFileName(string name)
173 {
174 m_sFileName = name;
175 }
176
177 //------------------------------------------------------------------------------------------------
178 void SetDisplayName(string name)
179 {
180 m_sDisplayName = name;
181 m_Widgets.m_wEntryName.SetText(name);
182 }
183
184 //------------------------------------------------------------------------------------------------
185 // --- Getters ---
186 //------------------------------------------------------------------------------------------------
187
188 //------------------------------------------------------------------------------------------------
190 {
191 return m_bCanSave;
192 }
193
194 //------------------------------------------------------------------------------------------------
196 {
197 return m_bCanLoad;
198 }
199
200 //------------------------------------------------------------------------------------------------
202 {
203 return m_bCanDelete;
204 }
205
206 //------------------------------------------------------------------------------------------------
207 bool IsError()
208 {
209 return m_bHasIssue;
210 }
211
212 //------------------------------------------------------------------------------------------------
214 {
215 return m_bIsDownloaded;
216 }
217
218 //------------------------------------------------------------------------------------------------
220 {
221 return m_Save;
222 }
223
224 //------------------------------------------------------------------------------------------------
225 string GetFileName()
226 {
227 return m_sFileName;
228 }
229
230 //------------------------------------------------------------------------------------------------
232 {
233 return m_sDisplayName;
234 }
235
236 //------------------------------------------------------------------------------------------------
238 {
239 return m_Widgets.m_wSaveImage;
240 }
241
242 //------------------------------------------------------------------------------------------------
243 // --- Invokers ---
244 //------------------------------------------------------------------------------------------------
245
246 //------------------------------------------------------------------------------------------------
248 {
249 if (!m_OnDelete)
251
252 return m_OnDelete;
253 }
254
255 // --- Invokers ---
256 //------------------------------------------------------------------------------------------------
258 {
259 if (!m_OnLoad)
261
262 return m_OnLoad;
263 }
264
265 //------------------------------------------------------------------------------------------------
267 {
268 if (!m_OnSave)
270
271 return m_OnSave;
272 }
273
274 //------------------------------------------------------------------------------------------------
275 override void HandlerAttached(Widget w)
276 {
278 return;
279
280 m_Widgets.Init(w);
281
282 m_Widgets.m_SaveButtonComponent0.SetVisible(false);
283 m_Widgets.m_LoadButtonComponent0.SetVisible(false);
284 m_Widgets.m_DeleteButtonComponent0.SetVisible(false);
285
286 m_Widgets.m_SaveButtonComponent0.m_OnClicked.Insert(OnClickSave);
287 m_Widgets.m_LoadButtonComponent0.m_OnClicked.Insert(OnClickLoad);
288 m_Widgets.m_DeleteButtonComponent0.m_OnClicked.Insert(OnClickDelete);
289
290 GetGame().OnInputDeviceUserChangedInvoker().Insert(OnInputDeviceChange);
291
292 UpdateAllWidgets(false);
293
294 super.HandlerAttached(w);
295 }
296}
ArmaReforgerScripted GetGame()
Definition game.c:1398
func ScriptInvokerButtonMethod
ScriptInvokerBase< ScriptInvokerButtonMethod > ScriptInvokerButton
Definition Color.c:13
static bool IsEditMode()
Definition Functions.c:1566
bool m_bCanDelete
void SetIsDownloaded(bool state)
bool IsError()
void SetCanLoad(bool state)
void SetSaveData(SaveGame saveData)
void SetIsWarning()
bool m_bCanSave
bool CanDeleteSave()
ScriptInvokerButton GetOnDeleteSave()
override void HandlerAttached(Widget w)
void SetCanDelete(bool state)
bool m_bIsFocused
void SetDisplayName(string name)
SaveGame m_Save
bool IsDownloaded()
void SetScenarioName(string name)
void OnClickDelete()
ref ScriptInvokerButton m_OnLoad
ref ScriptInvokerButton m_OnDelete
ScriptInvokerButton GetOnOverrideSave()
ScriptInvokerButton GetOnLoadSave()
void SetSaveIcon(Color imageColor, string icon)
bool m_bIsDownloaded
ImageWidget GetSaveIcon()
void OnClickSave()
string m_sFileName
bool m_bHasIssue
string m_sDisplayName
void UpdateAllWidgets(bool visibility)
Update visual state of line.
string GetDisplayName()
void SetVersion(string version, bool isVersionCompatible)
override bool OnFocusLost(Widget w, int x, int y)
bool CanOverrideSave()
ref SCR_Save_EntryWidgets m_Widgets
void OnInputDeviceChange(EInputDeviceType oldDevice, EInputDeviceType newDevice)
ref ScriptInvokerButton m_OnSave
void SetCanSave(bool state)
void SetDateTime(string date, string time)
void SetScenarioDataVisible(bool state)
override bool OnFocus(Widget w, int x, int y)
void SetScenarioIcon(Color imageColor, string icon)
bool m_bCanLoad
void OnClickLoad()
string GetFileName()
SaveGame GetSaveData()
void SetFileName(string name)
bool CanLoadSave()