1 [
EntityEditorProps(
category:
"GameScripted/DataCollection/", description:
"Component used to send data to specific clients.")]
25 void SendData(notnull
SCR_PlayerData playerData, notnull array<FactionKey> factionKeys, notnull array<float> values,
int valuesSize)
27 Rpc(
Rpc_DoSendData, playerData.GetStats(), playerData.GetPreviousStats(), factionKeys, values, valuesSize);
37 [
RplRpc(RplChannel.Reliable, RplRcver.Owner)]
38 void Rpc_DoSendData(notnull array<float> stats, notnull array<float> previousStats, notnull array<FactionKey> factionKeys, notnull array<float> values,
int valuesSize)
40 foreach (
float stat : stats)
42 Print(stat, LogLevel.DEBUG);
45 foreach (
float stat : previousStats)
47 Print(stat, LogLevel.DEBUG);
50 BaseGameMode gameMode =
GetGame().GetGameMode();
54 SCR_DataCollectorComponent dataCollector =
GetGame().GetDataCollector();
58 for (
int i = 0, factionsCount = factionKeys.Count(); i < factionsCount; i++)
60 array<float> valuesForFaction = {};
61 for (
int j = 0; j < valuesSize; j++)
63 valuesForFaction.Insert(values[i * valuesSize + j]);
66 dataCollector.AddStatsToFaction(factionKeys[i], valuesForFaction);
69 SCR_PlayerData playerData = dataCollector.GetPlayerData(0,
true,
false);
70 playerData.SetStats(stats);
71 playerData.SetPreviousStats(previousStats);