Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_LightManagerInfoMulti.c
Go to the documentation of this file.
1 [BaseContainerProps(configRoot: true)]
2 class SCR_LightManagerInfoEntry : Managed
3 {
4  [Attribute(SCR_Enum.GetDefault(ELightType.NoLight), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(ELightType))]
5  ELightType m_eLightType;
6 
7  [Attribute("-1", uiwidget: UIWidgets.ComboBox, enums: { ParamEnum("Either", "-1"), ParamEnum("Left", "0"), ParamEnum("Right", "1")})]
8  int m_iLightSide;
9 
10  [Attribute("", UIWidgets.EditBox, "Indicator icon to be displayed.")]
11  string m_sIcon;
12 
13  [Attribute(SCR_Enum.GetDefault(EVehicleInfoColor.WHITE), UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EVehicleInfoColor))]
14  EVehicleInfoColor m_eColor;
15 };
16 
18 {
19  [Attribute("", UIWidgets.Auto)]
20  protected ref array<ref SCR_LightManagerInfoEntry> m_aLights;
21 
22  protected BaseLightManagerComponent m_pLightManager;
23  protected SCR_LightManagerInfoEntry m_pActiveLight;
24  protected bool m_bActiveLightChanged;
25 
26  //------------------------------------------------------------------------------------------------
28  override EVehicleInfoState GetState()
29  {
30  bool enabled;
31  SCR_LightManagerInfoEntry lightPrev = m_pActiveLight;
32 
33  foreach (SCR_LightManagerInfoEntry light : m_aLights)
34  {
35  if (!light || light.m_eLightType == ELightType.NoLight)
36  continue;
37 
38  enabled = m_pLightManager && m_pLightManager.GetLightsState(light.m_eLightType, light.m_iLightSide);
39 
40  if (enabled)
41  {
42  m_pActiveLight = light;
43  break;
44  }
45  }
46 
47  if (m_pActiveLight != lightPrev)
48  m_bActiveLightChanged = true;
49 
50  if (enabled)
51  {
52  return EVehicleInfoState.ENABLED;
53  }
54  else
55  {
56  m_pActiveLight = null;
57  return EVehicleInfoState.DISABLED;
58  }
59 
60  }
61 
62  //------------------------------------------------------------------------------------------------
63  override void SetIcon(string icon)
64  {
65  if (m_pActiveLight)
66  icon = m_pActiveLight.m_sIcon;
67 
68  super.SetIcon(icon);
69  }
70 
71  //------------------------------------------------------------------------------------------------
72  override void SetColor(EVehicleInfoState state, EVehicleInfoColor color)
73  {
74  if (m_pActiveLight)
75  color = m_pActiveLight.m_eColor;
76 
77  super.SetColor(state, color);
78  }
79 
80  //------------------------------------------------------------------------------------------------
81  override bool UpdateRequired(EVehicleInfoState state)
82  {
83  bool isRequired = m_eState != state || m_bActiveLightChanged;
84 
85  m_bActiveLightChanged = false;
86 
87  return isRequired;
88  }
89 
90  //------------------------------------------------------------------------------------------------
91  override bool DisplayStartDrawInit(IEntity owner)
92  {
93  // Terminate if there is no light manager
94  if (!m_pLightManager)
95  return false;
96 
97  return super.DisplayStartDrawInit(owner);
98  }
99 
100  //------------------------------------------------------------------------------------------------
102  override void DisplayInit(IEntity owner)
103  {
104  super.DisplayInit(owner);
105 
106  m_pLightManager = BaseLightManagerComponent.Cast(owner.FindComponent(BaseLightManagerComponent));
107  }
108 };
SCR_Enum
Definition: SCR_Enum.c:1
EVehicleInfoColor
EVehicleInfoColor
Predefined colors that can be assigned in the InfoDisplay configuration.
Definition: SCR_BaseVehicleInfo.c:16
SCR_BaseVehicleInfo
Base class for all vehicle UI state and damage indicators.
Definition: SCR_BaseVehicleInfo.c:28
SCR_LightManagerInfoMulti
Definition: SCR_LightManagerInfoMulti.c:17
ELightType
ELightType
Definition: ELightType.c:7
m_eState
EAITargetClusterState m_eState
Definition: SCR_AITargetClusterState.c:24
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_aLights
SCR_BaseInteractiveLightComponentClass m_aLights
SCR_LightManagerInfoEntry
Definition: SCR_LightManagerInfoMulti.c:2
EVehicleInfoState
EVehicleInfoState
UI indicator state, controlling colors and opacity.
Definition: SCR_BaseVehicleInfo.c:5
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468