Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_GameOverScreenUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute("TabView", desc: "Tab view will only be used if the widget in the layout is visible. This is because some changes that no longer required the tabview")]
4 protected string m_sTabViewName;
5
6 [Attribute("Base_ContentHolder")]
7 protected string m_sContentHolderName;
8
9 [Attribute("Base_Background")]
10 protected string m_sBackgroundName;
11
12 [Attribute("Base_ColorOverlay")]
14
15 [Attribute(UIConstants.BUTTON_BACK)]
16 protected string m_sBackButtonName;
17
18 [Attribute("ChatButton")]
19 protected string m_sChatButtonName;
20
21 [Attribute("Debriefing")]
22 protected string m_sDebriefingButtonName;
23
24 [Attribute("ButtonHolder")]
25 protected string m_sButtonHolderName;
26
27 [Attribute("RestartTimerHolder")]
28 protected string m_sRestartTimerHolderName;
29
30 [Attribute("0.05")]
32
33 [Attribute("2")]
34 protected float m_fContentFadeInSpeed;
35
36 [Attribute("0", desc: "Which tab will show the end screen content eg: Victory, Defeat, etc.")]
37 protected float m_iContentTabIndex;
38
39 [Attribute("NextScenarioButton")]
40 protected string m_sNextScenarioButtonName;
41
42 protected Widget m_wRoot;
53
54 //~ On tab changed
55 protected void OnTabChanged(SCR_TabViewComponent tabView, Widget w, int tabIndex)
56 {
58 }
59
60 //~ On Tab created
61 protected void OnTabCreated(SCR_TabViewComponent tabView, Widget w, int index)
62 {
63 if (!w)
64 return;
65
67 if (baseGameOverTab)
68 baseGameOverTab.GameOverTabInit(m_EndScreenUIContentInfo);
69 }
70
71 //~ When tabview fade is done
72 protected void OnTabViewFadeDone()
73 {
75 m_TabViewComponent.EnableAllTabs(true);
76 }
77
78 //~ Show end screen content eg: Victory, defeat, etc.
79 protected void OnEndScreenContentShow(bool show)
80 {
82 m_wEndscreenContent.SetVisible(show);
83 }
84
90 {
91 //~ Already has end screen
93 return;
94
95 m_EndScreenUIContentInfo = endScreenUIContent;
96
97 Widget contentHolder = m_wRoot.FindAnyWidget(m_sContentHolderName);
98 if (!contentHolder)
99 return;
100
101 //Spawn gameover layout content
102 if (!endScreenUIContent.m_sGameOverLayout.IsEmpty())
103 {
104 m_wEndscreenContent = GetGame().GetWorkspace().CreateWidgets(endScreenUIContent.m_sGameOverLayout, contentHolder);
105
107 {
109
110 if (gameOverWidgetContent)
111 gameOverWidgetContent.InitContent(endScreenUIContent);
112 }
113 }
114
115 if (endScreenUIContent.m_cVignetteColor)
116 {
117 ImageWidget colorOverlay = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sBackgroundColorOverlayName));
118 if (colorOverlay)
119 colorOverlay.SetColor(endScreenUIContent.m_cVignetteColor);
120 }
121
123 m_ContentFadeComponent.FadeIn();
124
126 m_TabViewFadeComponent.FadeIn();
127
130
133
136
137 Widget returnToMenuBtn = m_wRoot.FindAnyWidget(m_sBackButtonName);
138 if (returnToMenuBtn)
139 {
140 SCR_InputButtonComponent returnToMenuButton = SCR_InputButtonComponent.Cast(returnToMenuBtn.FindHandler(SCR_InputButtonComponent));
141 if (returnToMenuButton)
142 returnToMenuButton.m_OnActivated.Insert(ReturnToMenu);
143 }
144
145 Widget nextScenarioBtn = m_wRoot.FindAnyWidget(m_sNextScenarioButtonName);
146 if (nextScenarioBtn)
147 {
148 SCR_MissionHeaderSequence sequenceHeader = SCR_MissionHeaderSequence.Cast(GetGame().GetMissionHeader());
149
150 if (sequenceHeader)
151 {
152 if (sequenceHeader.m_sNextScenario.IsEmpty() || endScreenUIContent.m_GameOverInfo.GetInfoId() != EGameOverTypes.VICTORY)
153 {
154 nextScenarioBtn.SetEnabled(false);
155 }
156 else
157 {
158 sequenceHeader.UpdateProgress();
159 SCR_InputButtonComponent nextScenarioButtontn = SCR_InputButtonComponent.Cast(nextScenarioBtn.FindHandler(SCR_InputButtonComponent));
160 if (nextScenarioButtontn)
161 nextScenarioButtontn.m_OnActivated.Insert(NextScenario);
162 }
163 }
164 else
165 {
166 nextScenarioBtn.SetVisible(false);
167 }
168 }
169
170 Widget debriefingWidgetButton = m_wRoot.FindAnyWidget(m_sDebriefingButtonName);
171 if (debriefingWidgetButton)
172 {
173 BaseGameMode gameMode = GetGame().GetGameMode();
174 if (!gameMode)
175 {
176 debriefingWidgetButton.SetVisible(false);
177 }
178 else
179 {
180 SCR_DebriefingScreenComponent debriefingScreen = SCR_DebriefingScreenComponent.Cast(gameMode.FindComponent(SCR_DebriefingScreenComponent));
181 if (debriefingScreen)
182 {
183 SCR_InputButtonComponent debriefingButton = SCR_InputButtonComponent.Cast(debriefingWidgetButton.FindHandler(SCR_InputButtonComponent));
184 if (debriefingButton)
185 debriefingButton.m_OnActivated.Insert(OpenDebriefingScreenMenu);
186 }
187 else
188 {
189 debriefingWidgetButton.SetVisible(false);
190 }
191 }
192 }
193 }
194
195 //------------------------------------------------------------------------------------------------
197 {
198 GetGame().GetMenuManager().OpenMenu(ChimeraMenuPreset.DebriefingScreenMenu);
199
200 // Stop the timer to prevent it from running twice
202 m_RestartTimerComponent.StopTimer();
203 }
204
205 //------------------------------------------------------------------------------------------------
207 {
208 SCR_ConfigurableDialogUi dlg = SCR_CommonDialogs.CreateDialog("scenario_exit");
209 if (!dlg)
210 return;
211
213 }
214
215 //-----------------------------------------------------------------------------------------------
217 {
218 OnGameEnd();
219 UnpauseTime();
220 GameStateTransitions.RequestGameplayEndTransition();
221 }
222
223 //-----------------------------------------------------------------------------------------------
224 protected void UnpauseTime()
225 {
226 ChimeraWorld world = GetGame().GetWorld();
227
228 if (!world || !world.IsGameTimePaused())
229 return;
230
231 world.PauseGameTime(false);
232 }
233
234 //~ Removes itself from hierargy on game end just in cause
235 protected void OnGameEnd()
236 {
237 m_wRoot.RemoveFromHierarchy();
238 }
239
240 override void HandlerAttached(Widget w)
241 {
242 if (SCR_Global.IsEditMode())
243 return;
244
245 m_wRoot = w;
246
247 ImageWidget colorOverlay = ImageWidget.Cast(m_wRoot.FindAnyWidget(m_sBackgroundColorOverlayName));
248 if (colorOverlay)
249 {
250 colorOverlay.SetOpacity(m_fBackgroundColorOverlayOpacity);
252
254 {
256 colorOverlay.SetVisible(false);
257 }
258 }
259
260 Widget contentHolder = w.FindAnyWidget(m_sContentHolderName);
261 if (contentHolder)
262 {
263 m_ContentFadeComponent = SCR_FadeUIComponent.Cast(contentHolder.FindHandler(SCR_FadeUIComponent));
264
266 {
268 contentHolder.SetVisible(false);
269 }
270 }
271
272 Widget buttonHolder = w.FindAnyWidget(m_sButtonHolderName);
273 if (buttonHolder)
274 {
277 {
279 buttonHolder.SetVisible(false);
280 }
281 }
282
285 {
287
289 {
292 {
294 m_wRestartTimerHolder.SetVisible(false);
295 }
296 }
297 }
298
300 if (gameMode)
301 gameMode.GetOnGameEnd().Insert(OnGameEnd);
302
303 Widget tabView = w.FindAnyWidget(m_sTabViewName);
304
305 //~ Only use tabview if it is visible in the layout
306 if (tabView && tabView.IsVisible())
307 {
310
312 {
314 tabView.SetVisible(false);
315 m_TabViewFadeComponent.GetOnFadeDone().Insert(OnTabViewFadeDone);
316 }
317 }
318
320 {
322 m_TabViewComponent.EnableAllTabs(false);
323
324 m_TabViewComponent.GetOnChanged().Insert(OnTabChanged);
325 m_TabViewComponent.GetOnContentCreate().Insert(OnTabCreated);
326 }
327 }
328
329 override void HandlerDeattached(Widget w)
330 {
332 if (gameMode)
333 gameMode.GetOnGameEnd().Remove(OnGameEnd);
334
336 m_RestartTimerComponent.StopTimer();
337 }
338
339 //------------------------------------------------------------------------------------------------
341 {
342 SCR_MissionHeaderSequence sequenceHeader = SCR_MissionHeaderSequence.Cast(GetGame().GetMissionHeader());
343
344 if (!sequenceHeader || sequenceHeader.m_sNextScenario.IsEmpty())
345 return;
346
347 string addonGUIDs;
348
349 array<string> addons = {};
350 GameProject.GetLoadedAddons(addons);
351
352 foreach (string GUID: addons)
353 {
354 if (!GameProject.IsVanillaAddon(GUID))
355 {
356 if (!addonGUIDs.IsEmpty())
357 addonGUIDs += ",";
358
359 addonGUIDs += GUID;
360 }
361 }
362
363 GameStateTransitions.RequestScenarioChangeTransition(sequenceHeader.m_sNextScenario, ResourceName.Empty, addonGUIDs);
364 }
365}
ChimeraMenuPreset
Menu presets.
EGameOverTypes
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_BaseGameMode GetGameMode()
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ScriptInvoker GetOnGameEnd()
void InitContent(SCR_GameOverScreenUIContentData endScreenUIContent)
ref SCR_GameOverScreenUIContentData m_EndScreenUIContentInfo
SCR_FadeUIComponent m_OverlayBackgroundColorFadeUIComponent
void OnTabChanged(SCR_TabViewComponent tabView, Widget w, int tabIndex)
void OnTabCreated(SCR_TabViewComponent tabView, Widget w, int index)
SCR_ServerRestartTimerUIComponent m_RestartTimerComponent
void InitGameOverScreen(SCR_GameOverScreenUIContentData endScreenUIContent)
static bool IsEditMode()
Definition Functions.c:1566
SCR_FieldOfViewSettings Attribute