Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MapMarkerEntryMilitary.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
5 {
6  [Attribute("AR-MapMarker_Military", desc: "Description in selection menu")]
7  protected string m_sMenuDescription;
8 
9  [Attribute("{3262679C50EF4F01}UI/Textures/Icons/icons_wrapperUI.imageset", UIWidgets.ResourcePickerThumbnail, desc: "Imageset resource", params: "imageset")]
10  protected ResourceName m_sMenuImageset;
11 
12  [Attribute("unknown_faction", desc: "Imageset icon")]
13  protected string m_sMenuIcon;
14 
15  [Attribute(desc: "Predefined marker factions")]
16  protected ref array<ref SCR_MarkerMilitaryFactionEntry> m_aMilitaryFactionEntries;
17 
18  [Attribute(desc: "Military dimension defines")]
19  protected ref array<ref SCR_MarkerMilitaryDimension> m_aMilitaryDimensions;
20 
21  [Attribute(desc: "Military type defines")]
22  protected ref array<ref SCR_MarkerMilitaryType> m_aMilitaryTypes;
23 
24  const int FACTION_DETERMINATOR = 100;
25  const float DIMENSION_DETERMINATOR = 0.01;
26 
27  //------------------------------------------------------------------------------------------------
28  string GetMenuDescription()
29  {
31  }
32 
33  //------------------------------------------------------------------------------------------------
34  ResourceName GetMenuImageset()
35  {
37  }
38 
39  //------------------------------------------------------------------------------------------------
40  string GetMenuIcon()
41  {
42  return m_sMenuIcon;
43  }
44 
45  //------------------------------------------------------------------------------------------------
46  array<ref SCR_MarkerMilitaryFactionEntry> GetMilitaryFactionEntries()
47  {
49  }
50 
51  //------------------------------------------------------------------------------------------------
52  SCR_MarkerMilitaryFactionEntry GetFactionEntry(int i)
53  {
54  if (!m_aMilitaryFactionEntries.IsIndexValid(i))
55  return null;
56 
58  }
59 
60  //------------------------------------------------------------------------------------------------
61  int GetFactionEntryID(EMilitarySymbolIdentity faction)
62  {
63  foreach (int id, SCR_MarkerMilitaryFactionEntry entry : m_aMilitaryFactionEntries)
64  {
65  if (entry.GetFactionIdentity() == faction)
66  return id;
67  }
68 
69  return -1;
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  array<ref SCR_MarkerMilitaryDimension> GetMilitaryDimensions()
74  {
76  }
77 
78  //------------------------------------------------------------------------------------------------
79  SCR_MarkerMilitaryDimension GetDimensionEntry(int i)
80  {
81  if (!m_aMilitaryDimensions.IsIndexValid(i))
82  return null;
83 
85  }
86 
87  //------------------------------------------------------------------------------------------------
88  int GetDimensionEntryID(EMilitarySymbolDimension dimension)
89  {
90  foreach (int id, SCR_MarkerMilitaryDimension entry : m_aMilitaryDimensions)
91  {
92  if (entry.GetDimension() == dimension)
93  return id;
94  }
95 
96  return -1;
97  }
98 
99  //------------------------------------------------------------------------------------------------
100  array<ref SCR_MarkerMilitaryType> GetMilitaryTypes()
101  {
103  }
104 
105  //------------------------------------------------------------------------------------------------
106  SCR_MarkerMilitaryType GetTypeEntry(int i)
107  {
108  if (!m_aMilitaryTypes.IsIndexValid(i))
109  return null;
110 
111  return m_aMilitaryTypes[i];
112  }
113 
114  //------------------------------------------------------------------------------------------------
115  override SCR_EMapMarkerType GetMarkerType()
116  {
117  return SCR_EMapMarkerType.PLACED_MILITARY;
118  }
119 
120  //------------------------------------------------------------------------------------------------
121  override void InitClientSettings(SCR_MapMarkerBase marker, SCR_MapMarkerWidgetComponent widgetComp)
122  {
123  super.InitClientSettings(marker, widgetComp);
124 
125  widgetComp.SetEventListening(true);
126  widgetComp.SetMilitarySymbolMode(true);
127 
128  array<ref SCR_MarkerMilitaryFactionEntry> milFactionEntries = GetMilitaryFactionEntries();
129  array<ref SCR_MarkerMilitaryDimension> milDimensions = GetMilitaryDimensions();
130  array<ref SCR_MarkerMilitaryType> milTypes = GetMilitaryTypes();
131 
132  int factionID = marker.GetMarkerConfigID() % FACTION_DETERMINATOR;
133  int dimensionID = marker.GetMarkerConfigID() * DIMENSION_DETERMINATOR;
134 
135  if (!milFactionEntries.IsIndexValid(factionID) || !milDimensions.IsIndexValid(dimensionID))
136  return;
137 
138  SCR_MilitarySymbol milSymbol = new SCR_MilitarySymbol();
139  SCR_MarkerMilitaryFactionEntry factionEntry = milFactionEntries[factionID];
140  milSymbol.SetIdentity(factionEntry.GetFactionIdentity());
141  milSymbol.SetDimension(milDimensions[dimensionID].GetDimension());
142  milSymbol.SetIcons(marker.GetFlags());
143 
144  widgetComp.UpdateMilitarySymbol(milSymbol);
145  widgetComp.SetColor(factionEntry.GetColor());
146  widgetComp.SetText(marker.GetCustomText());
147 
148 
149  widgetComp.SetTypeIcon(1, milDimensions[dimensionID].GetTranslation());
150 
151  int typeFlags = marker.GetFlags();
152  if (typeFlags == 0)
153  return;
154 
155  bool secondType;
156  foreach (SCR_MarkerMilitaryType type : milTypes)
157  {
158  if (typeFlags & type.GetType())
159  {
160  if (secondType)
161  {
162  widgetComp.SetTypeIcon(3, type.GetTranslation());
163  return;
164  }
165  else
166  {
167  widgetComp.SetTypeIcon(2, type.GetTranslation());
168  if (typeFlags == type.GetType()) // return if singular flag
169  return;
170 
171  secondType = true;
172  }
173  }
174  }
175  }
176 
177  //------------------------------------------------------------------------------------------------
178  override void OnMapLayerChanged(notnull SCR_MapMarkerWidgetComponent widgetComp, int layerID)
179  {
180  if (layerID > 1)
181  {
182  widgetComp.SetTextVisible(false);
183  }
184  else
185  {
186  widgetComp.SetTextVisible(true);
187  }
188  }
189 }
190 
191 //------------------------------------------------------------------------------------------------
194 class SCR_MarkerMilitaryDimension
195 {
196  [Attribute("", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EMilitarySymbolDimension))]
197  protected EMilitarySymbolDimension m_eDimension;
198 
199  [Attribute("", desc: "Translation in UI")]
200  protected string m_sTranslation;
201 
202  //------------------------------------------------------------------------------------------------
203  EMilitarySymbolDimension GetDimension()
204  {
205  return m_eDimension;
206  }
207 
208  //------------------------------------------------------------------------------------------------
209  string GetTranslation()
210  {
211  return m_sTranslation;
212  }
213 }
214 
215 //------------------------------------------------------------------------------------------------
216 class SCR_MapMarkerMilitaryDimensionTitle: BaseContainerCustomTitle
217 {
218  //------------------------------------------------------------------------------------------------
219  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
220  {
221 
222  EMilitarySymbolIcon symbol;
223  source.Get("m_eDimension", symbol);
224 
225  title = typename.EnumToString(EMilitarySymbolDimension, symbol);
226 
227  return true;
228  }
229 }
230 
231 //------------------------------------------------------------------------------------------------
234 class SCR_MarkerMilitaryType
235 {
236  [Attribute("", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EMilitarySymbolIcon))]
237  protected EMilitarySymbolIcon m_eType;
238 
239  [Attribute("", desc: "Translation in UI")]
240  protected string m_sTranslation;
241 
242  //------------------------------------------------------------------------------------------------
244  {
245  return m_eType;
246  }
247 
248  //------------------------------------------------------------------------------------------------
249  string GetTranslation()
250  {
251  return m_sTranslation;
252  }
253 }
254 
255 //------------------------------------------------------------------------------------------------
256 class SCR_MapMarkerMilitaryTypeTitle: BaseContainerCustomTitle
257 {
258  //------------------------------------------------------------------------------------------------
259  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
260  {
261 
262  EMilitarySymbolIcon symbol;
263  source.Get("m_eType", symbol);
264 
265  title = typename.EnumToString(EMilitarySymbolIcon, symbol);
266 
267  return true;
268  }
269 }
270 
271 //------------------------------------------------------------------------------------------------
274 class SCR_MarkerMilitaryFactionEntry
275 {
276  [Attribute("0", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(EMilitarySymbolIdentity))]
277  protected EMilitarySymbolIdentity m_FactionIdentity;
278 
279  [Attribute("1.0 1.0 1.0 1.0")]
280  protected ref Color m_FactionColor;
281 
282  [Attribute("{3262679C50EF4F01}UI/Textures/Icons/icons_wrapperUI.imageset", UIWidgets.ResourcePickerThumbnail, desc: "Imageset resource", params: "imageset")]
283  protected ResourceName m_sIconImageset;
284 
285  [Attribute("unknown_faction", desc: "Imageset quad")]
286  protected string m_sIconImagesetQuad;
287 
288  [Attribute("", desc: "Translation in UI")]
289  protected string m_sTranslation;
290 
291  //------------------------------------------------------------------------------------------------
292  EMilitarySymbolIdentity GetFactionIdentity()
293  {
294  return m_FactionIdentity;
295  }
296 
297  //------------------------------------------------------------------------------------------------
298  Color GetColor()
299  {
300  return Color.FromInt(m_FactionColor.PackToInt());
301  }
302 
303  //------------------------------------------------------------------------------------------------
304  void GetIconResource(out ResourceName imageset, out string imageQuad)
305  {
306  imageset = m_sIconImageset;
307  imageQuad = m_sIconImagesetQuad;
308  }
309 
310  //------------------------------------------------------------------------------------------------
311  string GetTranslation()
312  {
313  return m_sTranslation;
314  }
315 }
316 
317 //------------------------------------------------------------------------------------------------
318 class SCR_MapMarkerFactionTitle: BaseContainerCustomTitle
319 {
320  //------------------------------------------------------------------------------------------------
321  override bool _WB_GetCustomTitle(BaseContainer source, out string title)
322  {
323  EMilitarySymbolIdentity faction;
324  source.Get("m_FactionIdentity", faction);
325 
326  title = typename.EnumToString(EMilitarySymbolIdentity, faction);
327 
328  return true;
329  }
330 }
m_sMenuIcon
protected string m_sMenuIcon
Definition: SCR_MapMarkerEntryMilitary.c:9
m_aMilitaryDimensions
protected ref array< ref SCR_MarkerMilitaryDimension > m_aMilitaryDimensions
Definition: SCR_MapMarkerEntryMilitary.c:15
SCR_MilitarySymbol
Definition: SCR_MilitarySymbol.c:2
GetType
override EGadgetType GetType()
Definition: SCR_CampaignBuildingGadgetToolComponent.c:52
m_sMenuDescription
protected string m_sMenuDescription
Definition: SCR_MapMarkerEntryMilitary.c:3
SCR_MapMarkerMilitaryDimensionTitle
Definition: SCR_MapMarkerEntryMilitary.c:216
m_aMilitaryTypes
protected ref array< ref SCR_MarkerMilitaryType > m_aMilitaryTypes
Definition: SCR_MapMarkerEntryMilitary.c:18
SCR_MapMarkerFactionTitle
Definition: SCR_MapMarkerEntryMilitary.c:318
SCR_MapMarkerBase
Definition: SCR_MapMarkerBase.c:3
SCR_MapMarkerMilitaryDimensionTitle
SCR_MapMarkerEntryMilitary SCR_MapMarkerEntryConfig SCR_MapMarkerMilitaryDimensionTitle()] class SCR_MarkerMilitaryDimension
Definition: SCR_MapMarkerEntryMilitary.c:193
SCR_MapMarkerFactionTitle
SCR_MapMarkerMilitaryTypeTitle BaseContainerCustomTitle SCR_MapMarkerFactionTitle()] class SCR_MarkerMilitaryFactionEntry
Definition: SCR_MapMarkerEntryMilitary.c:273
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_MapMarkerTitle
Definition: SCR_MapMarkerEntryPlaced.c:189
SCR_MapMarkerEntryConfig
Base entry config.
Definition: SCR_MapMarkerConfig.c:50
DIMENSION_DETERMINATOR
const float DIMENSION_DETERMINATOR
Definition: SCR_MapMarkerEntryMilitary.c:21
EMilitarySymbolIdentity
EMilitarySymbolIdentity
Definition: EMilitarySymbol.c:1
FACTION_DETERMINATOR
const int FACTION_DETERMINATOR
Definition: SCR_MapMarkerEntryMilitary.c:20
Attribute
typedef Attribute
Post-process effect of scripted camera.
m_aMilitaryFactionEntries
protected ref array< ref SCR_MarkerMilitaryFactionEntry > m_aMilitaryFactionEntries
Definition: SCR_MapMarkerEntryMilitary.c:12
SCR_EMapMarkerType
SCR_EMapMarkerType
Definition: SCR_MapMarkerConfig.c:5
SCR_MapMarkerMilitaryTypeTitle
Definition: SCR_MapMarkerEntryMilitary.c:256
m_sMenuImageset
protected ResourceName m_sMenuImageset
Definition: SCR_MapMarkerEntryMilitary.c:6
m_eType
protected SCR_ECampaignBaseType m_eType
Definition: SCR_CampaignMilitaryBaseComponent.c:59
GetColor
Color GetColor()
Definition: SCR_EditableCommentComponent.c:52
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
SCR_MapMarkerEntryMilitary
Marker military symbol entry.
Definition: SCR_MapMarkerEntryMilitary.c:4
EMilitarySymbolDimension
EMilitarySymbolDimension
Definition: EMilitarySymbol.c:14
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
SCR_MapMarkerWidgetComponent
Definition: SCR_MapMarkerWidgetComponent.c:3
BaseContainerProps
SCR_MapMarkerEntryMilitary SCR_MapMarkerEntryConfig BaseContainerProps()
Marker military dimension.
SCR_MapMarkerMilitaryTypeTitle
SCR_MapMarkerMilitaryDimensionTitle BaseContainerCustomTitle SCR_MapMarkerMilitaryTypeTitle()] class SCR_MarkerMilitaryType
Definition: SCR_MapMarkerEntryMilitary.c:233
EMilitarySymbolIcon
EMilitarySymbolIcon
Definition: EMilitarySymbol.c:29