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_EditableFactionStruct.c
Go to the documentation of this file.
1
/*
2
[Obsolete("Only used for backwards compatiblity for GM saves. Will be removed entirely.")]
3
class SCR_EditableFactionStruct: JsonApiStruct
4
{
5
//--- Serialized (names shortened to save memory)
6
protected string fk; //--- Faction key
7
protected ref array<ref SCR_EditorAttributeStruct> at = {};
8
9
static void SerializeFactions(out notnull array<ref SCR_EditableFactionStruct> outEntries, SCR_EditorAttributeList attributeList)
10
{
11
SCR_DelegateFactionManagerComponent delegateManager = SCR_DelegateFactionManagerComponent.GetInstance();
12
if (!delegateManager)
13
return;
14
15
//--- Clear existing array
16
outEntries.Clear();
17
18
SCR_SortedArray<SCR_EditableFactionComponent> delegates = new SCR_SortedArray<SCR_EditableFactionComponent>();
19
for (int i, count = delegateManager.GetSortedFactionDelegates(delegates); i < count; i++)
20
{
21
SerializeFaction(delegates[i], outEntries, attributeList);
22
}
23
}
24
protected static void SerializeFaction(SCR_EditableFactionComponent faction, out notnull array<ref SCR_EditableFactionStruct> outEntries, SCR_EditorAttributeList attributeList)
25
{
26
SCR_EditableFactionStruct entry = new SCR_EditableFactionStruct();
27
entry.fk = faction.GetFaction().GetFactionKey();
28
outEntries.Insert(entry);
29
30
SCR_EditorAttributeStruct.SerializeAttributes(entry.at, attributeList, faction);
31
}
32
static void DeserializeFactions(notnull array<ref SCR_EditableFactionStruct> entries, SCR_EditorAttributeList attributeList = null)
33
{
34
FactionManager factionManager = GetGame().GetFactionManager();
35
if (!factionManager)
36
return;
37
38
SCR_DelegateFactionManagerComponent delegateManager = SCR_DelegateFactionManagerComponent.GetInstance();
39
if (!delegateManager)
40
return;
41
42
Faction faction;
43
SCR_EditableFactionComponent factionDelegate;
44
foreach (int id, SCR_EditableFactionStruct entry: entries)
45
{
46
faction = factionManager.GetFactionByKey(entry.fk);
47
factionDelegate = delegateManager.GetFactionDelegate(faction);
48
if (factionDelegate)
49
{
50
SCR_EditorAttributeStruct.DeserializeAttributes(entry.at, attributeList, factionDelegate);
51
}
52
else
53
{
54
Print(string.Format("SCR_EditableFactionStruct: Cannot load faction '%1', it's not configured in FactionManager!", entry.fk), LogLevel.WARNING);
55
}
56
}
57
58
SCR_SortedArray<SCR_EditableFactionComponent> delegates = new SCR_SortedArray<SCR_EditableFactionComponent>();
59
for (int i, count = delegateManager.GetSortedFactionDelegates(delegates); i < count; i++)
60
{
61
}
62
}
63
static void LogFactions(notnull array<ref SCR_EditableFactionStruct> entries, SCR_EditorAttributeList attributeList = null)
64
{
65
Print(" SCR_EditableFactionStruct: " + entries.Count());
66
foreach (int id, SCR_EditableFactionStruct entry: entries)
67
{
68
PrintFormat(" %1", entry.fk);
69
70
SCR_EditorAttributeStruct.LogAttributes(entry.at, attributeList, " ");
71
}
72
}
73
void SCR_EditableFactionStruct()
74
{
75
RegV("fk");
76
RegV("at");
77
}
78
};
79
*/
scripts
Game
Editor
Containers
Backend
SCR_EditableFactionStruct.c
Generated by
1.17.0