Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AnalyticsDataCollectionPlayerFactionModule.c
Go to the documentation of this file.
3{
5
6 //------------------------------------------------------------------------------------------------
7 protected override void Enable()
8 {
9 SCR_FactionManager fm = SCR_FactionManager.Cast(GetGame().GetFactionManager());
10 if (!fm)
11 return;
12
13 fm.GetOnPlayerFactionChanged_S().Insert(OnPlayerFactionChanged);
14
15 super.Enable();
16 }
17
18 //------------------------------------------------------------------------------------------------
19 protected override void Disable()
20 {
21 SCR_FactionManager fm = SCR_FactionManager.Cast(GetGame().GetFactionManager());
22 if (!fm)
23 return;
24
25 fm.GetOnPlayerFactionChanged_S().Remove(OnPlayerFactionChanged);
26
27 super.Disable();
28 }
29
30 //------------------------------------------------------------------------------------------------
31 protected void OnPlayerFactionChanged(int playerId, SCR_PlayerFactionAffiliationComponent playerFactionAffiliationComponent, Faction faction)
32 {
33 if (!faction)
34 return;
35
36 m_mPlayerFactions.Insert(playerId, faction);
37
38 SCR_PlayerData playerData = SCR_PlayerData.GetPlayerData(playerId);
39 if (!playerData)
40 return;
41
42 playerData.dataEvent.name_faction_player = faction.GetFactionKey();
43 }
44
45 #ifdef ENABLE_DIAG
46 //------------------------------------------------------------------------------------------------
47 override void DrawContent()
48 {
49 if (!m_bIsEnabled)
50 {
51 DbgUI.Text("Module disabled!");
52 return;
53 }
54
55 foreach (int playerID, Faction playerFaction : m_mPlayerFactions)
56 {
57 DbgUI.Text(string.Format("Player %1 - Faction %2", GetGame().GetPlayerManager().GetPlayerName(playerID), playerFaction.GetFactionKey()));
58 }
59 }
60 #endif
61
62 //------------------------------------------------------------------------------------------------
67}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Get all prefabs that have the spawner the given labels and are valid in the editor mode param catalogType Type to catalog to get prefabs from param editorMode Editor mode to get valid entries from param faction Faction(Optional)
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition DbgUI.c:66
void OnPlayerFactionChanged(int playerId, SCR_PlayerFactionAffiliationComponent playerFactionAffiliationComponent, Faction faction)
ref SCR_PlayerDataEvent dataEvent
static SCR_PlayerData GetPlayerData(int playerID)
Definition Types.c:486