Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SignalsDebugComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Sound", description: "Signal Debug Component")]
2 class SCR_SignalDebugComponentClass : ScriptComponentClass
3 {
4 }
5 
7 {
8  [Attribute("", uiwidget: UIWidgets.Object, "Signals names")]
9  protected ref array<string> m_aSignalNames;
10 
11  [Attribute("false", uiwidget: UIWidgets.EditBox, "Print signals registered on sound component into log")]
12  protected bool m_bPrintToLog;
13 
14  [Attribute("false", uiwidget: UIWidgets.EditBox, "Print signals registered on sound component into log")]
16 
17  protected ref array<int> m_aSignalsID = new array<int>;
18  protected int m_aSignalNamesCount;
19 
20  protected ref array<string> m_aSCSignalNames = new array<string>;
21 
22  protected SignalsManagerComponent m_SignalsManagerComponent;
23  protected SoundComponent m_SoundComponent;
24 
25  //------------------------------------------------------------------------------------------------
26  override void EOnFrame(IEntity owner, float timeSlice)
27  {
28  if (m_bPrintToLog)
29  {
30  Print("------------------");
31  }
32 
33  for (int i = 0; i < m_aSignalNamesCount; i++)
34  {
35  string text = m_aSignalNames[i] + " :" + m_SignalsManagerComponent.GetSignalValue(m_aSignalsID[i]).ToString();
36 
37  DbgUI.Text(text);
38 
39  if (m_bPrintToLog)
40  {
41  Print(text);
42  }
43  }
44  }
45 
46  //------------------------------------------------------------------------------------------------
47  override void OnPostInit(IEntity owner)
48  {
49  // Get Components
50  GenericEntity genEnt = GenericEntity.Cast(owner);
51  m_SignalsManagerComponent = SignalsManagerComponent.Cast(genEnt.FindComponent(SignalsManagerComponent));
52  m_SoundComponent = SoundComponent.Cast(genEnt.FindComponent(SoundComponent));
53 
55  {
56  ClearEventMask(owner, EntityEvent.FRAME);
57  return;
58  }
59  else
60  {
61  // Set OnFrame
62  SetEventMask(owner, EntityEvent.FRAME | EntityEvent.INIT);
63 
64  // Get signals IDs
65  foreach (string name: m_aSignalNames)
66  {
67  m_aSignalsID.Insert(m_SignalsManagerComponent.AddOrFindSignal(name));
68  }
69 
70  m_aSignalNamesCount = m_aSignalNames.Count();
71  }
72  }
73 
74  //------------------------------------------------------------------------------------------------
75  override void EOnInit(IEntity owner)
76  {
78  {
79  m_SoundComponent.GetSignalNames(m_aSCSignalNames);
80 
81  Print("------- Registered signals on sound component -------");
82 
83  foreach (string name : m_aSCSignalNames)
84  {
85  Print(name);
86  }
87  }
88  }
89 
90  //------------------------------------------------------------------------------------------------
91  // constructor
95  void SCR_SignalDebugComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
96  {
97  }
98 }
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
m_aSignalsID
protected ref array< int > m_aSignalsID
Definition: SCR_SignalsDebugComponent.c:17
ScriptComponent
SCR_SiteSlotEntityClass ScriptComponent
m_bPrintSignalsOnSoundComponent
protected bool m_bPrintSignalsOnSoundComponent
Definition: SCR_SignalsDebugComponent.c:15
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
EOnFrame
override void EOnFrame(IEntity owner, float timeSlice)
Definition: SCR_SignalsDebugComponent.c:26
m_aSignalNamesCount
protected int m_aSignalNamesCount
Definition: SCR_SignalsDebugComponent.c:18
m_aSCSignalNames
protected ref array< string > m_aSCSignalNames
Definition: SCR_SignalsDebugComponent.c:20
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_SignalsDebugComponent.c:47
m_SoundComponent
protected SoundComponent m_SoundComponent
Definition: SCR_SignalsDebugComponent.c:23
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_SignalsDebugComponent.c:75
m_SignalsManagerComponent
protected SignalsManagerComponent m_SignalsManagerComponent
Definition: SCR_SignalsDebugComponent.c:22
Attribute
SCR_SignalDebugComponentClass ScriptComponentClass Attribute("", uiwidget:UIWidgets.Object, "Signals names")] protected ref array< string > m_aSignalNames
m_bPrintToLog
protected bool m_bPrintToLog
Definition: SCR_SignalsDebugComponent.c:12
SCR_SignalDebugComponentClass
Definition: SCR_SignalsDebugComponent.c:2
SCR_SignalDebugComponent
void SCR_SignalDebugComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_SignalsDebugComponent.c:95
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180