Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ImageRadialProgressBarUIComponent.c
Go to the documentation of this file.
2{
3 [Attribute("FadeImage")]
4 protected string m_sFadeImageName;
5
6 [Attribute(defvalue: "1", desc: "Fade in speed of image")]
7 protected float m_bFadeImageInSpeed;
8
9 [Attribute(defvalue: "1", desc: "Fade out speed of image")]
10 protected float m_bFadeImageOutSpeed;
11
12 [Attribute(defvalue: "0", desc: "Sets the start opacity of the image, it starts with opacity 0 if false else it starts with 1")]
13 protected bool m_bIsFadeImageVisible;
14
15 //Ref
17
18 //State
19 protected bool m_bisFading;
20 protected bool m_bIsFadingIn;
21
22 //Script invoker
23 protected ref ScriptInvoker Event_OnFadeDone = new ScriptInvoker; //SCR_ImageRadialProgressBarUIComponent, bool wasFadingIn
24
25 override void SetProgress(float progress)
26 {
27 super.SetProgress(progress);
28
29 if (m_wFadeImage)
30 {
32 {
33 FadeImage(true);
34 }
36 {
37 FadeImage(false);
38 }
39 }
40 }
41
42 void InstantProgressMaxMin(bool SetToMax)
43 {
44 if (SetToMax)
45 {
48 }
49 else
50 {
53 }
54 }
55
57 {
58 return m_fMinValue;
59 }
60
62 {
63 return m_fMaxValue;
64 }
65
70
71 void FadeImage(bool fadeIn)
72 {
73 m_bIsFadeImageVisible = fadeIn;
74 m_bIsFadingIn = fadeIn;
75
76 if (!m_bisFading)
77 {
78 m_bisFading = true;
79 GetGame().GetCallqueue().CallLater(FadeUpdate, 500, true);
80 }
81
83 }
84
85 protected void FadeUpdate()
86 {
87 if (m_bisFading)
88 {
89 if ((m_bIsFadingIn && m_wFadeImage.GetOpacity() >= 1) || (!m_bIsFadingIn && m_wFadeImage.GetOpacity() <= 0))
90 {
91 m_bisFading = false;
92 GetGame().GetCallqueue().Remove(FadeUpdate);
93 Event_OnFadeDone.Invoke(this, m_bIsFadingIn);
94 }
95 }
96 }
97
103 {
104 return m_wFadeImage;
105 }
106
107 void SetFadeImageVisible(bool setVisible)
108 {
109 if (m_bisFading)
110 {
111 m_bisFading = false;
112 GetGame().GetCallqueue().Remove(FadeUpdate);
113 }
114
116
117 m_bIsFadeImageVisible = setVisible;
118
119 if (setVisible)
120 m_wFadeImage.SetOpacity(1);
121 else
122 m_wFadeImage.SetOpacity(0);
123 }
124
125 override void HandlerAttached(Widget w)
126 {
127 if (SCR_Global.IsEditMode())
128 return;
129
130 super.HandlerAttached(w);
131
132 m_wFadeImage = ImageWidget.Cast(w.FindAnyWidget(m_sFadeImageName));
133
135 }
136
137 override void HandlerDeattached(Widget w)
138 {
139 if (m_bisFading)
140 GetGame().GetCallqueue().Remove(FadeUpdate); //>>>>> ADD CHECK FADE DONE TO HIDE UI IN TOGGLE EDITOR (JUST ALWAYS INVOKE AND CHECK IF IMAGE IS VISIBLE)
141 }
142
143};
ArmaReforgerScripted GetGame()
Definition game.c:1398
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
static bool StopAnimation(Widget w, typename typeName)
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
static bool IsEditMode()
Definition Functions.c:1566
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134