4 protected string m_sTitle;
7 protected string m_sDescription;
10 protected float m_fAnimationTime;
12 [
Attribute(
"{C58FCC06AF13075B}UI/Textures/MissionLoadingScreens/placeholder_1.edds", UIWidgets.ResourceNamePicker,
"",
"edds")]
13 protected ResourceName m_sImageDefault;
15 [
Attribute(
"{C58FCC06AF13075B}UI/Textures/MissionLoadingScreens/placeholder_1.edds", UIWidgets.ResourceNamePicker,
"",
"edds")]
16 protected ResourceName m_sImageSelected;
18 [
Attribute(
"", UIWidgets.ResourceNamePicker,
"",
"")]
19 protected ResourceName m_sIconTexture;
22 protected string m_sIconImage;
34 protected string m_sDefaultWidgetName;
37 protected string m_sSelectedWidgetName;
40 protected string m_sIconImageName;
42 protected Widget m_wRoot;
43 protected ImageWidget m_wImageDefault;
44 protected ImageWidget m_wImageSelected;
45 protected ImageWidget m_wIcon;
46 protected TextWidget m_wTitle;
47 protected TextWidget m_wDescription;
48 protected float m_fAnimationRate = 10000;
50 ref ScriptInvoker m_OnFocused =
new ScriptInvoker();
51 ref ScriptInvoker m_OnFocusLost =
new ScriptInvoker();
52 ref ScriptInvoker m_OnClicked =
new ScriptInvoker();
55 override void HandlerAttached(Widget w)
58 m_wImageDefault = ImageWidget.Cast(w.FindAnyWidget(m_sDefaultWidgetName));
59 m_wImageSelected = ImageWidget.Cast(w.FindAnyWidget(m_sSelectedWidgetName));
60 m_wIcon = ImageWidget.Cast(w.FindAnyWidget(m_sIconImageName));
61 m_wTitle = TextWidget.Cast(w.FindAnyWidget(m_sTitleName));
62 m_wDescription = TextWidget.Cast(w.FindAnyWidget(m_sDescriptionName));
64 SetOrHideImage(m_wImageDefault, m_sImageDefault,
string.Empty);
65 SetOrHideImage(m_wImageSelected, m_sImageSelected,
string.Empty);
66 SetOrHideImage(
m_wIcon, m_sIconTexture, m_sIconImage);
69 m_wImageSelected.SetOpacity(0);
74 m_wDescription.SetOpacity(0);
78 m_wTitle.SetText(m_sTitle);
84 protected void SetOrHideImage(ImageWidget widget,
string texture,
string image)
90 widget.GetParent().SetVisible(success);
94 private void SetAnimationRate()
96 if (m_fAnimationTime <= 0)
97 m_fAnimationRate = 1000;
99 m_fAnimationRate = 1 / m_fAnimationTime;
103 override bool OnFocus(Widget w,
int x,
int y)
105 AnimateWidget.Opacity(m_wDescription, 1, m_fAnimationRate);
106 AnimateWidget.Opacity(m_wImageSelected, 1, m_fAnimationRate);
107 m_OnFocused.Invoke(
this);
112 override bool OnFocusLost(Widget w,
int x,
int y)
114 AnimateWidget.Opacity(m_wDescription, 0, m_fAnimationRate);
115 AnimateWidget.Opacity(m_wImageSelected, 0, m_fAnimationRate);
121 override bool OnClick(Widget w,
int x,
int y,
int button)
129 Widget GetRootWidget()