DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
RadialProgressBar.c
См. документацию.
1// -----------------------------------------------------------
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 // -----------------------------------------------------------
21
22 // -----------------------------------------------------------
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 // -----------------------------------------------------------
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};
Определения tools.c:749
override ScriptInvoker GetUpdateQueue(int call_category)
Определения DayZGame.c:1192
Определения EnMath.c:7
Widget m_Root
Определения RadialProgressBar.c:9
string m_BarPart
Определения RadialProgressBar.c:8
void RadialProgressBar()
Определения RadialProgressBar.c:16
void SetProgress(float progress)
Определения RadialProgressBar.c:28
void OnWidgetScriptInit(Widget w)
Определения RadialProgressBar.c:98
string m_BarHider
Определения RadialProgressBar.c:7
reference float start_rotation
Определения RadialProgressBar.c:5
float x
Определения RadialProgressBar.c:11
ref AnimatorTimer m_Anim
Определения RadialProgressBar.c:10
void Update(float tDelta)
Определения RadialProgressBar.c:38
float rotation
Определения RadialProgressBar.c:12
float z
Определения RadialProgressBar.c:11
float y
Определения RadialProgressBar.c:11
int stage
Определения RadialProgressBar.c:13
void ~RadialProgressBar()
Определения RadialProgressBar.c:23
void UpdateChild(Widget child, int index)
Определения RadialProgressBar.c:53
reference float speed
Определения RadialProgressBar.c:4
proto bool Remove(func fn, int flags=EScriptInvokerRemoveFlags.ALL)
remove specific call from list
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
Определения EnWidgets.c:190
proto native CGame GetGame()
static const float RAD2DEG
Определения EnMath.c:16
const int CALL_CATEGORY_GUI
Определения tools.c:9