5 protected ImageWidget m_wOutline;
7 protected float m_fAnimationRate;
8 protected bool m_bResetOnComplete;
10 override void SetSpeed(
float speed)
16 protected void OnAnimationComplete()
18 if (m_bResetOnComplete)
20 SCR_InputButtonAnimations.ButtonColor(m_InputButtonDisplay.GetBackgroundWidget(), Color.FromInt(Color.WHITE), m_fAnimationRate);
21 AnimateWidget.Opacity(
m_wOutline, 0, m_fAnimationRate);
22 m_InputButtonDisplay.AnimateHoldComplete();
25 GetGame().GetCallqueue().CallLater(m_InputButtonDisplay.ResetColor, m_fAnimationRate * 300 + 1,
false);
29 AnimateWidget.Color(m_InputButtonDisplay.GetBackgroundWidget(), Color.FromInt(Color.WHITE), m_fAnimationRate);
35 override bool OnUpdate(
float timeSlice)
37 m_fCurrentProgress += timeSlice * m_fSpeed;
38 if (m_fCurrentProgress > 1)
39 m_fCurrentProgress = 1;
41 if (!m_InputButtonDisplay)
44 if (m_fSpeed > 0 && m_fCurrentProgress > 0)
45 m_wOutline.SetColor(Color.FromInt(GUIColors.ENABLED.PackToInt()));
49 if (m_fSpeed > 0 && m_fCurrentProgress < 0)
52 m_fValue = GetProgressValue(m_fCurrentProgress);
55 Animate(m_fCurrentProgress == 1);
57 if (m_fSpeed < 0 && m_fValue < 0.1)
60 if (m_fValue >= m_fValueTarget)
63 OnAnimationComplete();
66 if (m_fCurrentProgress < 1)
71 m_fCurrentProgress = 0;
74 if (m_OnCycleCompleted)
75 m_OnCycleCompleted.Invoke(
this);
82 m_OnCompleted.Invoke(
this);
85 m_OnStopped.Invoke(
this);
93 Widget parent =
SCR_WidgetTools.FindWidgetInParents(w, WidgetType.SizeLayoutWidgetTypeID);
96 m_wOutline = m_InputButtonDisplay.GetOutlineWidget();
98 if (!
m_wOutline || !m_InputButtonDisplay.GetBackgroundWidget())
101 m_fAnimationRate = m_InputButtonDisplay.m_fAnimationRate;
102 m_bResetOnComplete = resetOnComplete;
103 m_fValueTarget = targetValue;
104 m_fValueDefault =
m_wOutline.GetMaskProgress();