Example #1
0
        private void UpdateAnimSize()
        {
            if (!m_AnimSize)
            {
                return;
            }

            float animDeltaTime = Time.realtimeSinceStartup - m_AnimSizeStartTime;

            if (animDeltaTime < animDuration)
            {
                Vector3 tempVector3 = scaledRectTransform.localScale;
                tempVector3.x = Tween.CubeInOut(m_AnimSizeCurrentSize, m_AnimSizeTargetSize, animDeltaTime, animDuration);
                tempVector3.y = tempVector3.x;
                tempVector3.z = tempVector3.x;
                scaledRectTransform.localScale = tempVector3;
            }
            else
            {
                Vector3 tempVector3 = scaledRectTransform.localScale;
                tempVector3.x = m_AnimSizeTargetSize;
                tempVector3.y = tempVector3.x;
                tempVector3.z = tempVector3.x;
                scaledRectTransform.localScale = tempVector3;
                m_AnimSize = false;
                if (m_AnimSizeTargetSize == 0f)
                {
                    gameObject.SetActive(false);
                }
            }
        }
        private void UpdateAnimColor()
        {
            if (m_BackgroundImage == null)
            {
                return;
            }
            if (!m_AnimColor)
            {
                return;
            }

            float deltaTime = Time.realtimeSinceStartup - m_AnimColorStartTime;

            if (deltaTime < animDuration)
            {
                barImage.color          = Tween.CubeInOut(m_AnimColorCurrentColor, m_AnimColorTargetColor, deltaTime, animDuration);
                m_BackgroundImage.color = barImage.color;
            }
            else
            {
                barImage.color          = m_AnimColorTargetColor;
                m_BackgroundImage.color = barImage.color;
                m_AnimColor             = false;
            }
        }
Example #3
0
        void Update()
        {
            m_AnimDeltaTime = Time.realtimeSinceStartup - m_AnimStartTime;

            if (m_State == 1)
            {
                if (m_AnimDeltaTime < m_AnimSpeed)
                {
                    m_TempVec2               = m_RectTransform.position;
                    m_TempVec2.y             = Tween.CubeOut(m_CurrentPosition, m_OnPos.y, m_AnimDeltaTime, m_AnimSpeed);
                    m_RectTransform.position = m_TempVec2;
                    m_CanvasGroup.alpha      = Tween.CubeInOut(m_CanvasGroup.alpha, 1f, m_AnimDeltaTime, m_AnimSpeed);
                    if (m_MoveFab)
                    {
                        m_FabRectTransform.position = new Vector3(m_FabRectTransform.position.x, m_FabStartPos + (m_RectTransform.position.y - m_OffPos.y), m_FabRectTransform.position.z);
                    }
                }
                else
                {
                    m_RectTransform.position = m_OnPos;
                    if (m_MoveFab)
                    {
                        m_FabRectTransform.position = new Vector3(m_FabRectTransform.position.x, m_FabStartPos + (m_RectTransform.position.y - m_OffPos.y), m_FabRectTransform.position.z);
                    }
                    StartCoroutine(WaitTime());
                    m_State = 0;
                }
            }
            else if (m_State == 2)
            {
                if (m_AnimDeltaTime < m_AnimSpeed)
                {
                    m_TempVec2               = m_RectTransform.position;
                    m_TempVec2.y             = Tween.CubeInOut(m_CurrentPosition, m_OffPos.y, m_AnimDeltaTime, m_AnimSpeed);
                    m_RectTransform.position = m_TempVec2;
                    m_CanvasGroup.alpha      = Tween.CubeIn(m_CanvasGroup.alpha, m_OffAlpha, m_AnimDeltaTime, m_AnimSpeed);
                    if (m_MoveFab)
                    {
                        m_FabRectTransform.position = new Vector3(m_FabRectTransform.position.x, m_FabStartPos + (m_RectTransform.position.y - m_OffPos.y), m_FabRectTransform.position.z);
                    }
                }
                else
                {
                    if (m_MoveFab)
                    {
                        m_FabRectTransform.position = new Vector3(m_FabRectTransform.position.x, m_FabStartPos, m_FabRectTransform.position.z);
                    }
                    m_State = 0;
                    OnAnimDone();
                }
            }
        }
Example #4
0
        private void UpdateAnimColor()
        {
            if (!m_AnimColor)
            {
                return;
            }

            float animDeltaTime = Time.realtimeSinceStartup - m_AnimColorStartTime;

            if (animDeltaTime < animDuration)
            {
                circleIcon.color = Tween.CubeInOut(m_AnimColorCurrentColor, m_AnimColorTargetColor, animDeltaTime,
                                                   animDuration);
            }
            else
            {
                circleIcon.color = m_AnimColorTargetColor;
                m_AnimColor      = false;
            }
        }
Example #5
0
        private void UpdateAnimCircle()
        {
            if (circleImage == null)
            {
                return;
            }
            if (m_AnimCircle == 0)
            {
                return;
            }

            if (m_AnimCircle == 1)
            {
                float animDeltaTime = Time.realtimeSinceStartup - m_AnimCircleStartTime;

                if (animDeltaTime < animDuration)
                {
                    circleImage.fillAmount = Tween.CubeInOut(m_AnimCircleCurrentFillAmount, 0.75f, animDeltaTime,
                                                             animDuration);
                }
                else
                {
                    m_AnimCircleCurrentFillAmount = 0.75f;
                    circleImage.fillAmount        = 0.75f;
                    FlipCircle(false);
                    m_AnimCircleStartTime = Time.realtimeSinceStartup;
                    m_AnimCircle          = 2;
                }

                m_CircleRectTransform.localEulerAngles = new Vector3(m_CircleRectTransform.localEulerAngles.x,
                                                                     m_CircleRectTransform.localEulerAngles.y,
                                                                     m_CircleRectTransform.localEulerAngles.z - Time.unscaledDeltaTime * 200f);
                return;
            }

            if (m_AnimCircle == 2)
            {
                float animDeltaTime = Time.realtimeSinceStartup - m_AnimCircleStartTime;

                if (animDeltaTime < animDuration)
                {
                    circleImage.fillAmount = Tween.CubeInOut(m_AnimCircleCurrentFillAmount, 0.1f, animDeltaTime,
                                                             animDuration);
                }
                else
                {
                    m_AnimCircleCurrentFillAmount = 0.1f;
                    circleImage.fillAmount        = 0.1f;
                    FlipCircle(true);
                    m_AnimCircleStartTime = Time.realtimeSinceStartup;
                    m_AnimCircle          = 1;
                }

                m_CircleRectTransform.localEulerAngles = new Vector3(m_CircleRectTransform.localEulerAngles.x,
                                                                     m_CircleRectTransform.localEulerAngles.y,
                                                                     m_CircleRectTransform.localEulerAngles.z - Time.unscaledDeltaTime * 200f);
                return;
            }

            if (m_AnimCircle == 3)
            {
                float animDeltaTime = Time.realtimeSinceStartup - m_AnimCircleStartTime;

                if (animDeltaTime < animDuration)
                {
                    circleImage.fillAmount = Tween.CubeInOut(m_AnimCircleCurrentFillAmount, m_CurrentProgress, animDeltaTime,
                                                             animDuration);
                    Vector3 tempVector3 = m_CircleRectTransform.localEulerAngles;
                    tempVector3.z = Tween.CubeInOut(m_AnimCircleCurrentRotation, 0f, animDeltaTime, animDuration);
                    m_CircleRectTransform.localEulerAngles = tempVector3;
                }
                else
                {
                    m_AnimCircleCurrentFillAmount = circleImage.fillAmount = m_CurrentProgress;
                    Vector3 tempVector3 = m_CircleRectTransform.localEulerAngles;
                    tempVector3.z = 0f;
                    m_CircleRectTransform.localEulerAngles = tempVector3;
                    m_AnimCircleStartTime = Time.realtimeSinceStartup;
                    m_AnimCircle          = 0;
                }
            }
        }
        private void UpdateAnimBar()
        {
            if (rectTransform == null)
            {
                return;
            }
            if (m_AnimBar == 0)
            {
                return;
            }

            float deltaTime = Time.realtimeSinceStartup - m_AnimBarStartTime;

            m_BarLength = rectTransform.GetProperSize().x;

            if (m_AnimBar == 1)
            {
                if (deltaTime < animDuration)
                {
                    Vector2 tempVector2 = m_BarRectTransform.sizeDelta;
                    tempVector2.x = Tween.CubeIn(m_AnimBarCurrentSize, m_BarLength / 2f, deltaTime, animDuration);
                    m_BarRectTransform.sizeDelta = tempVector2;

                    tempVector2   = m_BarRectTransform.anchoredPosition;
                    tempVector2.x = Tween.CubeIn(m_AnimBarCurrentPos, m_BarLength / 4f, deltaTime, animDuration);
                    m_BarRectTransform.anchoredPosition = tempVector2;
                }
                else
                {
                    Vector2 tempVector2 = m_BarRectTransform.sizeDelta;
                    tempVector2.x = m_BarLength / 2f;
                    m_BarRectTransform.sizeDelta = tempVector2;

                    tempVector2   = m_BarRectTransform.anchoredPosition;
                    tempVector2.x = m_BarLength / 4f;
                    m_BarRectTransform.anchoredPosition = tempVector2;

                    m_AnimBarCurrentSize = m_BarRectTransform.sizeDelta.x;
                    m_AnimBarCurrentPos  = m_BarRectTransform.anchoredPosition.x;
                    m_AnimBarStartTime   = Time.realtimeSinceStartup;
                    m_AnimBar            = 2;
                }
                return;
            }
            if (m_AnimBar == 2)
            {
                if (deltaTime < animDuration)
                {
                    Vector2 tempVector2 = m_BarRectTransform.sizeDelta;
                    tempVector2.x = Tween.CubeOut(m_AnimBarCurrentSize, 0f, deltaTime, animDuration);
                    m_BarRectTransform.sizeDelta = tempVector2;

                    tempVector2   = m_BarRectTransform.anchoredPosition;
                    tempVector2.x = Tween.CubeOut(m_AnimBarCurrentPos, m_BarLength, deltaTime, animDuration);
                    m_BarRectTransform.anchoredPosition = tempVector2;
                }
                else
                {
                    Vector2 tempVector2 = m_BarRectTransform.sizeDelta;
                    tempVector2.x = 0f;
                    m_BarRectTransform.sizeDelta = tempVector2;

                    tempVector2   = m_BarRectTransform.anchoredPosition;
                    tempVector2.x = 0f;
                    m_BarRectTransform.anchoredPosition = tempVector2;

                    m_AnimBarCurrentSize = m_BarRectTransform.sizeDelta.x;
                    m_AnimBarCurrentPos  = m_BarRectTransform.anchoredPosition.x;
                    m_AnimBarStartTime   = Time.realtimeSinceStartup;
                    m_AnimBar            = 1;
                }
                return;
            }
            if (m_AnimBar == 3)
            {
                if (deltaTime < animDuration && Application.isPlaying)
                {
                    Vector2 tempVector2 = m_BarRectTransform.sizeDelta;
                    tempVector2.x = Tween.CubeInOut(m_AnimBarCurrentSize, m_AnimBarTargetSize, deltaTime, animDuration);
                    m_BarRectTransform.sizeDelta = tempVector2;

                    tempVector2   = m_BarRectTransform.anchoredPosition;
                    tempVector2.x = Tween.CubeInOut(m_AnimBarCurrentPos, 0f, deltaTime, animDuration);
                    m_BarRectTransform.anchoredPosition = tempVector2;
                }
                else
                {
                    Vector2 tempVector2 = m_BarRectTransform.sizeDelta;
                    tempVector2.x = m_AnimBarTargetSize;
                    m_BarRectTransform.sizeDelta = tempVector2;

                    tempVector2   = m_BarRectTransform.anchoredPosition;
                    tempVector2.x = 0f;
                    m_BarRectTransform.anchoredPosition = tempVector2;

                    m_AnimBar = 0;
                }
            }
        }