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";
9 protected bool m_bIsEventListening;
10 protected bool m_bIsSymbolMode;
11 protected bool m_bIsOwnerMode;
12 protected int m_iLayerID;
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;
29 protected ref Color m_GlowDefault = Color.FromSRGBA(21, 29, 32, 155);
30 protected ref Color m_GlowSelected = Color.FromSRGBA(226, 168, 79, 155);
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);
40 m_MarkerObject = marker;
45 void SetLayerID(
int id)
52 void SetRotation(
float angle)
54 m_wMarkerIcon.SetRotation(angle);
55 m_wMarkerGlowIcon.SetRotation(angle);
63 void SetImage(ResourceName icon,
string quad,
float aspectRatio = 1)
65 m_wMarkerIcon.LoadImageFromSet(0, icon, quad);
66 if (aspectRatio != 1 && aspectRatio != 0)
68 vector size = m_wMarkerIcon.GetSize();
69 m_wMarkerIcon.SetSize(size[0] * 0.9, (size[1] * (1/aspectRatio)) * 0.9);
76 void SetGlowImage(ResourceName icon,
string quad)
78 m_wMarkerGlowIcon.SetVisible(
true);
79 m_wMarkerGlowIcon.LoadImageFromSet(0, icon, quad);
85 void SetMilitarySymbolMode(
bool state)
87 m_bIsSymbolMode = state;
89 m_wSymbolRoot.SetEnabled(state);
90 m_wSymbolRoot.SetVisible(state);
92 m_wMarkerIcon.SetVisible(!state);
97 void SetEventListening(
bool state)
99 m_bIsEventListening = state;
109 symbolComp.Update(milSymbol);
114 void SetText(
string text)
116 m_wMarkerText.SetText(text);
121 void SetTextVisible(
bool state)
123 m_wMarkerText.SetVisible(state);
128 void SetTypeIcon(
int type,
string text)
132 m_wTypeIcon1.SetText(text);
133 m_wTypeOverlay1.SetVisible(
true);
137 m_wTypeIcon2.SetText(text);
138 m_wTypeOverlay2.SetVisible(
true);
142 m_wTypeIcon3.SetText(text);
143 m_wTypeOverlay3.SetVisible(
true);
149 void SetTypeIconsVisible(
bool state)
151 m_wTypeIconRoot.SetVisible(state);
156 void SetAuthor(
string text)
158 m_bIsOwnerMode =
false;
160 m_wMarkerAuthor.SetText(text);
165 void SetAuthorVisible(
bool state)
168 m_wMarkerModeIcon.SetVisible(state);
170 m_wMarkerAuthor.SetVisible(state);
176 void SetModeIcon(
bool state,
bool isPublic)
178 m_bIsOwnerMode =
true;
181 m_wMarkerModeIcon.LoadImageFromSet(0, IMAGE_SET, PUBLIC_QUAD);
183 m_wMarkerModeIcon.LoadImageFromSet(0, IMAGE_SET, PRIVATE_QUAD);
188 void SetModeIconVisible(
bool state)
190 m_wMarkerModeIcon.SetVisible(state);
195 void SetColor(Color color)
197 m_CurrentImageColor = color;
200 m_wSymbolOverlay.SetColor(color);
202 m_wMarkerIcon.SetColor(color);
204 m_wMarkerText.SetColor(m_TextColor);
205 m_wMarkerAuthor.SetColor(m_TextColor);
209 override bool OnMouseEnter(Widget w,
int x,
int y)
211 if (!m_bIsEventListening || !m_MarkerObject)
214 m_MarkerObject.LayerChangeLogic(0);
216 SetAuthorVisible(
true);
217 SetTypeIconsVisible(
true);
223 m_wSymbolOverlay.SetColor(GUIColors.ORANGE);
225 m_wMarkerGlowIcon.SetColor(m_GlowSelected);
231 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
233 if (!m_bIsEventListening || !m_MarkerObject)
236 m_MarkerObject.LayerChangeLogic(m_iLayerID);
238 SetAuthorVisible(
false);
239 SetTypeIconsVisible(
false);
245 m_wSymbolOverlay.SetColor(m_CurrentImageColor);
247 m_wMarkerGlowIcon.SetColor(m_GlowDefault);
253 override void HandlerAttached(Widget w)
255 super.HandlerAttached(w);
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"));