9 [
Attribute(
"-1", uiwidget: UIWidgets.ComboBox, enums: { ParamEnum(
"Either",
"-1"), ParamEnum(
"Left",
"0"), ParamEnum(
"Right",
"1")})]
10 protected int m_iLightSide;
12 protected BaseLightManagerComponent m_LightManager;
14 protected ref ScriptInvoker m_OnLightStateChanged;
16 protected bool m_bIsLit =
true;
25 isSuppressed = m_LightManager && m_LightManager.GetLightsState(m_eSuppressedBy, m_iLightSide);
28 if (m_bIsLit && !isSuppressed && m_LightManager && m_LightManager.GetLightsState(m_eLightType, m_iLightSide))
35 override bool DisplayStartDrawInit(IEntity owner)
41 array<BaseLightSlot> outLights =
new array<BaseLightSlot>;
42 int iLights = m_LightManager.GetLights(outLights);
48 for (
int i = 0; i < iLights; i++)
50 lightSlot = outLights.Get(i);
52 lightType = lightSlot.GetLightType();
53 lightSide = lightSlot.GetLightSide();
55 if ((m_eLightType == lightType) && (m_iLightSide == -1 || m_iLightSide == lightSide))
57 #ifdef DEBUG_VEHICLE_UI
58 PrintFormat(
"[%1] BaseLightSlot detected %2 | type: %3 | side: %4", i, lightSlot, lightType, lightSide);
61 m_LightSlot = lightSlot;
64 m_OnLightStateChanged =
SCR_LightSlot.Cast(m_LightSlot).GetOnLightStateChanged();
75 if (m_OnLightStateChanged)
76 m_OnLightStateChanged.Insert(OnLightStateChanged);
78 return super.DisplayStartDrawInit(owner);
82 override void DisplayStopDraw(IEntity owner)
85 if (m_OnLightStateChanged)
86 m_OnLightStateChanged.Remove(OnLightStateChanged);
88 super.DisplayStopDraw(owner);
93 void OnLightStateChanged(
bool state)
97 #ifdef DEBUG_VEHICLE_UI
98 PrintFormat(
"%1 OnLightStateChanged: %2",
this, m_bIsLit);
104 override void DisplayInit(IEntity owner)
106 super.DisplayInit(owner);
108 m_LightManager = BaseLightManagerComponent.Cast(owner.FindComponent(BaseLightManagerComponent));