4 protected ref map<int, TextWidget> m_StatsVisualization;
6 protected float m_fTimeSinceUpdate = 0;
7 [
Attribute(
"1", UIWidgets.Slider,
desc:
"Seconds between updates of the module")]
15 void Update(
float timeTick);
22 void OnPlayerDisconnected(
int playerID, IEntity controlledEntity =
null)
24 if (!controlledEntity)
25 controlledEntity =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
28 RemoveInvokers(controlledEntity);
32 protected void AddInvokers(IEntity player);
35 protected void RemoveInvokers(IEntity player);
38 void OnPlayerSpawned(
int playerID, IEntity controlledEntity)
40 AddInvokers(controlledEntity);
49 void OnPlayerAuditSuccess(
int playerID);
52 void OnPlayerKilled(
int playerId, IEntity playerEntity, IEntity killerEntity, notnull
Instigator killer);
55 void OnAIKilled(IEntity AIEntity, IEntity killerEntity, notnull
Instigator killer);
68 void OnControlledEntityChanged(IEntity from, IEntity to)
89 void CreateVisualization()
91 m_StatsVisualization =
new map<int, TextWidget>();
95 protected void CreateEntry(
string text,
float value,
int id)
100 Widget entry =
GetGame().GetDataCollector().GetUIHandler().CreateEntry();
104 Print(
"UI handler from DataCollector couldn't create a visual widget", LogLevel.ERROR);
108 TextWidget StatName = TextWidget.Cast(entry.FindAnyWidget(
"StatName"));
109 TextWidget StatValue = TextWidget.Cast(entry.FindAnyWidget(
"StatValue"));
110 if (!StatName || !StatValue)
112 Print(
"StatName or StatValue textwidgets could not be found in data collector ui handler's layout", LogLevel.ERROR);
116 StatName.SetText(text); StatValue.SetText(value.ToString());
117 m_StatsVisualization.Insert(
id, StatValue);