5 const string WIDGET_TXT_TIMER =
"Timer";
6 const string WIDGET_LOADING =
"Loading";
9 protected TextWidget m_wTimer;
10 protected Widget m_wLoading;
12 protected int m_iTimer;
15 protected ref ScriptInvoker<int> Event_OnTimerChanged;
18 protected void InvokeEventOnTimerChanged(
int arg0)
20 if (Event_OnTimerChanged)
21 Event_OnTimerChanged.Invoke(
this, arg0);
25 ScriptInvoker GetEventOnTimerChanged()
27 if (!Event_OnTimerChanged)
28 Event_OnTimerChanged =
new ScriptInvoker();
30 return Event_OnTimerChanged;
38 override void HandlerAttached(Widget w)
40 super.HandlerAttached(w);
42 m_wTimer = TextWidget.Cast(w.FindAnyWidget(WIDGET_TXT_TIMER));
47 protected void DecreaseTime()
51 GetGame().GetCallqueue().CallLater(DecreaseTime, 1000);
53 InvokeEventOnTimerChanged(m_iTimer);
61 void RunTimer(
bool run)
64 GetGame().GetCallqueue().Remove(DecreaseTime);
68 GetGame().GetCallqueue().CallLater(DecreaseTime, 1000);
72 void SetTimer(
int time)
75 InvokeEventOnTimerChanged(m_iTimer);
85 void ShowLoading(
bool show)