Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CollimatorSightsComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Misc", description: "")]
3 {
4 };
5 
8 {
9  [Attribute("1 1 1", UIWidgets.ColorPicker, desc: "Reticle Color", category: "Reticle")]
10  vector m_vReticleColor;
11  [Attribute("1 1 1", UIWidgets.ColorPicker, desc: "Reticle Glow Color", category: "Reticle")]
12  vector m_vGlowColor;
13 };
14 
15 class SCR_CollimatorSightsComponent : BaseCollimatorSightsComponent
16 {
17  // For the Input manager
18  const string ACTION_ILLUMINATION = "WeaponToggleSightsIllumination";
19 
20  // Attributes
21  [Attribute("9", UIWidgets.Slider, "Reticle Daylight Brightness", params: "0 15 0.1", category: "Collimator")]
22  protected float m_fDaylightBrightness;
23 
24  [Attribute("2", UIWidgets.Slider, "Reticle Night Brightness", params: "0 15 0.1", category: "Collimator")]
25  protected float m_fNightBrightness;
26 
27  /*[Attribute("0", desc: "Default Color index", category: "Collimator")]
28  protected int m_iDefaultColor;
29 
30  [Attribute("", UIWidgets.Object, desc: "Array of reticle colors", category: "Collimator")]
31  protected ref array<ref SCR_ReticleColor> m_ReticleColorArray;
32 
33  [Attribute("0", desc: "Default Reticle Index from array (or from emat if array is empty)", category: "Collimator")]
34  protected int m_iDefaultReticle;*/
35 
36  /*[Attribute("", desc: "Array of Reticle indices", category: "Collimator")]
37  protected ref array<int> m_ReticleIndexArray;
38 
39  [Attribute("", desc: "Array of Reticle Info", category: "Collimator")]
40  protected ref array<ref BaseCollimatorReticleInfo> m_ReticleInfoArray;*/
41 
42  //------------------------------------------------------------------------------------------------
43  SCR_CollimatorControllerComponent m_managerComponent;
44  bool m_bReticleDaylight = true;
45  int m_iColorIndex = -1;
46 
47  //------------------------------------------------------------------------------------------------
48  override void OnPostInit(IEntity owner)
49  {
50  m_managerComponent = SCR_CollimatorControllerComponent.Cast(FindComponent( SCR_CollimatorControllerComponent ));
51  if (!m_managerComponent)
52  {
53  Print("Warning: No Collimator Controller on this sight", LogLevel.WARNING);
54  }
55 
56  if (m_managerComponent)
57  {
58  m_managerComponent.SetReticleBrightness(m_fDaylightBrightness);
59  }
60 
61  }
62 
63  override void OnSightADSActivate()
64  {
65  GetGame().GetInputManager().AddActionListener(ACTION_ILLUMINATION, EActionTrigger.DOWN, ToggleIllumination);
66  }
67 
68  override void OnSightADSDeactivated()
69  {
70  GetGame().GetInputManager().RemoveActionListener(ACTION_ILLUMINATION, EActionTrigger.DOWN, ToggleIllumination);
71  }
72 
73  //------------------------------------------------------------------------------------------------
74 
75  protected void ToggleIllumination(float value, EActionTrigger trigger)
76  {
77  ReticleToggleIllumination();
78  }
79 
80  //------------------------------------------------------------------------------------------------
81 
82  void ReticleToggleIllumination()
83  {
84  m_bReticleDaylight = !m_bReticleDaylight;
85 
86  if (m_managerComponent)
87  {
88  if (m_bReticleDaylight)
89  m_managerComponent.SetReticleBrightness(m_fDaylightBrightness);
90  else
91  m_managerComponent.SetReticleBrightness(m_fNightBrightness);
92  }
93  }
94 
95  //------------------------------------------------------------------------------------------------
96  override void UpdateReticlePosition(float u, float v, float uScale, float vScale)
97  {
98  if (m_managerComponent)
99  m_managerComponent.UpdateUVCoordinates(u, v, uScale, vScale);
100  }
101 
102  override void UpdateReticleShapeIndex(int index)
103  {
104  if (m_managerComponent)
105  m_managerComponent.SetReticleIndex(index);
106  }
107 
108  override void UpdateReticleColor(vector inner, vector glow)
109  {
110  if (m_managerComponent && inner && glow)
111  m_managerComponent.SetReticleColors(inner, glow);
112  }
113 };
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_CollimatorControllerComponent
Definition: SCR_CollimatorControllerComponent.c:6
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_CollimatorSightsComponentClass
Definition: SCR_CollimatorSightsComponent.c:2
SCR_CollimatorSightsComponent
Definition: SCR_CollimatorSightsComponent.c:15
BaseCollimatorSightsComponentClass
Definition: BaseCollimatorSightsComponent.c:12
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_ReticleColor
Definition: SCR_CollimatorSightsComponent.c:7
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
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
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180