Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_InputButtonAlphaMaskAnimation.c
Go to the documentation of this file.
2{
4
6
7 protected float m_fAnimationRate;
8 protected bool m_bResetOnComplete;
9
10 override void SetSpeed(float speed)
11 {
12 m_fSpeed = speed;
13 }
14
15 //------------------------------------------------------------------------------------------------
16 protected void OnAnimationComplete()
17 {
19 {
20 SCR_InputButtonAnimations.ButtonColor(m_InputButtonDisplay.GetBackgroundWidget(), Color.FromInt(Color.WHITE), m_fAnimationRate);
22 m_InputButtonDisplay.AnimateHoldComplete();
23
25 GetGame().GetCallqueue().CallLater(m_InputButtonDisplay.ResetColor, m_fAnimationRate * 300 + 1, false);
26 }
27 else
28 {
29 AnimateWidget.Color(m_InputButtonDisplay.GetBackgroundWidget(), Color.FromInt(Color.WHITE), m_fAnimationRate);
30 }
31
32 }
33
34 //------------------------------------------------------------------------------------------------
35 override bool OnUpdate(float timeSlice)
36 {
37 m_fCurrentProgress += timeSlice * m_fSpeed;
38 if (m_fCurrentProgress > 1)
40
42 return false;
43
44 if (m_fSpeed > 0 && m_fCurrentProgress > 0)
45 m_wOutline.SetColor(Color.FromInt(GUIColors.ENABLED.PackToInt()));
46 else
47 m_wOutline.SetColor(Color.FromInt(UIColors.WARNING.PackToInt()));
48
49 if (m_fSpeed > 0 && m_fCurrentProgress < 0)
50 return false;
51
53
54 // Perform widget animation
56
57 if (m_fSpeed < 0 && m_fValue < 0.1)
58 Stop();
59
61 {
62 Stop();
64 }
65
66 if (m_fCurrentProgress < 1)
67 return false;
68
69 if (m_bRepeat)
70 {
73
75 m_OnCycleCompleted.Invoke(this);
76
77 return false;
78 }
79
80 // Invoke subscribed changes
81 if (m_OnCompleted)
82 m_OnCompleted.Invoke(this);
83
84 if (m_OnStopped)
85 m_OnStopped.Invoke(this);
86
87 return true;
88 }
89
90 //------------------------------------------------------------------------------------------------
91 void SCR_InputButtonAlphaMaskAnimation(Widget w, float speed, float targetValue, bool resetOnComplete)
92 {
93 Widget parent = SCR_WidgetTools.FindWidgetInParents(w, WidgetType.SizeLayoutWidgetTypeID);
95
96 m_wOutline = m_InputButtonDisplay.GetOutlineWidget();
97
98 if (!m_wOutline || !m_InputButtonDisplay.GetBackgroundWidget())
99 return;
100
101 m_fAnimationRate = m_InputButtonDisplay.m_fAnimationRate;
102 m_bResetOnComplete = resetOnComplete;
103 m_fValueTarget = targetValue;
104 m_fValueDefault = m_wOutline.GetMaskProgress();
105 m_wOutline.SetMaskProgress(0);
106 m_wOutline.SetOpacity(1);
107 }
108}
ArmaReforgerScripted GetGame()
Definition game.c:1398
float GetProgressValue(float t)
float m_fCurrentProgress
ref ScriptInvoker m_OnCompleted
float m_fSpeed
bool m_bRepeat
ref ScriptInvoker m_OnStopped
ref ScriptInvoker m_OnCycleCompleted
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition Color.c:13
void SCR_InputButtonAlphaMaskAnimation(Widget w, float speed, float targetValue, bool resetOnComplete)
override void Animate(bool finished)
void WidgetAnimationAlphaMask(Widget w, float speed, float targetValue)
override void ReverseDirection()
void Stop()
Stop tracking time in this menu, prepare for sending data.