Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EditorAttributeStruct.c
Go to the documentation of this file.
1
6/*
7[Obsolete("Only used for backwards compatiblity for GM saves. Will be removed entirely.")]
8class SCR_EditorAttributeStruct: JsonApiStruct
9{
10 //--- Serialized (names shortened to save memory)
11 protected int id; //--- ID
12 protected int ty; //--- Type
13 protected float v0; //--- Var 0
14 protected float v1; //--- Var 1
15 protected float v2; //--- Var 2
16
17 static void SerializeAttributes(out notnull array<ref SCR_EditorAttributeStruct> outEntries, SCR_EditorAttributeList attributeList = null, Managed item = null)
18 {
19 outEntries.Clear();
20
21 SCR_BaseEditorAttribute attribute;
22 SCR_BaseEditorAttributeVar var;
23 for (int i = 0, count = attributeList.GetAttributesCount(); i < count; i++)
24 {
25 attribute = attributeList.GetAttribute(i);
26 if (!attribute.IsServer() || !attribute.IsSerializable())
27 continue;
28
29 var = attribute.ReadVariable(item, null);
30 if (!var)
31 continue;
32
33 SCR_EditorAttributeStruct entry = new SCR_EditorAttributeStruct();
34 outEntries.Insert(entry);
35 entry.id = i;
36
37 entry.v0 = var.GetVector()[0];
38 entry.v1 = var.GetVector()[1];
39 entry.v2 = var.GetVector()[2];
40 }
41 }
42
43 static void DeserializeAttributes(notnull array<ref SCR_EditorAttributeStruct> entries, SCR_EditorAttributeList attributeList = null, Managed item = null)
44 {
45 SCR_BaseEditorAttribute attribute;
46 SCR_BaseEditorAttributeVar var;
47
48 foreach (SCR_EditorAttributeStruct entry: entries)
49 {
50 attribute = attributeList.GetAttribute(entry.id);
51 if (!attribute.IsSerializable())
52 continue;
53
54 var = SCR_BaseEditorAttributeVar.CreateVector(Vector(entry.v0, entry.v1, entry.v2));
55 attribute.WriteVariable(item, var, null, -1);
56 }
57 }
58
59 static void LogAttributes(out notnull array<ref SCR_EditorAttributeStruct> entries, SCR_EditorAttributeList attributeList = null, string prefix = "")
60 {
61 Print(prefix + " SCR_EditorAttributeStruct: " + entries.Count());
62 foreach (SCR_EditorAttributeStruct entry: entries)
63 {
64 PrintFormat(prefix + " %1: %2, %3, %4", attributeList.GetAttribute(entry.id).ClassName(), entry.v0, entry.v1, entry.v2);
65 }
66 }
67 void SCR_EditorAttributeStruct()
68 {
69 RegV("id");
70 RegV("v0");
71 RegV("v1");
72 RegV("v2");
73 }
74};
75*/