Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_WidgetExportRule.c
Go to the documentation of this file.
1 class SCR_WidgetExportRule : ScriptedWidgetComponent
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  BaseContainerList components = ws.GetObjectArray("components");
24 
25  BaseContainer comp;
26  typename compTypename;
27  for (int i, count = components.Count(); i < count; i++)
28  {
29  comp = components.Get(i);
30  compTypename = comp.GetClassName().ToType();
31  if (compTypename && compTypename.IsInherited(SCR_WidgetExportRule))
32  return comp;
33  }
34 
35  return null;
36  }
37 
38  // ----------- Getters ----------
39 
40  //------------------------------------------------------------------------------------------------
41  static void ExtractVariablesFromBaseContainer(BaseContainer container,
42  out bool out_ExportThisWidget,
43  out bool out_ExportChildWidgets,
44  out string out_WidgetVariableName)
45  {
46  container.Get("ExportThisWidget", out_ExportThisWidget);
47  container.Get("ExportChildWidgets", out_ExportChildWidgets);
48  container.Get("WidgetVariableName", out_WidgetVariableName);
49  }
50 
51  //------------------------------------------------------------------------------------------------
52  static bool GetExportThisWidget(BaseContainer container)
53  {
54  bool outVar;
55  container.Get("ExportThisWidget", outVar);
56  return outVar;
57  }
58 
59  //------------------------------------------------------------------------------------------------
60  static bool GetExportChildWidgets(BaseContainer container)
61  {
62  bool outVar;
63  container.Get("ExportChildWidgets", outVar);
64  return outVar;
65  }
66 
67  //------------------------------------------------------------------------------------------------
68  static string GetWidgetVariableName(BaseContainer container)
69  {
70  string outVar;
71  container.Get("WidgetVariableName", outVar);
72  return outVar;
73  }
74 
75 #endif // WORKBENCH
76 }
77 
79 class SCR_WidgetExportRuleRoot : ScriptedWidgetComponent
80 {
81 
82  [Attribute(defvalue: "", desc: "Folder where the file will be saved", params: "unregFolders", enums: null, category: "")]
83  ResourceName DestinationPath;
84 
85  [Attribute("$ArmaReforger:", UIWidgets.EditBox, "File system in which new script will be created.", "")]
86  string ScriptAddon;
87 
88  [Attribute("true", UIWidgets.CheckBox, "When true, widget is resolved with FindWidget() in generated code. When false, widget is resolved with FindAnyWidget().")]
89  bool GenerateFullWidgetPath;
90 
91  [Attribute("SCR_", UIWidgets.EditBox, "Prefix which will be added to the name of the generated class")]
92  string ScriptClassNamePrefix;
93 
94  [Attribute("Widgets", UIWidgets.EditBox, "Suffix which will be added to the name of the generated class")]
95  string ScriptClassNameSuffix;
96 
97 #ifdef WORKBENCH
98 
99  //------------------------------------------------------------------------------------------------
100  static BaseContainer FindInWidgetSource(WidgetSource ws)
101  {
102  if (!ws)
103  return null;
104 
105  BaseContainerList components = ws.GetObjectArray("components");
106  typename compTypename;
107  BaseContainer comp;
108  for (int i, count = components.Count(); i < count; i++)
109  {
110  comp = components.Get(i);
111  compTypename = comp.GetClassName().ToType();
112  if (compTypename && compTypename.IsInherited(SCR_WidgetExportRuleRoot))
113  return comp;
114  }
115 
116  return null;
117  }
118 
119  //------------------------------------------------------------------------------------------------
120  static ResourceName GetDestinationPath(BaseContainer container)
121  {
122  ResourceName outVar;
123  container.Get("DestinationPath", outVar);
124  return outVar;
125  }
126 
127  //------------------------------------------------------------------------------------------------
128  static string GetScriptAddon(BaseContainer container)
129  {
130  string outVar;
131  container.Get("ScriptAddon", outVar);
132  return outVar;
133  }
134 
135  //------------------------------------------------------------------------------------------------
136  static bool GetGenerateFullWidgetPath(BaseContainer container)
137  {
138  bool outVar;
139  container.Get("GenerateFullWidgetPath", outVar);
140  return outVar;
141  }
142 
143  //------------------------------------------------------------------------------------------------
144  static void GetClassPrefixAndSuffix(BaseContainer container, out string prefix, out string suffix)
145  {
146  container.Get("ScriptClassNamePrefix", prefix);
147  container.Get("ScriptClassNameSuffix", suffix);
148  }
149 
150 #endif // WORKBENCH
151 }
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_WidgetExportRule
Definition: SCR_WidgetExportRule.c:5
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180