7 protected TextWidget m_wSpecializationText;
8 protected ImageWidget m_wSpecializationCoreImage;
9 protected ImageWidget m_wSpecializationBackgroundImage;
10 protected ImageWidget m_wSpecializationBorderImage;
12 protected ImageWidget m_wChangeSpLeft;
13 protected ImageWidget m_wChangeSpRight;
14 protected Widget m_wChangeSpLeftLayout;
15 protected Widget m_wChangeSpRightLayout;
17 protected int m_ibuttonId;
20 protected bool m_bIsActive;
22 [
Attribute(
"0 0 0 1", UIWidgets.ColorPicker)]
23 protected ref Color m_ColorInactive;
25 [
Attribute(
"0 0 0 0.5", UIWidgets.ColorPicker)]
26 protected ref Color m_ColorInactiveHovered;
28 [
Attribute(
"0.898 0.541 0.184 1", UIWidgets.ColorPicker)]
29 protected ref Color m_ColorActive;
31 [
Attribute(
"1 1 1 1", UIWidgets.ColorPicker)]
32 protected ref Color m_ColorBackgroundInactive;
34 [
Attribute(
"0 0 0 1", UIWidgets.ColorPicker)]
35 protected ref Color m_ColorBackgroundActive;
37 [
Attribute(
"{FDD5423E69D007F8}UI/Textures/Icons/icons_wrapperUI-128.imageset", UIWidgets.ResourcePickerThumbnail)]
38 protected ResourceName m_TextureLegendButton;
41 protected string m_StringCoreImageLegendButton;
44 protected string m_StringBackgroundImageLegendButton;
47 protected string m_StringNotSelectedImageLegendButton;
50 protected string m_StringSelectedImageLegendButton;
63 [
Attribute(
"{3093C92AE673BC5E}UI/Textures/Workshop/PagingArrow_UI.edds", UIWidgets.ResourcePickerThumbnail)]
64 protected ResourceName m_PagingArrow;
66 protected bool m_bLeftAndRightUI;
69 protected ref ScriptInvoker m_OnClicked =
new ScriptInvoker();
70 protected ref ScriptInvoker m_OnMouseEnter =
new ScriptInvoker();
71 protected ref ScriptInvoker m_OnMouseLeave =
new ScriptInvoker();
74 protected override void HandlerAttached(Widget w)
76 super.HandlerAttached(w);
78 m_wSpecializationText = TextWidget.Cast(w.FindAnyWidget(
"SpecializationText"));
79 if (m_wSpecializationText)
81 m_wSpecializationText.SetText(m_sSpecializationText);
82 m_wSpecializationText.SetColor(m_ColorInactive);
85 m_wSpecializationCoreImage = ImageWidget.Cast(w.FindAnyWidget(
"SpecializationCoreImage"));
86 m_wSpecializationBorderImage = ImageWidget.Cast(w.FindAnyWidget(
"SpecializationBorderImage"));
87 m_wSpecializationBackgroundImage = ImageWidget.Cast(w.FindAnyWidget(
"SpecializationBackgroundImage"));
88 if (m_wSpecializationCoreImage && m_wSpecializationBorderImage && m_wSpecializationBackgroundImage)
90 SetTexture(m_wSpecializationCoreImage, m_TextureLegendButton, m_StringCoreImageLegendButton+
"1");
91 SetTexture(m_wSpecializationBorderImage, m_TextureLegendButton, m_StringNotSelectedImageLegendButton);
92 SetTexture(m_wSpecializationBackgroundImage, m_TextureLegendButton, m_StringBackgroundImageLegendButton);
93 m_wSpecializationCoreImage.SetColor(m_ColorInactive);
94 m_wSpecializationBorderImage.SetColor(m_ColorInactive);
95 m_wSpecializationBackgroundImage.SetColor(m_ColorBackgroundInactive);
98 m_wChangeSpLeftLayout = Widget.Cast(w.FindAnyWidget(
"ChangeSpLeftSizeLayout"));
99 m_wChangeSpLeft = ImageWidget.Cast(w.FindAnyWidget(
"ChangeSpLeft"));
100 m_wChangeSpRight = ImageWidget.Cast(w.FindAnyWidget(
"ChangeSpRight"));
101 m_wChangeSpRightLayout = Widget.Cast(w.FindAnyWidget(
"ChangeSpRightSizeLayout"));
104 m_bLeftAndRightUI =
false;
106 if (m_wChangeSpLeft && m_wChangeSpRight && m_wChangeSpLeftLayout && m_wChangeSpRightLayout)
112 SetTexture(m_wChangeSpLeft, m_PagingArrow);
113 SetTexture(m_wChangeSpRight, m_PagingArrow);
115 m_wChangeSpLeft.SetColor(m_ColorActive);
116 m_wChangeSpRight.SetColor(m_ColorActive);
117 m_wChangeSpLeftLayout.SetVisible(
false);
118 m_wChangeSpRightLayout.SetVisible(
false);
123 ScriptInvoker GetOnClicked()
129 ScriptInvoker GetOnMouseEnter()
135 ScriptInvoker GetOnMouseLeave()
141 protected override bool OnClick(Widget w,
int x,
int y,
int button)
143 super.OnClick(w, x, y, button);
153 override bool OnFocus(Widget w,
int x,
int y)
156 return OnClick(w, x, y, 0);
160 protected override bool OnMouseEnter(Widget w,
int x,
int y)
162 super.OnMouseEnter(w, x, y);
169 protected override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
171 super.OnMouseLeave(w, enterW, x, y);
178 void Activate(
bool animate =
true,
bool playsound =
true)
189 if (m_wSpecializationCoreImage)
190 AnimateWidget.Color(m_wSpecializationCoreImage, m_ColorActive, m_fAnimationRate);
192 if (m_wSpecializationBorderImage)
193 AnimateWidget.Color(m_wSpecializationBorderImage, m_ColorActive, m_fAnimationRate);
195 if (m_wSpecializationBackgroundImage)
196 AnimateWidget.Color(m_wSpecializationBackgroundImage, m_ColorBackgroundActive, m_fAnimationRate);
198 if (m_wSpecializationText)
199 AnimateWidget.Color(m_wSpecializationText, m_ColorActive, m_fAnimationRate);
203 if (m_wSpecializationCoreImage)
205 AnimateWidget.StopAnimation(m_wSpecializationCoreImage, WidgetAnimationColor);
206 m_wSpecializationCoreImage.SetColor(m_ColorActive);
209 if (m_wSpecializationBorderImage)
211 AnimateWidget.StopAnimation(m_wSpecializationBorderImage, WidgetAnimationColor);
212 m_wSpecializationBorderImage.SetColor(m_ColorActive);
213 SetTexture(m_wSpecializationBorderImage, m_TextureLegendButton, m_StringSelectedImageLegendButton);
216 if (m_wSpecializationBackgroundImage)
218 AnimateWidget.StopAnimation(m_wSpecializationBackgroundImage, WidgetAnimationColor);
219 m_wSpecializationBackgroundImage.SetColor(m_ColorBackgroundActive);
222 if (m_wSpecializationText)
224 AnimateWidget.StopAnimation(m_wSpecializationText, WidgetAnimationColor);
225 m_wSpecializationText.SetColor(m_ColorActive);
229 if (m_bLeftAndRightUI && m_wChangeSpLeft && m_wChangeSpRight && m_wChangeSpLeftLayout && m_wChangeSpRightLayout)
231 m_wChangeSpLeftLayout.SetVisible(
true);
232 m_wChangeSpRightLayout.SetVisible(
true);
237 void Deactivate(
bool animate =
true,
bool playsound =
true)
248 if (m_wSpecializationCoreImage)
249 AnimateWidget.Color(m_wSpecializationCoreImage, m_ColorInactive, m_fAnimationRate);
251 if (m_wSpecializationBorderImage)
252 AnimateWidget.Color(m_wSpecializationBorderImage, m_ColorInactive, m_fAnimationRate);
254 if (m_wSpecializationBackgroundImage)
255 AnimateWidget.Color(m_wSpecializationBackgroundImage, m_ColorBackgroundInactive, m_fAnimationRate);
257 if (m_wSpecializationText)
258 AnimateWidget.Color(m_wSpecializationText, m_ColorInactive, m_fAnimationRate);
262 if (m_wSpecializationCoreImage)
264 AnimateWidget.StopAnimation(m_wSpecializationCoreImage, WidgetAnimationColor);
265 m_wSpecializationCoreImage.SetColor(m_ColorInactive);
268 if (m_wSpecializationBorderImage)
270 AnimateWidget.StopAnimation(m_wSpecializationBorderImage, WidgetAnimationColor);
271 m_wSpecializationBorderImage.SetColor(m_ColorInactive);
272 SetTexture(m_wSpecializationBorderImage, m_TextureLegendButton, m_StringNotSelectedImageLegendButton);
275 if (m_wSpecializationBackgroundImage)
277 AnimateWidget.StopAnimation(m_wSpecializationBackgroundImage, WidgetAnimationColor);
278 m_wSpecializationCoreImage.SetColor(m_ColorBackgroundInactive);
281 if (m_wSpecializationText)
283 AnimateWidget.StopAnimation(m_wSpecializationText, WidgetAnimationColor);
284 m_wSpecializationText.SetColor(m_ColorInactive);
288 if (m_wChangeSpLeft && m_wChangeSpRight && m_wChangeSpLeftLayout && m_wChangeSpRightLayout)
290 m_wChangeSpLeftLayout.SetVisible(
false);
291 m_wChangeSpRightLayout.SetVisible(
false);
296 void SetOnHover(
bool OnHover =
true)
303 if (m_wSpecializationCoreImage)
304 AnimateWidget.Color(m_wSpecializationCoreImage, m_ColorInactiveHovered, m_fAnimationRate);
306 if (m_wSpecializationBorderImage)
307 AnimateWidget.Color(m_wSpecializationBorderImage, m_ColorInactiveHovered, m_fAnimationRate);
309 if (m_wSpecializationText)
310 AnimateWidget.Color(m_wSpecializationText, m_ColorInactiveHovered, m_fAnimationRate);
314 if (m_wSpecializationCoreImage)
315 AnimateWidget.Color(m_wSpecializationCoreImage, m_ColorInactive, m_fAnimationRate);
317 if (m_wSpecializationBorderImage)
318 AnimateWidget.Color(m_wSpecializationBorderImage, m_ColorInactive, m_fAnimationRate);
320 if (m_wSpecializationText)
321 AnimateWidget.Color(m_wSpecializationText, m_ColorInactive, m_fAnimationRate);
343 void SetText(
string text)
345 if (!m_wSpecializationText)
348 if (m_sSpecializationText == text)
351 m_sSpecializationText = text;
352 m_wSpecializationText.SetText(text);
358 return m_sSpecializationText;
362 TextWidget GetTextWidget()
364 return m_wSpecializationText;
368 ImageWidget GetCoreImageWidget()
370 return m_wSpecializationCoreImage;
374 ImageWidget GetBorderImageWidget()
376 return m_wSpecializationBorderImage;
380 ImageWidget GetChangeSpLeftImageWidget()
382 return m_wChangeSpLeft;
386 ImageWidget GetChangeSpRightImageWidget()
388 return m_wChangeSpRight;
392 bool GetLeftAndRightSelectedUI()
394 return m_bLeftAndRightUI;
397 void SetLeftAndRightUIActivate(
bool flag)
399 m_bLeftAndRightUI = flag;
403 void SetButtonId(
int n)
405 if (m_wSpecializationCoreImage)
406 SetTexture(m_wSpecializationCoreImage, m_TextureLegendButton, m_StringCoreImageLegendButton+(n+1));
413 WorkspaceWidget workspace =
GetGame().GetWorkspace();
417 GetGame().GetCallqueue().CallLater(workspace.SetFocusedWidget, 1000,
false,
m_wRoot,
true);