Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LoadingOverlayDialog.c
Go to the documentation of this file.
1 
6 {
7  // Called immediately when CloseAnimated is called.
8  ref ScriptInvoker m_OnCloseStarted = new ScriptInvoker();
9 
10  // Called when the close animation has finished. Called from OnMenuClose.
11  ref ScriptInvoker m_OnCloseFinished = new ScriptInvoker();
12 
13  protected SCR_LoadingOverlay m_LoadingOverlay;
14 
15  //-------------------------------------------------------------------------------------------------------
16  // P U B L I C
17  //-------------------------------------------------------------------------------------------------------
18 
19 
20  //-------------------------------------------------------------------------------------------------------
21  static SCR_LoadingOverlayDialog Create(string text = string.Empty)
22  {
23  MenuBase menuBase = GetGame().GetMenuManager().OpenDialog(ChimeraMenuPreset.LoadingOverlay);
24  SCR_LoadingOverlayDialog loadingOverlay = SCR_LoadingOverlayDialog.Cast(menuBase);
25  loadingOverlay.Init(text);
26  return loadingOverlay;
27  }
28 
29 
30  //-------------------------------------------------------------------------------------------------------
31  void CloseAnimated(bool invokeOnCloseStarted = true)
32  {
33  if (invokeOnCloseStarted)
34  m_OnCloseStarted.Invoke();
35 
36  // Play fade-out animation
37  AnimateWidget.Opacity(GetRootWidget(), 0, UIConstants.FADE_RATE_FAST);
38  GetGame().GetCallqueue().CallLater(Close, 1000.0 / UIConstants.FADE_RATE_FAST);
39  }
40 
41 
42 
43 
44  //-------------------------------------------------------------------------------------------------------
45  // P R O T E C T E D
46  //-------------------------------------------------------------------------------------------------------
47 
48 
49  //-------------------------------------------------------------------------------------------------------
50  override void OnMenuOpen()
51  {
52  super.OnMenuOpen();
53 
54  Widget w = GetRootWidget().FindWidget("m_LoadingOverlay");
56 
57  GetGame().GetInputManager().AddActionListener("MenuBack", EActionTrigger.DOWN, Callback_OnBackButton);
58 
59  // Play fade-in animation
60  GetRootWidget().SetOpacity(0);
61  AnimateWidget.Opacity(GetRootWidget(), 1, UIConstants.FADE_RATE_FAST);
62  }
63 
64 
65  //-------------------------------------------------------------------------------------------------------
66  override void OnMenuClose()
67  {
68  super.OnMenuClose();
69 
70  GetGame().GetInputManager().RemoveActionListener("MenuBack", EActionTrigger.DOWN, Callback_OnBackButton);
71 
72  m_OnCloseFinished.Invoke();
73  }
74 
75 
76  //-------------------------------------------------------------------------------------------------------
77  protected void Init(string text)
78  {
79  m_LoadingOverlay.SetText(text);
80  }
81 
82 
83  //-------------------------------------------------------------------------------------------------------
84  protected void Callback_OnBackButton()
85  {
86  this.CloseAnimated();
87  }
88 };
ChimeraMenuBase
Constant variables used in various menus.
Definition: ChimeraMenuBase.c:70
UIConstants
Definition: Constants.c:130
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_LoadingOverlay
Definition: SCR_LoadingOverlay.c:49
GetRootWidget
Widget GetRootWidget()
Definition: SCR_UITaskManagerComponent.c:160
m_LoadingOverlay
protected SCR_LoadingOverlay m_LoadingOverlay
Definition: SCR_BackendImageComponent.c:250
SCR_LoadingOverlayDialog
Definition: SCR_LoadingOverlayDialog.c:5
ChimeraMenuPreset
ChimeraMenuPreset
Menu presets.
Definition: ChimeraMenuBase.c:3