4 float m_fSaturationSelected;
7 float m_fSaturationDeselected;
10 ref Color m_ColorSelected;
12 [
Attribute(
"0.5 0.5 0.5 1", UIWidgets.ColorPicker)]
13 ref Color m_ColorDeselected;
16 float m_fAnimationTime;
19 string m_sContentName;
23 float m_fAnimationRate;
25 bool m_bIsInErrorState;
27 ref ScriptInvoker m_OnFocused =
new ScriptInvoker();
28 ref ScriptInvoker m_OnFocusLost =
new ScriptInvoker();
29 ref ScriptInvoker m_OnClicked =
new ScriptInvoker();
32 override void HandlerAttached(Widget w)
35 m_wImage = ImageWidget.Cast(w.FindAnyWidget(m_sContentName));
37 SetInitialAnimationRate();
43 m_wImage.SetColor(m_ColorDeselected);
44 m_wImage.SetSaturation(m_fSaturationDeselected);
48 private void SetInitialAnimationRate()
55 private void SetAnimationRate()
57 if (m_fAnimationTime <= 0)
58 m_fAnimationRate = 1000;
60 m_fAnimationRate = 1 / m_fAnimationTime;
64 override bool OnFocus(Widget w,
int x,
int y)
66 if (!m_bIsInErrorState)
68 AnimateWidget.Saturation(
m_wImage, m_fSaturationSelected, m_fAnimationRate);
69 AnimateWidget.Color(
m_wImage, m_ColorSelected, m_fAnimationRate);
72 m_OnFocused.Invoke(
this);
77 override bool OnFocusLost(Widget w,
int x,
int y)
79 AnimateWidget.Saturation(
m_wImage, m_fSaturationDeselected, m_fAnimationRate);
80 AnimateWidget.Color(
m_wImage, m_ColorDeselected, m_fAnimationRate);
86 override bool OnClick(Widget w,
int x,
int y,
int button)
94 Widget GetRootWidget()