Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_MapMarkerWidgetComponent.c
Go to the documentation of this file.
4 {
5  protected const ResourceName IMAGE_SET = "{3262679C50EF4F01}UI/Textures/Icons/icons_wrapperUI.imageset";
6  protected const string PRIVATE_QUAD = "private";
7  protected const string PUBLIC_QUAD = "public";
8 
9  protected bool m_bIsEventListening; // whether this marker reacts to events
10  protected bool m_bIsSymbolMode; // app-6 symbol visualization mode
11  protected bool m_bIsOwnerMode; // player is the markers owner
12  protected int m_iLayerID; // map layer ID
13 
14  protected ImageWidget m_wMarkerIcon;
15  protected ImageWidget m_wMarkerGlowIcon;
16  protected ImageWidget m_wMarkerModeIcon;
17  protected TextWidget m_wMarkerText;
18  protected TextWidget m_wMarkerAuthor;
19  protected TextWidget m_wTypeIcon1;
20  protected TextWidget m_wTypeIcon2;
21  protected TextWidget m_wTypeIcon3;
22  protected Widget m_wSymbolRoot;
23  protected Widget m_wSymbolOverlay;
24  protected Widget m_wTypeIconRoot;
25  protected Widget m_wTypeOverlay1;
26  protected Widget m_wTypeOverlay2;
27  protected Widget m_wTypeOverlay3;
28 
29  protected ref Color m_GlowDefault = Color.FromSRGBA(21, 29, 32, 155);
30  protected ref Color m_GlowSelected = Color.FromSRGBA(226, 168, 79, 155);
31 
32  protected ref Color m_TextColor = new Color(0.0, 0.0, 0.0, 1.0);
33  protected ref Color m_CurrentImageColor = new Color(0.0, 0.0, 0.0, 1.0);
34  protected SCR_MapMarkerBase m_MarkerObject;
35 
36  //------------------------------------------------------------------------------------------------
38  void SetMarkerObject(notnull SCR_MapMarkerBase marker)
39  {
40  m_MarkerObject = marker;
41  }
42 
43  //------------------------------------------------------------------------------------------------
45  void SetLayerID(int id)
46  {
47  m_iLayerID = id;
48  }
49 
50  //------------------------------------------------------------------------------------------------
52  void SetRotation(float angle)
53  {
54  m_wMarkerIcon.SetRotation(angle);
55  m_wMarkerGlowIcon.SetRotation(angle);
56  }
57 
58  //------------------------------------------------------------------------------------------------
63  void SetImage(ResourceName icon, string quad, float aspectRatio = 1)
64  {
65  m_wMarkerIcon.LoadImageFromSet(0, icon, quad);
66  if (aspectRatio != 1 && aspectRatio != 0)
67  {
68  vector size = m_wMarkerIcon.GetSize();
69  m_wMarkerIcon.SetSize(size[0] * 0.9, (size[1] * (1/aspectRatio)) * 0.9); // todo, temp size adjust before symbols group side are fixed
70  }
71  }
72 
73  //------------------------------------------------------------------------------------------------
76  void SetGlowImage(ResourceName icon, string quad)
77  {
78  m_wMarkerGlowIcon.SetVisible(true);
79  m_wMarkerGlowIcon.LoadImageFromSet(0, icon, quad);
80  }
81 
82  //------------------------------------------------------------------------------------------------
85  void SetMilitarySymbolMode(bool state)
86  {
87  m_bIsSymbolMode = state;
88 
89  m_wSymbolRoot.SetEnabled(state);
90  m_wSymbolRoot.SetVisible(state);
91 
92  m_wMarkerIcon.SetVisible(!state);
93  }
94 
95  //------------------------------------------------------------------------------------------------
97  void SetEventListening(bool state)
98  {
99  m_bIsEventListening = state;
100  }
101 
102  //------------------------------------------------------------------------------------------------
105  void UpdateMilitarySymbol(SCR_MilitarySymbol milSymbol)
106  {
107  SCR_MilitarySymbolUIComponent symbolComp = SCR_MilitarySymbolUIComponent.Cast(m_wSymbolOverlay.FindHandler(SCR_MilitarySymbolUIComponent));
108  if (symbolComp)
109  symbolComp.Update(milSymbol);
110  }
111 
112  //------------------------------------------------------------------------------------------------
114  void SetText(string text)
115  {
116  m_wMarkerText.SetText(text);
117  }
118 
119  //------------------------------------------------------------------------------------------------
121  void SetTextVisible(bool state)
122  {
123  m_wMarkerText.SetVisible(state);
124  }
125 
126  //------------------------------------------------------------------------------------------------
128  void SetTypeIcon(int type, string text)
129  {
130  if (type == 1)
131  {
132  m_wTypeIcon1.SetText(text);
133  m_wTypeOverlay1.SetVisible(true);
134  }
135  else if (type == 2)
136  {
137  m_wTypeIcon2.SetText(text);
138  m_wTypeOverlay2.SetVisible(true);
139  }
140  else if (type == 3)
141  {
142  m_wTypeIcon3.SetText(text);
143  m_wTypeOverlay3.SetVisible(true);
144  }
145  }
146 
147  //------------------------------------------------------------------------------------------------
149  void SetTypeIconsVisible(bool state)
150  {
151  m_wTypeIconRoot.SetVisible(state);
152  }
153 
154  //------------------------------------------------------------------------------------------------
156  void SetAuthor(string text)
157  {
158  m_bIsOwnerMode = false;
159 
160  m_wMarkerAuthor.SetText(text);
161  }
162 
163  //------------------------------------------------------------------------------------------------
165  void SetAuthorVisible(bool state)
166  {
167  if (m_bIsOwnerMode)
168  m_wMarkerModeIcon.SetVisible(state);
169  else
170  m_wMarkerAuthor.SetVisible(state);
171  }
172 
173  //------------------------------------------------------------------------------------------------
176  void SetModeIcon(bool state, bool isPublic)
177  {
178  m_bIsOwnerMode = true;
179 
180  if (isPublic)
181  m_wMarkerModeIcon.LoadImageFromSet(0, IMAGE_SET, PUBLIC_QUAD);
182  else
183  m_wMarkerModeIcon.LoadImageFromSet(0, IMAGE_SET, PRIVATE_QUAD);
184  }
185 
186  //------------------------------------------------------------------------------------------------
188  void SetModeIconVisible(bool state)
189  {
190  m_wMarkerModeIcon.SetVisible(state);
191  }
192 
193  //------------------------------------------------------------------------------------------------
195  void SetColor(Color color)
196  {
197  m_CurrentImageColor = color;
198 
199  if (m_bIsSymbolMode)
200  m_wSymbolOverlay.SetColor(color);
201  else
202  m_wMarkerIcon.SetColor(color);
203 
204  m_wMarkerText.SetColor(m_TextColor);
205  m_wMarkerAuthor.SetColor(m_TextColor);
206  }
207 
208  //------------------------------------------------------------------------------------------------
209  override bool OnMouseEnter(Widget w, int x, int y)
210  {
211  if (!m_bIsEventListening || !m_MarkerObject)
212  return false;
213 
214  m_MarkerObject.LayerChangeLogic(0);
215 
216  SetAuthorVisible(true);
217  SetTypeIconsVisible(true);
218 
219  if (!SCR_MapMarkersUI.IsOwnedMarker(m_MarkerObject))
220  return false;
221 
222  if (m_bIsSymbolMode)
223  m_wSymbolOverlay.SetColor(GUIColors.ORANGE);
224  else
225  m_wMarkerGlowIcon.SetColor(m_GlowSelected);
226 
227  return true;
228  }
229 
230  //------------------------------------------------------------------------------------------------
231  override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
232  {
233  if (!m_bIsEventListening || !m_MarkerObject)
234  return false;
235 
236  m_MarkerObject.LayerChangeLogic(m_iLayerID);
237 
238  SetAuthorVisible(false);
239  SetTypeIconsVisible(false);
240 
241  if (!SCR_MapMarkersUI.IsOwnedMarker(m_MarkerObject))
242  return false;
243 
244  if (m_bIsSymbolMode)
245  m_wSymbolOverlay.SetColor(m_CurrentImageColor);
246  else
247  m_wMarkerGlowIcon.SetColor(m_GlowDefault);
248 
249  return true;
250  }
251 
252  //------------------------------------------------------------------------------------------------
253  override void HandlerAttached(Widget w)
254  {
255  super.HandlerAttached(w);
256 
257  m_wMarkerIcon = ImageWidget.Cast(m_wRoot.FindAnyWidget("MarkerIcon"));
258  m_wMarkerGlowIcon = ImageWidget.Cast(m_wRoot.FindAnyWidget("MarkerIconGlow"));
259  m_wMarkerText = TextWidget.Cast(m_wRoot.FindAnyWidget("MarkerText"));
260  m_wMarkerAuthor = TextWidget.Cast(m_wRoot.FindAnyWidget("MarkerAuthor"));
261  m_wMarkerModeIcon = ImageWidget.Cast(m_wRoot.FindAnyWidget("MarkerModeIcon"));
262  m_wSymbolRoot = m_wRoot.FindAnyWidget("SymbolWidget");
263  m_wSymbolOverlay = m_wSymbolRoot.FindAnyWidget("SymbolOverlay");
264  m_wTypeIconRoot = m_wRoot.FindAnyWidget("TypeIconHLayout");
265  m_wTypeOverlay1 = m_wTypeIconRoot.FindAnyWidget("TypeOverlay1");
266  m_wTypeOverlay2 = m_wTypeIconRoot.FindAnyWidget("TypeOverlay2");
267  m_wTypeOverlay3 = m_wTypeIconRoot.FindAnyWidget("TypeOverlay3");
268  m_wTypeIcon1 = TextWidget.Cast(m_wTypeIconRoot.FindAnyWidget("TypeText1"));
269  m_wTypeIcon2 = TextWidget.Cast(m_wTypeIconRoot.FindAnyWidget("TypeText2"));
270  m_wTypeIcon3 = TextWidget.Cast(m_wTypeIconRoot.FindAnyWidget("TypeText3"));
271  }
272 }
SCR_MilitarySymbol
Definition: SCR_MilitarySymbol.c:2
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_MapMarkerBase
Definition: SCR_MapMarkerBase.c:3
SCR_MapMarkersUI
Markers UI map component.
Definition: SCR_MapMarkersUI.c:6
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
SCR_MapMarkerWidgetComponent
Definition: SCR_MapMarkerWidgetComponent.c:3
SCR_ScriptedWidgetComponent
Definition: SCR_ScriptedWidgetComponent.c:7
SCR_MilitarySymbolUIComponent
Definition: SCR_MilitarySymbolUIComponent.c:1