DayZ 1.24
Loading...
Searching...
No Matches
RadialProgressBar.c
Go to the documentation of this file.
1// -----------------------------------------------------------
3{
6
7 protected string m_BarHider;
8 protected string m_BarPart;
9 protected Widget m_Root;
11 protected float x, y, z;
12 protected float rotation = 0;
13 protected int stage = 0;
14
15 // -----------------------------------------------------------
17 {
18 m_Anim = new AnimatorTimer();
19 GetGame().GetUpdateQueue(CALL_CATEGORY_GUI).Insert(this.Update);
20 }
21
22 // -----------------------------------------------------------
24 {
25 GetGame().GetUpdateQueue(CALL_CATEGORY_GUI).Remove(this.Update);
26 }
27
29 {
30 if (progress < 50)
31 stage = 0;
32 rotation = 360 * (progress / 100);
33 }
34
35 // -----------------------------------------------------------
36 protected void Update(float tDelta)
37 {
38 m_Anim.Tick(tDelta);
39
40 Widget child = m_Root.GetChildren();
41
42 int index = 0;
43 while (child)
44 {
46 index++;
47 child = child.GetSibling();
48 }
49 }
50
51 protected void UpdateChild(Widget child, int index)
52 {
53 float rotation_value = (m_Anim.GetTargetValue() * Math.RAD2DEG);
54 if (child.GetName() == m_BarHider)
55 {
56 if (stage == 0)
57 {
58 if (rotation > 0)
59 child.GetChildren().Show(true);
60 else
61 child.GetChildren().Show(false);
62
63 child.GetChildren().SetRotation(0, 0, start_rotation + rotation);
64
65 if (rotation > 180)
66 {
67 stage = 1;
68 child.GetChildren().SetRotation(0, 0, 360);
69 }
70
71 }
72 }
73 else if (child.GetName() == m_BarPart)
74 {
75 if (stage == 0)
76 child.Show(false);
77 if (stage == 1)
78 {
79 child.Show(true);
80 child.SetRotation(0, 0, start_rotation + rotation);
81
82 if (rotation > 360)
83 {
84 stage = 2;
85 child.SetRotation(0, 0, 180);
86 }
87 }
88 }
89 }
90
91 // -----------------------------------------------------------
93 {
94 m_Root = w;
95 m_BarHider = "BarHider_" + m_Root.GetName();
96 m_BarPart = "BarPart2_" + m_Root.GetName();
97 m_Anim.AnimateLoop(speed);
98 }
99};
Definition EnMath.c:7
void SetProgress(float progress)
void OnWidgetScriptInit(Widget w)
reference float start_rotation
ref AnimatorTimer m_Anim
void Update(float tDelta)
void UpdateChild(Widget child, int index)
reference float speed
proto native CGame GetGame()
static const float RAD2DEG
Definition EnMath.c:16
const int CALL_CATEGORY_GUI
Definition tools.c:9
proto native volatile void Update()