Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_DataCollectorModule.c
Go to the documentation of this file.
1
[
BaseContainerProps
()]
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
instigator, notnull
SCR_InstigatorContextData
instigatorContextData);
53
54
//------------------------------------------------------------------------------------------------
55
void
OnAIKilled
(
IEntity
AIEntity,
IEntity
killerEntity, notnull
Instigator
instigator, notnull
SCR_InstigatorContextData
instigatorContextData);
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:1398
GetDataCollector
SCR_DataCollectorComponent GetDataCollector()
Definition
game.c:110
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
IEntity
Definition
IEntity.c:13
Instigator
Definition
Instigator.c:13
SCR_DataCollectorModule
Definition
SCR_DataCollectorModule.c:3
SCR_DataCollectorModule::OnAIKilled
void OnAIKilled(IEntity AIEntity, IEntity killerEntity, notnull Instigator instigator, notnull SCR_InstigatorContextData instigatorContextData)
SCR_DataCollectorModule::OnPlayerKilled
void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator instigator, notnull SCR_InstigatorContextData instigatorContextData)
SCR_DataCollectorModule::OnPlayerSpawned
void OnPlayerSpawned(int playerID, IEntity controlledEntity)
Definition
SCR_DataCollectorModule.c:38
SCR_DataCollectorModule::RemoveInvokers
void RemoveInvokers(IEntity player)
SCR_DataCollectorModule::AddInvokers
void AddInvokers(IEntity player)
SCR_DataCollectorModule::Update
void Update(float timeTick)
SCR_DataCollectorModule::OnGameModeEnd
void OnGameModeEnd()
SCR_DataCollectorModule::m_fUpdatePeriod
float m_fUpdatePeriod
Definition
SCR_DataCollectorModule.c:8
SCR_DataCollectorModule::InitModule
void InitModule()
SCR_DataCollectorModule::OnControlledEntityChanged
void OnControlledEntityChanged(IEntity from, IEntity to)
Definition
SCR_DataCollectorModule.c:68
SCR_DataCollectorModule::m_fTimeSinceUpdate
float m_fTimeSinceUpdate
Definition
SCR_DataCollectorModule.c:6
SCR_DataCollectorModule::OnPlayerDisconnected
void OnPlayerDisconnected(int playerID, IEntity controlledEntity=null)
Definition
SCR_DataCollectorModule.c:22
SCR_DataCollectorModule::OnPlayerAuditSuccess
void OnPlayerAuditSuccess(int playerID)
SCR_DataCollectorModule::m_StatsVisualization
ref map< int, TextWidget > m_StatsVisualization
Definition
SCR_DataCollectorModule.c:4
SCR_InstigatorContextData
Definition
SCR_InstigatorContextData.c:2
UIWidgets
Definition
attributes.c:40
map
Definition
Types.c:486
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
DataCollection
SCR_DataCollectorModule.c
Generated by
1.17.0