Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_PlayerHubWarningEditorUIComponent.c
Go to the documentation of this file.
1
class
SCR_PlayerHubWarningEditorUIComponent
:
SCR_BaseEditorUIComponent
2
{
3
protected
static
SCR_PlayerHubWarningEditorUIComponent
m_Self
;
4
protected
Widget
m_WidgetRef
;
5
6
protected
bool
m_bTimerSet
;
7
protected
int
m_iCurrentWarningTimer
;
8
protected
SCR_PlayerHubAreaTriggerEntity
m_LinkedHub
;
9
10
[
Attribute
()]
11
protected
string
m_sTimerText
;
12
13
protected
TextWidget
m_TimerText
;
14
15
protected
IEntity
m_PlayerRef
;
16
17
//======================== UPDATE TIMER ========================\\
18
19
//------------------------------------------------------------------------------------------------
20
//Todo: this is not accurate
21
protected
void
UpdateTimer
()
22
{
23
m_iCurrentWarningTimer
--;
24
m_TimerText
.SetText(
m_iCurrentWarningTimer
.ToString());
25
26
if
(
m_iCurrentWarningTimer
<= 0)
27
{
28
TimerDone
();
29
HideTimer
();
30
}
31
}
32
33
//======================== TIMER COMPLETED/CANCELED ========================\\
34
35
//------------------------------------------------------------------------------------------------
36
//Use: Replication.Time()
37
protected
void
TimerDone
(
bool
canceled =
false
)
38
{
39
//Remove Update
40
GetGame
().GetCallqueue().Remove(
UpdateTimer
);
41
m_Self
.m_bTimerSet =
false
;
42
43
//Timer done
44
m_LinkedHub
.TimerDone(
m_PlayerRef
, canceled);
45
46
HideTimer
();
47
}
48
49
//======================== SET TIMER ========================\\
50
51
//------------------------------------------------------------------------------------------------
55
static
void
SetWarningTimer
(
int
newTimer,
SCR_PlayerHubAreaTriggerEntity
newHub,
IEntity
playerInTrigger)
56
{
57
if
(!
m_Self
)
58
return
;
59
60
//Cancel prev timer
61
if
(
m_Self
.m_LinkedHub)
62
m_Self
.m_LinkedHub.TimerDone(
m_Self
.m_PlayerRef,
true
);
63
64
//Set Hub and player ref
65
m_Self
.m_LinkedHub = newHub;
66
m_Self
.m_PlayerRef = playerInTrigger;
67
68
69
//Set timer
70
m_Self
.m_iCurrentWarningTimer = newTimer;
71
m_Self
.m_bTimerSet =
true
;
72
73
//Set Update
74
GetGame
().GetCallqueue().CallLater(
m_Self
.UpdateTimer, 1000,
true
);
75
76
m_Self
.ShowTimer();
77
}
78
79
//======================== CANCEL TIMER ========================\\
80
81
//------------------------------------------------------------------------------------------------
85
static
void
CancelWarningTimer
(
SCR_PlayerHubAreaTriggerEntity
hub,
bool
hubDestroyed =
false
)
86
{
87
if
(!
m_Self
)
88
return
;
89
90
if
(
m_Self
.m_bTimerSet && (!hubDestroyed || ( hubDestroyed &&
m_Self
.m_LinkedHub == hub))){
91
m_Self
.TimerDone(
true
);
92
}
93
}
94
95
96
//======================== VISIBILITY ========================\\
97
98
//------------------------------------------------------------------------------------------------
99
protected
void
ShowTimer
()
100
{
101
m_TimerText
.SetText(
m_iCurrentWarningTimer
.ToString());
102
m_WidgetRef
.SetVisible(
true
);
103
}
104
105
//------------------------------------------------------------------------------------------------
106
protected
void
HideTimer
()
107
{
108
m_WidgetRef
.SetVisible(
false
);
109
}
110
111
//======================== INHERITED ========================\\
112
113
//------------------------------------------------------------------------------------------------
114
override
void
HandlerAttached
(
Widget
w)
115
{
116
m_WidgetRef
= w;
117
m_Self
=
this
;
118
m_TimerText
=
TextWidget
.Cast(w.FindAnyWidget(
m_sTimerText
));
119
120
}
121
122
//------------------------------------------------------------------------------------------------
123
override
void
HandlerDeattached
(
Widget
w)
124
{
125
if
(
m_bTimerSet
&&
m_Self
)
126
GetGame
().GetCallqueue().Remove(
m_Self
.UpdateTimer);
127
}
128
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
IEntity
Definition
IEntity.c:13
SCR_BaseEditorUIComponent
Definition
SCR_BaseEditorUIComponent.c:4
SCR_PlayerHubAreaTriggerEntity
Definition
SCR_PlayerHubAreaTriggerEnity.c:8
SCR_PlayerHubWarningEditorUIComponent
Definition
SCR_PlayerHubWarningEditorUIComponent.c:2
SCR_PlayerHubWarningEditorUIComponent::TimerDone
void TimerDone(bool canceled=false)
Definition
SCR_PlayerHubWarningEditorUIComponent.c:37
SCR_PlayerHubWarningEditorUIComponent::HandlerDeattached
override void HandlerDeattached(Widget w)
Definition
SCR_PlayerHubWarningEditorUIComponent.c:123
SCR_PlayerHubWarningEditorUIComponent::m_WidgetRef
Widget m_WidgetRef
Definition
SCR_PlayerHubWarningEditorUIComponent.c:4
SCR_PlayerHubWarningEditorUIComponent::m_bTimerSet
bool m_bTimerSet
Definition
SCR_PlayerHubWarningEditorUIComponent.c:6
SCR_PlayerHubWarningEditorUIComponent::m_LinkedHub
SCR_PlayerHubAreaTriggerEntity m_LinkedHub
Definition
SCR_PlayerHubWarningEditorUIComponent.c:8
SCR_PlayerHubWarningEditorUIComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_PlayerHubWarningEditorUIComponent.c:114
SCR_PlayerHubWarningEditorUIComponent::SetWarningTimer
static void SetWarningTimer(int newTimer, SCR_PlayerHubAreaTriggerEntity newHub, IEntity playerInTrigger)
Definition
SCR_PlayerHubWarningEditorUIComponent.c:55
SCR_PlayerHubWarningEditorUIComponent::m_TimerText
TextWidget m_TimerText
Definition
SCR_PlayerHubWarningEditorUIComponent.c:13
SCR_PlayerHubWarningEditorUIComponent::m_sTimerText
string m_sTimerText
Definition
SCR_PlayerHubWarningEditorUIComponent.c:11
SCR_PlayerHubWarningEditorUIComponent::UpdateTimer
void UpdateTimer()
Definition
SCR_PlayerHubWarningEditorUIComponent.c:21
SCR_PlayerHubWarningEditorUIComponent::m_Self
static SCR_PlayerHubWarningEditorUIComponent m_Self
Definition
SCR_PlayerHubWarningEditorUIComponent.c:3
SCR_PlayerHubWarningEditorUIComponent::m_iCurrentWarningTimer
int m_iCurrentWarningTimer
Definition
SCR_PlayerHubWarningEditorUIComponent.c:7
SCR_PlayerHubWarningEditorUIComponent::CancelWarningTimer
static void CancelWarningTimer(SCR_PlayerHubAreaTriggerEntity hub, bool hubDestroyed=false)
Definition
SCR_PlayerHubWarningEditorUIComponent.c:85
SCR_PlayerHubWarningEditorUIComponent::ShowTimer
void ShowTimer()
Definition
SCR_PlayerHubWarningEditorUIComponent.c:99
SCR_PlayerHubWarningEditorUIComponent::HideTimer
void HideTimer()
Definition
SCR_PlayerHubWarningEditorUIComponent.c:106
SCR_PlayerHubWarningEditorUIComponent::m_PlayerRef
IEntity m_PlayerRef
Definition
SCR_PlayerHubWarningEditorUIComponent.c:15
TextWidget
Definition
TextWidget.c:16
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
UI
Components
Common
SCR_PlayerHubWarningEditorUIComponent.c
Generated by
1.17.0