Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_RejoinDialog.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 // Widget Names
5 const string WIDGET_TXT_TIMER = "Timer";
6 const string WIDGET_LOADING = "Loading";
7
8 // Widgets
10 protected Widget m_wLoading;
11
12 protected int m_iTimer;
13
14 // Invokers
16
17 //------------------------------------------------------------------------------------------------
18 protected void InvokeEventOnTimerChanged(int arg0)
19 {
21 Event_OnTimerChanged.Invoke(this, arg0);
22 }
23
24 //------------------------------------------------------------------------------------------------
32
33 //------------------------------------------------------------------------------------------------
34 // Dialog override functions
35 //------------------------------------------------------------------------------------------------
36
37 //------------------------------------------------------------------------------------------------
38 override void HandlerAttached(Widget w)
39 {
40 super.HandlerAttached(w);
41
42 m_wTimer = TextWidget.Cast(w.FindAnyWidget(WIDGET_TXT_TIMER));
43 m_wLoading = w.FindAnyWidget(WIDGET_LOADING);
44 }
45
46 //------------------------------------------------------------------------------------------------
47 protected void DecreaseTime()
48 {
49 m_iTimer--;
50 if (m_iTimer > 0)
51 GetGame().GetCallqueue().CallLater(DecreaseTime, 1000);
52
54 }
55
56 //------------------------------------------------------------------------------------------------
57 // Public API
58 //------------------------------------------------------------------------------------------------
59
60 //------------------------------------------------------------------------------------------------
61 void RunTimer(bool run)
62 {
63 // Stop
64 GetGame().GetCallqueue().Remove(DecreaseTime);
65
66 // Run next cycle
67 if (run)
68 GetGame().GetCallqueue().CallLater(DecreaseTime, 1000);
69 }
70
71 //------------------------------------------------------------------------------------------------
72 void SetTimer(int time)
73 {
74 m_iTimer = time;
76 }
77
78 //------------------------------------------------------------------------------------------------
80 {
81 return m_iTimer;
82 }
83
84 //------------------------------------------------------------------------------------------------
85 void ShowLoading(bool show)
86 {
87 if (m_wLoading)
88 m_wLoading.SetVisible(show);
89 }
90
91 //------------------------------------------------------------------------------------------------
93 {
94 return SCR_RejoinDialog.Cast(w.FindHandler(SCR_RejoinDialog));
95 }
96};
ArmaReforgerScripted GetGame()
Definition game.c:1398
void RunTimer(bool run)
ScriptInvoker GetEventOnTimerChanged()
void ShowLoading(bool show)
static SCR_RejoinDialog FindRejoinComponent(notnull Widget w)
override void HandlerAttached(Widget w)
void SetTimer(int time)
void InvokeEventOnTimerChanged(int arg0)
ref ScriptInvoker< int > Event_OnTimerChanged
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134