Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
LoadingScreen.c
Go to the documentation of this file.
1 //#define DEBUG_LOADING_SCREENS
2 
3 class ArmaReforgerLoadingAnim: BaseLoadingAnim
4 {
5  const string LOADING_SCREEN_LAYOUT = "{4C8B29889444BDA3}UI/layouts/Menus/LoadingScreen/ScenarioLoadingScreen.layout";
6 
7  static protected bool s_bOpened;
8  static ref ScriptInvoker s_OnEnterLoadingScreen = new ScriptInvoker();
9  static ref ScriptInvoker m_onExitLoadingScreen = new ScriptInvoker();
10 
11  private ref SCR_LoadingScreenComponent m_LayoutComponent;
12 
13  //------------------------------------------------------------------------------------------------
14  void ArmaReforgerLoadingAnim(WorkspaceWidget workspaceWidget)
15  {
16  GetGame().m_OnMissionSetInvoker.Insert(OnMissionSet);
17  }
18 
19  //------------------------------------------------------------------------------------------------
20  override void Load()
21  {
22  #ifdef DEBUG_LOADING_SCREENS
23  PrintFormat(">> %1 >> Load", this);
24  #endif
25 
26  m_wRoot = m_WorkspaceWidget.CreateWidgets(LOADING_SCREEN_LAYOUT, m_WorkspaceWidget);
27 
28  m_LayoutComponent = new SCR_LoadingScreenComponent();
29  m_wRoot.AddHandler(m_LayoutComponent);
30 
31  SplashScreen.s_iSplashShown++;
32  }
33 
34  //------------------------------------------------------------------------------------------------
35  override void Update(float timeSlice, float progress, float minDurationRatio)
36  {
37  #ifdef DEBUG_SPLASH_SCREENS
38  //PrintFormat(">> %1 >> Update | timeSlice: %2 | progress: %3 | minDurationRatio: %4", this, timeSlice, progress, minDurationRatio);
39  #endif
40 
41  if (!m_wRoot)
42  return;
43 
44  m_LayoutComponent.Update(timeSlice, progress, minDurationRatio);
45  }
46 
47  //------------------------------------------------------------------------------------------------
48  override void Show()
49  {
50  #ifdef DEBUG_LOADING_SCREENS
51  PrintFormat(">> %1 >> Show", this);
52  #endif
53 
54  super.Show();
55 
56  s_bOpened = true;
57 
58  EnableSounds(false);
59 
60  WidgetManager.SetCursor(12); // Hide cursor
61 
62  s_OnEnterLoadingScreen.Invoke();
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  override void Hide()
67  {
68  #ifdef DEBUG_LOADING_SCREENS
69  PrintFormat(">> %1 >> Hide", this);
70  #endif
71 
72  s_bOpened = false;
73 
74  EnableSounds(true);
75 
76  m_onExitLoadingScreen.Invoke();
77 
78  if (m_LayoutComponent)
79  m_LayoutComponent.OnHide();
80 
81  WidgetManager.SetCursor(0); // Show cursor
82 
83  super.Hide();
84  }
85 
86  //------------------------------------------------------------------------------------------------
87  void EnableSounds(bool enable)
88  {
89  AudioSystem.SetMasterVolume(AudioSystem.SFX, enable);
90  AudioSystem.SetMasterVolume(AudioSystem.VoiceChat, enable);
91  AudioSystem.SetMasterVolume(AudioSystem.Dialog, enable);
92  AudioSystem.SetMasterVolume(AudioSystem.Music, enable);
93  AudioSystem.SetMasterVolume(AudioSystem.UI, enable);
94  }
95 
96  //------------------------------------------------------------------------------------------------
97  static bool IsOpen()
98  {
99  return s_bOpened;
100  }
101 
102  //------------------------------------------------------------------------------------------------
103  void OnMissionSet(SCR_MissionHeader header)
104  {
105  if (m_LayoutComponent)
106  m_LayoutComponent.OnMissionDataRetrieved(header);
107  }
108 
109  //------------------------------------------------------------------------------------------------
110  void SetJoiningCrossPlay(bool isCrossPlay)
111  {
112  #ifdef DEBUG_LOADING_SCREENS
113  PrintFormat(">> SetJoiningCrossPlay | isCrossPlay: %1", isCrossPlay);
114  #endif
115 
116  if (m_LayoutComponent)
117  m_LayoutComponent.SetJoiningCrossPlay(isCrossPlay);
118  }
119 
120  //------------------------------------------------------------------------------------------------
121  void SetLoadingModded(bool isModded)
122  {
123  #ifdef DEBUG_LOADING_SCREENS
124  PrintFormat(">> SetLoadingModded | isModded: %1", isModded);
125  #endif
126 
127  if (m_LayoutComponent)
128  m_LayoutComponent.SetLoadingModded(isModded);
129  }
130 }
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_LoadingScreenComponent
Definition: SCR_LoadingScreenComponent.c:1
SCR_MissionHeader
Definition: SCR_MissionHeader.c:1
ArmaReforgerLoadingAnim
Definition: LoadingScreen.c:3