13 protected Widget m_wButtonWidget;
14 protected SCR_ModularButtonComponent m_ButtonComponent;
16 protected ImageWidget m_wIcon;
18 protected Widget m_wCountIconFrame;
19 protected TextWidget m_wCountText;
21 protected TextWidget m_wLabel;
23 protected const string BUTTON =
"CoreMenuHeaderButton";
24 protected const string COUNT_ICON_FRAME =
"CountIconFrame";
25 protected const string COUNT_TEXT =
"CountText";
26 protected const string ICON =
"Icon";
27 protected const string LABEL =
"ButtonLabel";
30 override void HandlerAttached(Widget w)
32 super.HandlerAttached(w);
34 m_wButtonWidget = w.FindAnyWidget(BUTTON);
36 m_ButtonComponent = SCR_ModularButtonComponent.FindComponent(m_wButtonWidget);
38 m_wCountIconFrame = w.FindAnyWidget(COUNT_ICON_FRAME);
39 m_wCountText = TextWidget.Cast(w.FindAnyWidget(COUNT_TEXT));
40 SetCountVisible(m_bShowCount);
42 m_wLabel = TextWidget.Cast(w.FindAnyWidget(LABEL));
43 SetLabelText(m_sLabel);
45 m_wIcon = ImageWidget.Cast(w.FindAnyWidget(ICON));
51 void SetIcon(
string name)
56 bool show = name !=
string.Empty;
72 void SetCountText(
string text)
77 m_wCountText.SetText(text);
82 void SetCountVisible(
bool visible)
84 if (!m_wCountIconFrame)
87 m_wCountIconFrame.SetVisible(visible);
92 void SetLabelText(
string text)
97 m_wLabel.SetVisible(!text.IsEmpty());
99 if (m_wLabel.IsVisible())
100 m_wLabel.SetText(text);
105 string GetLabelText()
110 return m_wLabel.GetText();
117 void SetVisible(
bool visible,
bool animate =
false,
float rate =
UIConstants.FADE_RATE_FAST)
123 AnimateWidget.Opacity(m_wRoot, visible, rate,
true);
130 SCR_ModularButtonComponent GetButton()
132 return m_ButtonComponent;