Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
ScreenEffectsManager.c
Go to the documentation of this file.
1 class SCR_ScreenEffectsManager : SCR_InfoDisplayExtended
2 {
3  // Pointer for getting SCR_ScreenEffectsManager
4  private static SCR_ScreenEffectsManager s_pScreenEffectsManager;
5 
6  // Owner data
7  protected ChimeraCharacter m_pCharacterEntity;
8 
9  //------------------------------------------------------------------------------------------------
11  static SCR_ScreenEffectsManager GetScreenEffectsDisplay()
12  {
13  return s_pScreenEffectsManager;
14  }
15 
16  //------------------------------------------------------------------------------------------------
17  override void DisplayStartDraw(IEntity owner)
18  {
19  s_pScreenEffectsManager = this;
20 
21  GetGame().OnUserSettingsChangedInvoker().Insert(SettingsChanged);
22  SettingsChanged();
23 
24  // Clear all effects that are applied otherwise
25  ManagerClearEffects();
26  }
27 
28  //------------------------------------------------------------------------------------------------
29  void SettingsChanged()
30  {
31  array<BaseInfoDisplay> infoDisplays = {};
32  GetInfoDisplays(infoDisplays);
33  foreach (BaseInfoDisplay baseInfoDisplays: infoDisplays)
34  {
35  SCR_BaseScreenEffect screenEffect = SCR_BaseScreenEffect.Cast(baseInfoDisplays);
36  if (screenEffect)
37  screenEffect.SettingsChanged();
38  }
39  }
40 
41  //------------------------------------------------------------------------------------------------
42  override void DisplayControlledEntityChanged(IEntity from, IEntity to)
43  {
44  if (to)
45  m_pCharacterEntity = ChimeraCharacter.Cast(to);
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  override event void DisplayUpdate(IEntity owner, float timeSlice)
50  {
51  if (!GetGame().GetCameraManager())
52  return;
53 
54  CameraBase currentCamera = GetGame().GetCameraManager().CurrentCamera();
55  PlayerCamera playerCamera = GetGame().GetPlayerController().GetPlayerCamera();
56  if (!playerCamera || currentCamera != playerCamera)
57  m_wRoot.SetVisible(false);
58  else
59  m_wRoot.SetVisible(true);
60 
61  array<BaseInfoDisplay> infoDisplays = {};
62  GetInfoDisplays(infoDisplays);
63  foreach (BaseInfoDisplay baseInfoDisplays: infoDisplays)
64  {
65  SCR_BaseScreenEffect screenEffect = SCR_BaseScreenEffect.Cast(baseInfoDisplays);
66  if (screenEffect)
67  screenEffect.UpdateEffect(timeSlice);
68  }
69  }
70 
71  //------------------------------------------------------------------------------------------------
73  void ManagerClearEffects()
74  {
75  array<BaseInfoDisplay> infoDisplays = {};
76  GetInfoDisplays(infoDisplays);
77  foreach (BaseInfoDisplay baseInfoDisplays: infoDisplays)
78  {
79  SCR_BaseScreenEffect screenEffect = SCR_BaseScreenEffect.Cast(baseInfoDisplays);
80  if (screenEffect)
81  screenEffect.ClearEffects();
82  }
83  }
84 
85  //------------------------------------------------------------------------------------------------
86  override event void DisplayStopDraw(IEntity owner)
87  {
88  ManagerClearEffects();
89  GetGame().OnUserSettingsChangedInvoker().Remove(SettingsChanged);
90 
91  s_pScreenEffectsManager = null;
92  }
93 };
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_BaseScreenEffect
Definition: SCR_BaseScreenEffect.c:1
SCR_ScreenEffectsManager
Definition: ScreenEffectsManager.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
GetInfoDisplays
BaseHUDComponentClass GameComponentClass GetInfoDisplays(out notnull array< BaseInfoDisplay > outInfoDisplays)
BaseInfoDisplay
Definition: BaseInfoDisplay.c:12