DayZ 1.24
Loading...
Searching...
No Matches
RadialProgressBar Class Reference
Collaboration diagram for RadialProgressBar:
[legend]

Protected Member Functions

void RadialProgressBar ()
 
void ~RadialProgressBar ()
 
void SetProgress (float progress)
 
void Update (float tDelta)
 
void UpdateChild (Widget child, int index)
 
void OnWidgetScriptInit (Widget w)
 

Protected Attributes

string m_BarHider
 
string m_BarPart
 
Widget m_Root
 
ref AnimatorTimer m_Anim
 
float x
 
float y
 
float z
 
float rotation = 0
 
int stage = 0
 

Private Attributes

reference float speed
 
reference float start_rotation
 

Detailed Description

Definition at line 2 of file RadialProgressBar.c.

Constructor & Destructor Documentation

◆ RadialProgressBar()

void RadialProgressBar::RadialProgressBar ( )
inlineprotected

Definition at line 16 of file RadialProgressBar.c.

17 {
18 m_Anim = new AnimatorTimer();
19 GetGame().GetUpdateQueue(CALL_CATEGORY_GUI).Insert(this.Update);
20 }
ref AnimatorTimer m_Anim
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9
proto native volatile void Update()

References CALL_CATEGORY_GUI, GetGame(), m_Anim, and Update().

◆ ~RadialProgressBar()

void RadialProgressBar::~RadialProgressBar ( )
inlineprotected

Definition at line 23 of file RadialProgressBar.c.

24 {
25 GetGame().GetUpdateQueue(CALL_CATEGORY_GUI).Remove(this.Update);
26 }

References CALL_CATEGORY_GUI, GetGame(), and Update().

Member Function Documentation

◆ OnWidgetScriptInit()

void RadialProgressBar::OnWidgetScriptInit ( Widget w)
inlineprotected

Definition at line 92 of file RadialProgressBar.c.

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 }
reference float speed

References m_Anim, m_BarHider, m_BarPart, m_Root, and speed.

◆ SetProgress()

void RadialProgressBar::SetProgress ( float progress)
inlineprotected

Definition at line 28 of file RadialProgressBar.c.

29 {
30 if (progress < 50)
31 stage = 0;
32 rotation = 360 * (progress / 100);
33 }

References rotation, and stage.

◆ Update()

void RadialProgressBar::Update ( float tDelta)
inlineprotected

Definition at line 36 of file RadialProgressBar.c.

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 }
void UpdateChild(Widget child, int index)

References m_Anim, m_Root, and UpdateChild().

◆ UpdateChild()

void RadialProgressBar::UpdateChild ( Widget child,
int index )
inlineprotected

Definition at line 51 of file RadialProgressBar.c.

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 }
Definition EnMath.c:7
reference float start_rotation
static const float RAD2DEG
Definition EnMath.c:16

References m_Anim, m_BarHider, m_BarPart, Math::RAD2DEG, rotation, stage, and start_rotation.

Referenced by Update().

Member Data Documentation

◆ m_Anim

ref AnimatorTimer RadialProgressBar::m_Anim
protected

Definition at line 10 of file RadialProgressBar.c.

Referenced by OnWidgetScriptInit(), RadialProgressBar(), Update(), and UpdateChild().

◆ m_BarHider

string RadialProgressBar::m_BarHider
protected

Definition at line 7 of file RadialProgressBar.c.

Referenced by OnWidgetScriptInit(), and UpdateChild().

◆ m_BarPart

string RadialProgressBar::m_BarPart
protected

Definition at line 8 of file RadialProgressBar.c.

Referenced by OnWidgetScriptInit(), and UpdateChild().

◆ m_Root

Widget RadialProgressBar::m_Root
protected

Definition at line 9 of file RadialProgressBar.c.

Referenced by OnWidgetScriptInit(), and Update().

◆ rotation

float RadialProgressBar::rotation = 0
protected

Definition at line 12 of file RadialProgressBar.c.

Referenced by SetProgress(), and UpdateChild().

◆ speed

reference float RadialProgressBar::speed
private

Definition at line 4 of file RadialProgressBar.c.

Referenced by OnWidgetScriptInit().

◆ stage

int RadialProgressBar::stage = 0
protected

Definition at line 13 of file RadialProgressBar.c.

Referenced by SetProgress(), and UpdateChild().

◆ start_rotation

reference float RadialProgressBar::start_rotation
private

Definition at line 5 of file RadialProgressBar.c.

Referenced by UpdateChild().

◆ x

float RadialProgressBar::x
protected

Definition at line 11 of file RadialProgressBar.c.

◆ y

float RadialProgressBar::y
protected

Definition at line 11 of file RadialProgressBar.c.

◆ z

float RadialProgressBar::z
protected

Definition at line 11 of file RadialProgressBar.c.


The documentation for this class was generated from the following file: