Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_IntroSplashScreen2Component.c
Go to the documentation of this file.
1 //#define DEBUG_WARNING_SCREEN
2 
3 class SCR_IntroSplashScreen2Component : SCR_IntroSplashScreenComponent
4 {
5  ref ScriptInvoker m_OnFinished = new ScriptInvoker();
6 
7  const float TRANSITION_TIME = 0.5;
8 
9  const float FADEIN_TIME_DUST = 10;
10  const float FADEIN_TIME_ART = 4;
11  const float FADEIN_TIME_INFO = 0.5;
12 
13  //---------------------------------------------------------------------------------------------
14  override protected void HandlerAttached(Widget w)
15  {
16  super.HandlerAttached(w);
17 
18  WidgetManager.SetCursor(12); // Hide cursor
19 
20  if (m_Widgets.m_wPressKeyMsg)
21  m_Widgets.m_wPressKeyMsg.SetTextFormat("#AR-SplashScreen_Continue", "<color rgba='226, 167, 79, 255'><action name='CloseSplashScreen' index=0/></color>");
22 
23  // Animate: Dust
24  if (m_Widgets.m_wDust1 && m_Widgets.m_wDust2)
25  {
26  float dust1pos[2] = {15000, 0};
27  float dust2pos[2] = {35000, 0};
28 
29  AnimateWidget.Opacity(m_Widgets.m_wDust1, 0.35, 1 / FADEIN_TIME_DUST);
30  AnimateWidget.Opacity(m_Widgets.m_wDust2, 0.35, 1 / FADEIN_TIME_DUST);
31  AnimateWidget.Position(m_Widgets.m_wDust1, dust1pos, 0.0005);
32  AnimateWidget.Position(m_Widgets.m_wDust2, dust2pos, 0.0005);
33  }
34 
35  // Animate: Warning widgets
36  if (m_Widgets.m_wWarning)
37  {
38  AnimateWidget.Opacity(m_Widgets.m_wWarning, 1, 1 / FADEIN_TIME_INFO);
39  }
40 
41  // Create and animate-in build version layout
42  Widget buildVersion = GetGame().GetWorkspace().CreateWidgets("{B7A765172F0BD4D9}UI/layouts/Common/GameVersionWatermark.layout", w);
43 
44  if (buildVersion)
45  {
46  buildVersion.SetOpacity(0);
47  AnimateWidget.Opacity(buildVersion, 0.2, 1 / FADEIN_TIME_ART);
48  }
49 
50 
51  // Show experimental build desclaimer
52  bool isExperimentalBuild = GetGame().IsExperimentalBuild();
53 
54  #ifdef DEBUG_WARNING_SCREEN
55  isExperimentalBuild = true;
56  #endif
57 
58  m_Widgets.m_wExperimentalBuild.SetOpacity(isExperimentalBuild);
59 
60  if (isExperimentalBuild && m_Widgets.m_wArtExperimental)
61  {
62  //m_Widgets.m_wArtExperimental.SetOpacity(0);
63  AnimateWidget.Opacity(m_Widgets.m_wArtExperimental, 1, 1 / FADEIN_TIME_ART);
64  }
65 
66  ActivateContext();
67  GetGame().GetInputManager().AddActionListener("CloseSplashScreen", EActionTrigger.DOWN, OnInput);
68  }
69 
70  //---------------------------------------------------------------------------------------------
71  override protected void InitWidgets()
72  {
73  // Disable widgets
74  m_Widgets.m_wSpinner.SetVisible(false);
75 
76  // Prepare widgets for fade-in
77  m_Widgets.m_wDust1.SetOpacity(0);
78  m_Widgets.m_wDust2.SetOpacity(0);
79  m_Widgets.m_wWarning.SetOpacity(0);
80  m_Widgets.m_wArtExperimental.SetOpacity(0);
81 
82  // Show widgets
83  m_Widgets.m_wArt.SetOpacity(1);
84  m_Widgets.m_wBILogo.SetOpacity(1);
85  m_Widgets.m_wEnfusionLogo.SetOpacity(1);
86  m_Widgets.m_wDisclaimer.SetOpacity(1);
87  }
88 
89  //---------------------------------------------------------------------------------------------
90  void ActivateContext()
91  {
92  GetGame().GetInputManager().ActivateContext("BetaWarningContext", 1);
93  GetGame().GetCallqueue().CallLater(ActivateContext, 0);
94  }
95 
96  //---------------------------------------------------------------------------------------------
97  void OnInput()
98  {
99  WidgetManager.SetCursor(0); // Show cursor
100 
101  SCR_UISoundEntity.SoundEvent(SCR_SoundEvent.CLICK);
102  m_Widgets.m_wPressKeyMsg.SetVisible(false);
103 
104  m_Widgets.m_wBlackOverlay.SetOpacity(0);
105  m_Widgets.m_wBlackOverlay.SetVisible(true);
106  AnimateWidget.Opacity(m_Widgets.m_wBlackOverlay, 1, 1 / TRANSITION_TIME);
107 
108  GetGame().GetCallqueue().CallLater(OnFadedOut, TRANSITION_TIME * 1000 * 1.1);
109  GetGame().GetInputManager().RemoveActionListener("CloseSplashScreen", EActionTrigger.DOWN, OnInput);
110  }
111 
112  //---------------------------------------------------------------------------------------------
113  void OnFadedOut()
114  {
115  m_Widgets.m_wContent.SetVisible(false);
116  m_Widgets.m_wBackground.SetVisible(false);
117 
118  AnimateWidget.Opacity(m_Widgets.m_wBlackOverlay, 0, 1 / TRANSITION_TIME);
119 
120  m_OnFinished.Invoke();
121 
122  GetGame().GetCallqueue().CallLater(Close, TRANSITION_TIME * 1000 * 1.1);
123  }
124 
125  //---------------------------------------------------------------------------------------------
126  void Close()
127  {
128  GetGame().GetCallqueue().Remove(ActivateContext);
129  m_wRoot.RemoveFromHierarchy();
130  }
131 };
SCR_IntroSplashScreen2Component
Definition: SCR_IntroSplashScreen2Component.c:3
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_UISoundEntity
Definition: SCR_UISoundEntity.c:7
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_SoundEvent
Definition: SCR_SoundEvent.c:1
m_Widgets
ref SCR_VoNOverlay_ElementWidgets m_Widgets
Definition: SCR_VonDisplay.c:3