4 protected Widget m_WidgetRef;
6 protected bool m_bTimerSet;
7 protected int m_iCurrentWarningTimer;
11 protected string m_sTimerText;
13 protected TextWidget m_TimerText;
15 protected IEntity m_PlayerRef;
21 protected void UpdateTimer()
23 m_iCurrentWarningTimer--;
24 m_TimerText.SetText(m_iCurrentWarningTimer.ToString());
26 if (m_iCurrentWarningTimer <= 0)
37 protected void TimerDone(
bool canceled =
false)
40 GetGame().GetCallqueue().Remove(UpdateTimer);
41 m_Self.m_bTimerSet =
false;
44 m_LinkedHub.TimerDone(m_PlayerRef, canceled);
61 if (m_Self.m_LinkedHub)
62 m_Self.m_LinkedHub.TimerDone(m_Self.m_PlayerRef,
true);
65 m_Self.m_LinkedHub = newHub;
66 m_Self.m_PlayerRef = playerInTrigger;
70 m_Self.m_iCurrentWarningTimer = newTimer;
71 m_Self.m_bTimerSet =
true;
74 GetGame().GetCallqueue().CallLater(m_Self.UpdateTimer, 1000,
true);
90 if (m_Self.m_bTimerSet && (!hubDestroyed || ( hubDestroyed && m_Self.m_LinkedHub == hub))){
91 m_Self.TimerDone(
true);
99 protected void ShowTimer()
101 m_TimerText.SetText(m_iCurrentWarningTimer.ToString());
102 m_WidgetRef.SetVisible(
true);
106 protected void HideTimer()
108 m_WidgetRef.SetVisible(
false);
114 override void HandlerAttached(Widget w)
118 m_TimerText = TextWidget.Cast(w.FindAnyWidget(m_sTimerText));
123 override void HandlerDeattached(Widget w)
125 if (m_bTimerSet && m_Self)
126 GetGame().GetCallqueue().Remove(m_Self.UpdateTimer);