Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_IntroSplashScreenComponent.c
Go to the documentation of this file.
2{
3 protected Widget m_wRoot;
4
7
8 protected static const float FADEIN_TIME = 2;
9
10 //------------------------------------------------------------------------------------------------
11 override protected void HandlerAttached(Widget w)
12 {
13 m_wRoot = w;
14
16 m_Widgets.Init(m_wRoot);
17
18 m_wRoot.SetZOrder(1001);
19
20 // Get spinner component
21 if (m_Widgets.m_wSpinner)
22 {
23 Widget compWidget = m_Widgets.m_wSpinner.FindAnyWidget("Spinner");
24
25 if (compWidget)
26 m_SpinnerComp = SCR_LoadingSpinner.Cast(compWidget.FindHandler(SCR_LoadingSpinner));
27 }
28
30 }
31
32 //------------------------------------------------------------------------------------------------
33 protected void InitWidgets()
34 {
35 // Disable widgets
36 m_Widgets.m_wDust1.SetVisible(false);
37 m_Widgets.m_wDust2.SetVisible(false);
38 m_Widgets.m_wWarning.SetVisible(false);
39 m_Widgets.m_wExperimentalBuild.SetVisible(false);
40 m_Widgets.m_wArtExperimental.SetVisible(false);
41
42 // Prepare widgets for fade-in
43 m_Widgets.m_wBILogo.SetOpacity(0);
44 m_Widgets.m_wEnfusionLogo.SetOpacity(0);
45 m_Widgets.m_wDisclaimer.SetOpacity(0);
46 m_Widgets.m_wSpinner.SetOpacity(0);
47
48 // Show widgets
49 m_Widgets.m_wArt.SetOpacity(1);
50 }
51
52 //------------------------------------------------------------------------------------------------
55 void Update(float timeSlice)
56 {
57 Fade(m_Widgets.m_wBILogo, true, FADEIN_TIME, timeSlice);
58 Fade(m_Widgets.m_wEnfusionLogo, true, FADEIN_TIME, timeSlice);
59 Fade(m_Widgets.m_wDisclaimer, true, FADEIN_TIME, timeSlice);
60 Fade(m_Widgets.m_wSpinner, true, FADEIN_TIME, timeSlice);
61
62 // Rotate spinner
63 if (m_SpinnerComp)
64 m_SpinnerComp.Update(timeSlice);
65 }
66
67 //------------------------------------------------------------------------------------------------
68 protected void Fade(Widget w, bool show, float length, float timeslice)
69 {
70 if (length <= 0)
71 {
72 w.SetOpacity(show);
73 return;
74 }
75
76 float opacityCurrent = w.GetOpacity();
77
78 if (opacityCurrent == show)
79 return;
80
81 float progressDelta = timeslice / length;
82
83 if (!show)
84 progressDelta = -progressDelta;
85
86 float progress = opacityCurrent + progressDelta;
87
88 progress = Math.Clamp(progress, 0, 1);
89
90 float opacity = Math.Lerp(0, 1, progress);
91 w.SetOpacity(opacity);
92 w.SetVisible(true);
93 }
94}
Definition Math.c:13
ref SCR_IntroSplashScreenWidgets m_Widgets
void Fade(Widget w, bool show, float length, float timeslice)