Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WidgetExportRule.c
Go to the documentation of this file.
1
6{
7 // Variables and methods of this class are only needed in the workbench during export
8
9 [Attribute("true", UIWidgets.CheckBox, "Export this widget and its components")]
10 protected bool ExportThisWidget;
11
12 [Attribute("true", UIWidgets.CheckBox, "Export children of this widget")]
13 protected bool ExportChildWidgets;
14
15 [Attribute("", UIWidgets.EditBox, "Variable name for this widget. If not provided, it will be deduced from widget name.")]
16 protected string WidgetVariableName;
17
18#ifdef WORKBENCH
19
20 //------------------------------------------------------------------------------------------------
21 static BaseContainer FindInWidgetSource(WidgetSource ws)
22 {
23 if (!ws)
24 return null;
25
26 BaseContainerList components = ws.GetObjectArray("components");
27
28 BaseContainer comp;
29 typename compTypename;
30 for (int i, count = components.Count(); i < count; i++)
31 {
32 comp = components.Get(i);
33 compTypename = comp.GetClassName().ToType();
34 if (compTypename && compTypename.IsInherited(SCR_WidgetExportRule))
35 return comp;
36 }
37
38 return null;
39 }
40
41 // ----------- Getters ----------
42
43 //------------------------------------------------------------------------------------------------
44 static void ExtractVariablesFromBaseContainer(BaseContainer container,
45 out bool out_ExportThisWidget,
46 out bool out_ExportChildWidgets,
47 out string out_WidgetVariableName)
48 {
49 container.Get("ExportThisWidget", out_ExportThisWidget);
50 container.Get("ExportChildWidgets", out_ExportChildWidgets);
51 container.Get("WidgetVariableName", out_WidgetVariableName);
52 }
53
54 //------------------------------------------------------------------------------------------------
55 static bool GetExportThisWidget(BaseContainer container)
56 {
57 bool outVar;
58 container.Get("ExportThisWidget", outVar);
59 return outVar;
60 }
61
62 //------------------------------------------------------------------------------------------------
63 static bool GetExportChildWidgets(BaseContainer container)
64 {
65 bool outVar;
66 container.Get("ExportChildWidgets", outVar);
67 return outVar;
68 }
69
70 //------------------------------------------------------------------------------------------------
71 static string GetWidgetVariableName(BaseContainer container)
72 {
73 string outVar;
74 container.Get("WidgetVariableName", outVar);
75 return outVar;
76 }
77
78#endif // WORKBENCH
79}
80
82class SCR_WidgetExportRuleRoot : ScriptedWidgetComponent
83{
84
85 [Attribute(defvalue: "", desc: "Folder where the file will be saved", params: "unregFolders", enums: null, category: "")]
86 ResourceName DestinationPath;
87
88 [Attribute("$ArmaReforger:", UIWidgets.EditBox, "File system in which new script will be created.", "")]
89 string ScriptAddon;
90
91 [Attribute("true", UIWidgets.CheckBox, "When true, widget is resolved with FindWidget() in generated code. When false, widget is resolved with FindAnyWidget().")]
92 bool GenerateFullWidgetPath;
93
94 [Attribute("SCR_", UIWidgets.EditBox, "Prefix which will be added to the name of the generated class")]
95 string ScriptClassNamePrefix;
96
97 [Attribute("Widgets", UIWidgets.EditBox, "Suffix which will be added to the name of the generated class")]
98 string ScriptClassNameSuffix;
99
100#ifdef WORKBENCH
101
102 //------------------------------------------------------------------------------------------------
103 static BaseContainer FindInWidgetSource(WidgetSource ws)
104 {
105 if (!ws)
106 return null;
107
108 BaseContainerList components = ws.GetObjectArray("components");
109 typename compTypename;
110 BaseContainer comp;
111 for (int i, count = components.Count(); i < count; i++)
112 {
113 comp = components.Get(i);
114 compTypename = comp.GetClassName().ToType();
115 if (compTypename && compTypename.IsInherited(SCR_WidgetExportRuleRoot))
116 return comp;
117 }
118
119 return null;
120 }
121
122 //------------------------------------------------------------------------------------------------
123 static ResourceName GetDestinationPath(BaseContainer container)
124 {
125 ResourceName outVar;
126 container.Get("DestinationPath", outVar);
127 return outVar;
128 }
129
130 //------------------------------------------------------------------------------------------------
131 static string GetScriptAddon(BaseContainer container)
132 {
133 string outVar;
134 container.Get("ScriptAddon", outVar);
135 return outVar;
136 }
137
138 //------------------------------------------------------------------------------------------------
139 static bool GetGenerateFullWidgetPath(BaseContainer container)
140 {
141 bool outVar;
142 container.Get("GenerateFullWidgetPath", outVar);
143 return outVar;
144 }
145
146 //------------------------------------------------------------------------------------------------
147 static void GetClassPrefixAndSuffix(BaseContainer container, out string prefix, out string suffix)
148 {
149 container.Get("ScriptClassNamePrefix", prefix);
150 container.Get("ScriptClassNameSuffix", suffix);
151 }
152
153#endif // WORKBENCH
154}
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
SCR_FieldOfViewSettings Attribute