Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
radialprogressbar.c
Go to the documentation of this file.
1
// -----------------------------------------------------------
2
class
RadialProgressBar
3
{
4
reference
float
speed
;
5
reference
float
start_rotation
;
6
7
protected
string
m_BarHider
;
8
protected
string
m_BarPart
;
9
protected
Widget
m_Root
;
10
protected
ref
AnimatorTimer
m_Anim
;
11
protected
float
x
,
y
,
z
;
12
protected
float
rotation
= 0;
13
protected
int
stage
= 0;
14
15
// -----------------------------------------------------------
16
void
RadialProgressBar
()
17
{
18
m_Anim
=
new
AnimatorTimer
();
19
g_Game
.GetUpdateQueue(
CALL_CATEGORY_GUI
).Insert(this.
Update
);
20
}
21
22
// -----------------------------------------------------------
23
void
~RadialProgressBar
()
24
{
25
g_Game
.GetUpdateQueue(
CALL_CATEGORY_GUI
).Remove(this.
Update
);
26
}
27
28
void
SetProgress
(
float
progress )
29
{
30
if
( progress < 50 )
31
{
32
stage
= 0;
33
}
34
rotation
= 360 * ( progress / 100 );
35
}
36
37
// -----------------------------------------------------------
38
protected
void
Update
(
float
tDelta)
39
{
40
m_Anim
.Tick(tDelta);
41
42
Widget
child =
m_Root
.GetChildren();
43
44
int
index = 0;
45
while
( child )
46
{
47
UpdateChild
( child, index );
48
index++;
49
child = child.GetSibling();
50
}
51
}
52
53
protected
void
UpdateChild
(
Widget
child,
int
index )
54
{
55
float
rotation_value = (
m_Anim
.GetTargetValue() *
Math
.
RAD2DEG
);
56
if
( child.GetName() ==
m_BarHider
)
57
{
58
if
(
stage
== 0 )
59
{
60
if
(
rotation
> 0 )
61
{
62
child.GetChildren().Show(
true
);
63
}
64
else
65
{
66
child.GetChildren().Show(
false
);
67
}
68
69
child.GetChildren().SetRotation( 0, 0,
start_rotation
+
rotation
);
70
71
if
(
rotation
> 180 )
72
{
73
stage
= 1;
74
child.GetChildren().SetRotation(0, 0, 360);
75
}
76
77
}
78
}
79
else
if
( child.GetName() ==
m_BarPart
)
80
{
81
if
(
stage
== 0 )
82
child.Show(
false
);
83
if
(
stage
== 1 )
84
{
85
child.Show(
true
);
86
child.SetRotation( 0, 0,
start_rotation
+
rotation
);
87
88
if
(
rotation
> 360 )
89
{
90
stage
= 2;
91
child.SetRotation( 0, 0, 180 );
92
}
93
}
94
}
95
}
96
97
// -----------------------------------------------------------
98
void
OnWidgetScriptInit
(
Widget
w )
99
{
100
m_Root
= w;
101
m_BarHider
=
"BarHider_"
+
m_Root
.GetName();
102
m_BarPart
=
"BarPart2_"
+
m_Root
.GetName();
103
m_Anim
.AnimateLoop(
speed
);
104
}
105
};
AnimatorTimer
Definition
tools.c:747
Math
Definition
enmath.c:7
RadialProgressBar::m_Root
Widget m_Root
Definition
radialprogressbar.c:9
RadialProgressBar::speed
reference float speed
Definition
radialprogressbar.c:4
RadialProgressBar::rotation
float rotation
Definition
radialprogressbar.c:12
RadialProgressBar::start_rotation
reference float start_rotation
Definition
radialprogressbar.c:5
RadialProgressBar::stage
int stage
Definition
radialprogressbar.c:13
RadialProgressBar::UpdateChild
void UpdateChild(Widget child, int index)
Definition
radialprogressbar.c:53
RadialProgressBar::RadialProgressBar
void RadialProgressBar()
Definition
radialprogressbar.c:16
RadialProgressBar::Update
void Update(float tDelta)
Definition
radialprogressbar.c:38
RadialProgressBar::y
float y
Definition
radialprogressbar.c:11
RadialProgressBar::m_Anim
ref AnimatorTimer m_Anim
Definition
radialprogressbar.c:10
RadialProgressBar::m_BarPart
string m_BarPart
Definition
radialprogressbar.c:8
RadialProgressBar::~RadialProgressBar
void ~RadialProgressBar()
Definition
radialprogressbar.c:23
RadialProgressBar::OnWidgetScriptInit
void OnWidgetScriptInit(Widget w)
Definition
radialprogressbar.c:98
RadialProgressBar::x
float x
Definition
radialprogressbar.c:11
RadialProgressBar::m_BarHider
string m_BarHider
Definition
radialprogressbar.c:7
RadialProgressBar::SetProgress
void SetProgress(float progress)
Definition
radialprogressbar.c:28
RadialProgressBar::z
float z
Definition
radialprogressbar.c:11
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Math::RAD2DEG
static const float RAD2DEG
Definition
enmath.c:16
CALL_CATEGORY_GUI
const int CALL_CATEGORY_GUI
Definition
tools.c:9
Games
Dayz
scripts
3_game
gui
effects
radialprogressbar.c
Generated by
1.17.0