Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DataCollectorModule.c
Go to the documentation of this file.
2 class SCR_DataCollectorModule : Managed
3 {
4  protected ref map<int, TextWidget> m_StatsVisualization;
5 
6  protected float m_fTimeSinceUpdate = 0;
7  [Attribute("1", UIWidgets.Slider, desc: "Seconds between updates of the module")]
8  float m_fUpdatePeriod;
9 
10  //***************************//
11  /* OVERRIDDEN BY ALL MODULES */
12  //***************************//
13 
14  //------------------------------------------------------------------------------------------------
15  void Update(float timeTick);
16 
17  //***********************************************************//
18  /* OVERRIDDEN BY SOME MODULES BUT CALLING THEIR SUPER METHOD */
19  //***********************************************************//
20 
21  //------------------------------------------------------------------------------------------------
22  void OnPlayerDisconnected(int playerID, IEntity controlledEntity = null)
23  {
24  if (!controlledEntity)
25  controlledEntity = GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
26 
27  if (controlledEntity)
28  RemoveInvokers(controlledEntity);
29  }
30 
31  //------------------------------------------------------------------------------------------------
32  protected void AddInvokers(IEntity player);
33 
34  //------------------------------------------------------------------------------------------------
35  protected void RemoveInvokers(IEntity player);
36 
37  //------------------------------------------------------------------------------------------------
38  void OnPlayerSpawned(int playerID, IEntity controlledEntity)
39  {
40  AddInvokers(controlledEntity);
41  }
42 
43  //***********************************************************//
44  /* OVERRIDDEN BY SOME MODULES BUT CALLING THEIR SUPER METHOD */
45  /************ (unless the call is very specific) *************/
46  //***********************************************************//
47 
48  //------------------------------------------------------------------------------------------------
49  void OnPlayerAuditSuccess(int playerID);
50 
51  //------------------------------------------------------------------------------------------------
52  void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer);
53 
54  //------------------------------------------------------------------------------------------------
55  void OnAIKilled(IEntity AIEntity, IEntity killerEntity, notnull Instigator killer);
56 
57  //------------------------------------------------------------------------------------------------
58  void OnGameModeEnd();
59 
60  //------------------------------------------------------------------------------------------------
61  void InitModule();
62 
63  //*****************//
64  /* NEVER OVERRIDDEN*/
65  //*****************//
66 
67  //------------------------------------------------------------------------------------------------
68  void OnControlledEntityChanged(IEntity from, IEntity to)
69  {
70  //If the previous entity exists, remove the invokers from it
71  if (from)
72  RemoveInvokers(from);
73 
74  //If there's no entity yet we can assume the player disconnected or it hasn't spawned.
75  //In this case we do nothing and keep listening to the spawn invoker.
76  //Otherwise, we add the invokers to the 'to' entity
77  if (to)
78  AddInvokers(to);
79  }
80 
81  //************************************************************************//
82  /*********************** CREATED ONLY FOR PROTOTYPE ***********************/
83  /* These create a textwidget on screen with the stats updated dynamically */
84  //************************************************************************//
85  //************************************************************************//
86 
87 #ifdef ENABLE_DIAG
88  //------------------------------------------------------------------------------------------------
89  void CreateVisualization()
90  {
91  m_StatsVisualization = new map<int, TextWidget>();
92  }
93 
94  //------------------------------------------------------------------------------------------------
95  protected void CreateEntry(string text, float value, int id)
96  {
97  if (!m_StatsVisualization || !GetGame().GetDataCollector() || !GetGame().GetDataCollector().GetUIHandler())
98  return;
99 
100  Widget entry = GetGame().GetDataCollector().GetUIHandler().CreateEntry();
101 
102  if (!entry)
103  {
104  Print("UI handler from DataCollector couldn't create a visual widget", LogLevel.ERROR);
105  return;
106  }
107 
108  TextWidget StatName = TextWidget.Cast(entry.FindAnyWidget("StatName"));
109  TextWidget StatValue = TextWidget.Cast(entry.FindAnyWidget("StatValue"));
110  if (!StatName || !StatValue)
111  {
112  Print("StatName or StatValue textwidgets could not be found in data collector ui handler's layout", LogLevel.ERROR);
113  return;
114  }
115 
116  StatName.SetText(text); StatValue.SetText(value.ToString());
117  m_StatsVisualization.Insert(id, StatValue);
118  }
119 #endif
120 };
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Instigator
Definition: Instigator.c:6
Attribute
typedef Attribute
Post-process effect of scripted camera.
GetDataCollector
SCR_DataCollectorComponent GetDataCollector()
Definition: game.c:90
SCR_DataCollectorModule
Definition: SCR_DataCollectorModule.c:2
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