closestRot() public static method

public static closestRot ( float from, float to ) : float
from float
to float
return float
Esempio n. 1
0
    // This method is only for internal use
    public void init()
    {
        this.hasInitiliazed = true;

        if (this.onStart != null)
        {
            this.onStart();
        }

        // Initialize From Values
        switch (this.type)
        {
        case TweenAction.MOVE:
        case TweenAction.MOVE_TO_TRANSFORM:
            this.from = trans.position; break;

        case TweenAction.MOVE_X:
            this.fromInternal.x = trans.position.x; break;

        case TweenAction.MOVE_Y:
            this.fromInternal.x = trans.position.y; break;

        case TweenAction.MOVE_Z:
            this.fromInternal.x = trans.position.z; break;

        case TweenAction.MOVE_LOCAL_X:
            this.fromInternal.x = trans.localPosition.x; break;

        case TweenAction.MOVE_LOCAL_Y:
            this.fromInternal.x = trans.localPosition.y; break;

        case TweenAction.MOVE_LOCAL_Z:
            this.fromInternal.x = trans.localPosition.z; break;

        case TweenAction.SCALE_X:
            this.fromInternal.x = trans.localScale.x; break;

        case TweenAction.SCALE_Y:
            this.fromInternal.x = trans.localScale.y; break;

        case TweenAction.SCALE_Z:
            this.fromInternal.x = trans.localScale.z; break;

        case TweenAction.ALPHA:
                                #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
            if (trans.gameObject.renderer)
            {
                this.fromInternal.x = trans.gameObject.renderer.material.color.a;
            }
            else if (trans.childCount > 0)
            {
                foreach (Transform child in trans)
                {
                    if (child.gameObject.renderer != null)
                    {
                        Color col = child.gameObject.renderer.material.color;
                        this.fromInternal.x = col.a;
                        break;
                    }
                }
            }
            break;
                                #else
            SpriteRenderer ren = trans.gameObject.GetComponent <SpriteRenderer>();
            if (ren != null)
            {
                this.fromInternal.x = ren.color.a;
            }
            else
            {
                if (trans.gameObject.GetComponent <Renderer>() != null && trans.gameObject.GetComponent <Renderer>().material.HasProperty("_Color"))
                {
                    this.fromInternal.x = trans.gameObject.GetComponent <Renderer>().material.color.a;
                }
                else if (trans.gameObject.GetComponent <Renderer>() != null && trans.gameObject.GetComponent <Renderer>().material.HasProperty("_TintColor"))
                {
                    Color col = trans.gameObject.GetComponent <Renderer>().material.GetColor("_TintColor");
                    this.fromInternal.x = col.a;
                }
                else if (trans.childCount > 0)
                {
                    foreach (Transform child in trans)
                    {
                        if (child.gameObject.GetComponent <Renderer>() != null)
                        {
                            Color col = child.gameObject.GetComponent <Renderer>().material.color;
                            this.fromInternal.x = col.a;
                            break;
                        }
                    }
                }
            }
            break;
                                #endif
        case TweenAction.MOVE_LOCAL:
            this.from = trans.localPosition; break;

        case TweenAction.MOVE_CURVED:
        case TweenAction.MOVE_CURVED_LOCAL:
        case TweenAction.MOVE_SPLINE:
        case TweenAction.MOVE_SPLINE_LOCAL:
            this.fromInternal.x = 0; break;

        case TweenAction.ROTATE:
            this.from = trans.eulerAngles;
            this.to   = new Vector3(LeanTween.closestRot(this.fromInternal.x, this.toInternal.x), LeanTween.closestRot(this.from.y, this.to.y), LeanTween.closestRot(this.from.z, this.to.z));
            break;

        case TweenAction.ROTATE_X:
            this.fromInternal.x = trans.eulerAngles.x;
            this.toInternal.x   = LeanTween.closestRot(this.fromInternal.x, this.toInternal.x);
            break;

        case TweenAction.ROTATE_Y:
            this.fromInternal.x = trans.eulerAngles.y;
            this.toInternal.x   = LeanTween.closestRot(this.fromInternal.x, this.toInternal.x);
            break;

        case TweenAction.ROTATE_Z:
            this.fromInternal.x = trans.eulerAngles.z;
            this.toInternal.x   = LeanTween.closestRot(this.fromInternal.x, this.toInternal.x);
            break;

        case TweenAction.ROTATE_AROUND:
            this.lastVal        = 0.0f;              // optional["last"]
            this.fromInternal.x = 0.0f;
            this.origRotation   = trans.rotation;    // optional["origRotation"
            break;

        case TweenAction.ROTATE_AROUND_LOCAL:
            this.lastVal        = 0.0f;                // optional["last"]
            this.fromInternal.x = 0.0f;
            this.origRotation   = trans.localRotation; // optional["origRotation"
            break;

        case TweenAction.ROTATE_LOCAL:
            this.from = trans.localEulerAngles;
            this.to   = new Vector3(LeanTween.closestRot(this.fromInternal.x, this.toInternal.x), LeanTween.closestRot(this.from.y, this.to.y), LeanTween.closestRot(this.from.z, this.to.z));
            break;

        case TweenAction.SCALE:
            this.from = trans.localScale; break;

        case TweenAction.GUI_MOVE:
            this.from = new Vector3(this.ltRect.rect.x, this.ltRect.rect.y, 0); break;

        case TweenAction.GUI_MOVE_MARGIN:
            this.from = new Vector2(this.ltRect.margin.x, this.ltRect.margin.y); break;

        case TweenAction.GUI_SCALE:
            this.from = new Vector3(this.ltRect.rect.width, this.ltRect.rect.height, 0); break;

        case TweenAction.GUI_ALPHA:
            this.fromInternal.x = this.ltRect.alpha; break;

        case TweenAction.GUI_ROTATE:
            if (this.ltRect.rotateEnabled == false)
            {
                this.ltRect.rotateEnabled = true;
                this.ltRect.resetForRotation();
            }

            this.fromInternal.x = this.ltRect.rotation; break;

        case TweenAction.ALPHA_VERTEX:
            this.fromInternal.x = trans.GetComponent <MeshFilter>().mesh.colors32[0].a;
            break;

        case TweenAction.CALLBACK:
            break;

        case TweenAction.CALLBACK_COLOR:
            this.diff = new Vector3(1.0f, 0.0f, 0.0f);
            break;

        case TweenAction.COLOR:
                                #if UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
            if (trans.gameObject.renderer)
            {
                Color col = trans.gameObject.renderer.material.color;
                this.setFromColor(col);
            }
            else if (trans.childCount > 0)
            {
                foreach (Transform child in trans)
                {
                    if (child.gameObject.renderer != null)
                    {
                        Color col = child.gameObject.renderer.material.color;
                        this.setFromColor(col);
                        break;
                    }
                }
            }
                                #else
            SpriteRenderer renColor = trans.gameObject.GetComponent <SpriteRenderer>();
            if (renColor != null)
            {
                Color col = renColor.color;
                this.setFromColor(col);
            }
            else
            {
                if (trans.gameObject.GetComponent <Renderer>() != null && trans.gameObject.GetComponent <Renderer>().material.HasProperty("_Color"))
                {
                    Color col = trans.gameObject.GetComponent <Renderer>().material.color;
                    this.setFromColor(col);
                }
                else if (trans.gameObject.GetComponent <Renderer>() != null && trans.gameObject.GetComponent <Renderer>().material.HasProperty("_TintColor"))
                {
                    Color col = trans.gameObject.GetComponent <Renderer>().material.GetColor("_TintColor");
                    this.setFromColor(col);
                }
                else if (trans.childCount > 0)
                {
                    foreach (Transform child in trans)
                    {
                        if (child.gameObject.GetComponent <Renderer>() != null)
                        {
                            Color col = child.gameObject.GetComponent <Renderer>().material.color;
                            this.setFromColor(col);
                            break;
                        }
                    }
                }
            }
                                #endif
            break;

                        #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2 && !UNITY_4_3 && !UNITY_4_5
        case TweenAction.CANVAS_ALPHA:
            this.uiImage = trans.gameObject.GetComponent <UnityEngine.UI.Image>();
            if (this.uiImage != null)
            {
                this.fromInternal.x = this.uiImage.color.a;
            }
            else
            {
                this.fromInternal.x = 1f;
            }
            break;

        case TweenAction.CANVAS_COLOR:
            this.uiImage = trans.gameObject.GetComponent <UnityEngine.UI.Image>();
            if (this.uiImage != null)
            {
                this.setFromColor(this.uiImage.color);
            }
            else
            {
                this.setFromColor(Color.white);
            }
            break;

        case TweenAction.CANVASGROUP_ALPHA:
            this.fromInternal.x = trans.gameObject.GetComponent <CanvasGroup>().alpha;
            break;

        case TweenAction.TEXT_ALPHA:
            this.uiText = trans.gameObject.GetComponent <UnityEngine.UI.Text>();
            if (this.uiText != null)
            {
                this.fromInternal.x = this.uiText.color.a;
            }
            else
            {
                this.fromInternal.x = 1f;
            }
            break;

        case TweenAction.TEXT_COLOR:
            this.uiText = trans.gameObject.GetComponent <UnityEngine.UI.Text>();
            if (this.uiText != null)
            {
                this.setFromColor(this.uiText.color);
            }
            else
            {
                this.setFromColor(Color.white);
            }
            break;

        case TweenAction.CANVAS_MOVE:
            this.fromInternal = this.rectTransform.anchoredPosition3D; break;

        case TweenAction.CANVAS_MOVE_X:
            this.fromInternal.x = this.rectTransform.anchoredPosition3D.x; break;

        case TweenAction.CANVAS_MOVE_Y:
            this.fromInternal.x = this.rectTransform.anchoredPosition3D.y; break;

        case TweenAction.CANVAS_MOVE_Z:
            this.fromInternal.x = this.rectTransform.anchoredPosition3D.z; break;

        case TweenAction.CANVAS_ROTATEAROUND:
        case TweenAction.CANVAS_ROTATEAROUND_LOCAL:
            this.lastVal        = 0.0f;
            this.fromInternal.x = 0.0f;
            this.origRotation   = this.rectTransform.rotation;
            break;

        case TweenAction.CANVAS_SCALE:
            this.from = this.rectTransform.localScale; break;

        case TweenAction.CANVAS_PLAYSPRITE:
            this.uiImage        = trans.gameObject.GetComponent <UnityEngine.UI.Image>();
            this.fromInternal.x = 0f;
            break;
                        #endif
        }
        if (this.type != TweenAction.CALLBACK_COLOR && this.type != TweenAction.COLOR && this.type != TweenAction.TEXT_COLOR && this.type != TweenAction.CANVAS_COLOR)
        {
            this.diff = this.to - this.from;
        }
        if (this.onCompleteOnStart)
        {
            if (this.onComplete != null)
            {
                this.onComplete();
            }
            else if (this.onCompleteObject != null)
            {
                this.onCompleteObject(this.onCompleteParam);
            }
        }
    }
        public void init()
        {
            this.hasInitiliazed = true;
            if (this.onStart != null)
            {
                this.onStart.Invoke();
            }
            switch (this.type)
            {
            case TweenAction.MOVE_X:
                this.from.x = this.trans.get_position().x;
                break;

            case TweenAction.MOVE_Y:
                this.from.x = this.trans.get_position().y;
                break;

            case TweenAction.MOVE_Z:
                this.from.x = this.trans.get_position().z;
                break;

            case TweenAction.MOVE_LOCAL_X:
                this.from.x = this.trans.get_localPosition().x;
                break;

            case TweenAction.MOVE_LOCAL_Y:
                this.from.x = this.trans.get_localPosition().y;
                break;

            case TweenAction.MOVE_LOCAL_Z:
                this.from.x = this.trans.get_localPosition().z;
                break;

            case TweenAction.MOVE_CURVED:
            case TweenAction.MOVE_CURVED_LOCAL:
            case TweenAction.MOVE_SPLINE:
            case TweenAction.MOVE_SPLINE_LOCAL:
                this.from.x = 0f;
                break;

            case TweenAction.SCALE_X:
                this.from.x = this.trans.get_localScale().x;
                break;

            case TweenAction.SCALE_Y:
                this.from.x = this.trans.get_localScale().y;
                break;

            case TweenAction.SCALE_Z:
                this.from.x = this.trans.get_localScale().z;
                break;

            case TweenAction.ROTATE_X:
                this.from.x = this.trans.get_eulerAngles().x;
                this.to.x   = LeanTween.closestRot(this.from.x, this.to.x);
                break;

            case TweenAction.ROTATE_Y:
                this.from.x = this.trans.get_eulerAngles().y;
                this.to.x   = LeanTween.closestRot(this.from.x, this.to.x);
                break;

            case TweenAction.ROTATE_Z:
                this.from.x = this.trans.get_eulerAngles().z;
                this.to.x   = LeanTween.closestRot(this.from.x, this.to.x);
                break;

            case TweenAction.ROTATE_AROUND:
                this.lastVal      = 0f;
                this.from.x       = 0f;
                this.origRotation = this.trans.get_rotation();
                break;

            case TweenAction.ROTATE_AROUND_LOCAL:
                this.lastVal      = 0f;
                this.from.x       = 0f;
                this.origRotation = this.trans.get_localRotation();
                break;

            case TweenAction.CANVAS_ROTATEAROUND:
            case TweenAction.CANVAS_ROTATEAROUND_LOCAL:
                this.lastVal      = 0f;
                this.from.x       = 0f;
                this.origRotation = this.rectTransform.get_rotation();
                break;

            case TweenAction.CANVAS_PLAYSPRITE:
                this.uiImage = this.trans.get_gameObject().GetComponent <Image>();
                this.from.x  = 0f;
                break;

            case TweenAction.ALPHA:
            {
                SpriteRenderer component = this.trans.get_gameObject().GetComponent <SpriteRenderer>();
                if (component != null)
                {
                    this.from.x = component.get_color().a;
                }
                else if (this.trans.get_gameObject().GetComponent <Renderer>() != null && this.trans.get_gameObject().GetComponent <Renderer>().get_material().HasProperty("_Color"))
                {
                    this.from.x = this.trans.get_gameObject().GetComponent <Renderer>().get_material().get_color().a;
                }
                else if (this.trans.get_gameObject().GetComponent <Renderer>() != null && this.trans.get_gameObject().GetComponent <Renderer>().get_material().HasProperty("_TintColor"))
                {
                    this.from.x = this.trans.get_gameObject().GetComponent <Renderer>().get_material().GetColor("_TintColor").a;
                }
                else if (this.trans.get_childCount() > 0)
                {
                    using (IEnumerator enumerator = this.trans.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            Transform transform = (Transform)enumerator.get_Current();
                            if (transform.get_gameObject().GetComponent <Renderer>() != null)
                            {
                                this.from.x = transform.get_gameObject().GetComponent <Renderer>().get_material().get_color().a;
                                break;
                            }
                        }
                    }
                }
                break;
            }

            case TweenAction.TEXT_ALPHA:
                this.uiText = this.trans.get_gameObject().GetComponent <Text>();
                if (this.uiText != null)
                {
                    this.from.x = this.uiText.get_color().a;
                }
                break;

            case TweenAction.CANVAS_ALPHA:
                this.uiImage = this.trans.get_gameObject().GetComponent <Image>();
                if (this.uiImage != null)
                {
                    this.from.x = this.uiImage.get_color().a;
                }
                break;

            case TweenAction.ALPHA_VERTEX:
                this.from.x = (float)this.trans.GetComponent <MeshFilter>().get_mesh().get_colors32()[0].a;
                break;

            case TweenAction.COLOR:
            {
                SpriteRenderer component2 = this.trans.get_gameObject().GetComponent <SpriteRenderer>();
                if (component2 != null)
                {
                    Color color = component2.get_color();
                    this.setFromColor(color);
                }
                else if (this.trans.get_gameObject().GetComponent <Renderer>() != null && this.trans.get_gameObject().GetComponent <Renderer>().get_material().HasProperty("_Color"))
                {
                    Color color2 = this.trans.get_gameObject().GetComponent <Renderer>().get_material().get_color();
                    this.setFromColor(color2);
                }
                else if (this.trans.get_gameObject().GetComponent <Renderer>() != null && this.trans.get_gameObject().GetComponent <Renderer>().get_material().HasProperty("_TintColor"))
                {
                    Color color3 = this.trans.get_gameObject().GetComponent <Renderer>().get_material().GetColor("_TintColor");
                    this.setFromColor(color3);
                }
                else if (this.trans.get_childCount() > 0)
                {
                    using (IEnumerator enumerator2 = this.trans.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            Transform transform2 = (Transform)enumerator2.get_Current();
                            if (transform2.get_gameObject().GetComponent <Renderer>() != null)
                            {
                                Color color4 = transform2.get_gameObject().GetComponent <Renderer>().get_material().get_color();
                                this.setFromColor(color4);
                                break;
                            }
                        }
                    }
                }
                break;
            }

            case TweenAction.CALLBACK_COLOR:
                this.diff = new Vector3(1f, 0f, 0f);
                break;

            case TweenAction.TEXT_COLOR:
                this.uiText = this.trans.get_gameObject().GetComponent <Text>();
                if (this.uiText != null)
                {
                    this.setFromColor(this.uiText.get_color());
                }
                break;

            case TweenAction.CANVAS_COLOR:
                this.uiImage = this.trans.get_gameObject().GetComponent <Image>();
                if (this.uiImage != null)
                {
                    this.setFromColor(this.uiImage.get_color());
                }
                break;

            case TweenAction.CANVAS_MOVE_X:
                this.from.x = this.rectTransform.get_anchoredPosition3D().x;
                break;

            case TweenAction.CANVAS_MOVE_Y:
                this.from.x = this.rectTransform.get_anchoredPosition3D().y;
                break;

            case TweenAction.CANVAS_MOVE_Z:
                this.from.x = this.rectTransform.get_anchoredPosition3D().z;
                break;

            case TweenAction.MOVE:
                this.from = this.trans.get_position();
                break;

            case TweenAction.MOVE_LOCAL:
                this.from = this.trans.get_localPosition();
                break;

            case TweenAction.ROTATE:
                this.from = this.trans.get_eulerAngles();
                this.to   = new Vector3(LeanTween.closestRot(this.from.x, this.to.x), LeanTween.closestRot(this.from.y, this.to.y), LeanTween.closestRot(this.from.z, this.to.z));
                break;

            case TweenAction.ROTATE_LOCAL:
                this.from = this.trans.get_localEulerAngles();
                this.to   = new Vector3(LeanTween.closestRot(this.from.x, this.to.x), LeanTween.closestRot(this.from.y, this.to.y), LeanTween.closestRot(this.from.z, this.to.z));
                break;

            case TweenAction.SCALE:
                this.from = this.trans.get_localScale();
                break;

            case TweenAction.GUI_MOVE:
                this.from = new Vector3(this.ltRect.rect.get_x(), this.ltRect.rect.get_y(), 0f);
                break;

            case TweenAction.GUI_MOVE_MARGIN:
                this.from = new Vector2(this.ltRect.margin.x, this.ltRect.margin.y);
                break;

            case TweenAction.GUI_SCALE:
                this.from = new Vector3(this.ltRect.rect.get_width(), this.ltRect.rect.get_height(), 0f);
                break;

            case TweenAction.GUI_ALPHA:
                this.from.x = this.ltRect.alpha;
                break;

            case TweenAction.GUI_ROTATE:
                if (!this.ltRect.rotateEnabled)
                {
                    this.ltRect.rotateEnabled = true;
                    this.ltRect.resetForRotation();
                }
                this.from.x = this.ltRect.rotation;
                break;

            case TweenAction.CANVAS_MOVE:
                this.from = this.rectTransform.get_anchoredPosition3D();
                break;

            case TweenAction.CANVAS_SCALE:
                this.from = this.rectTransform.get_localScale();
                break;
            }
            if (this.type != TweenAction.CALLBACK_COLOR && this.type != TweenAction.COLOR && this.type != TweenAction.TEXT_COLOR && this.type != TweenAction.CANVAS_COLOR)
            {
                this.diff = this.to - this.from;
            }
            if (this.onCompleteOnStart)
            {
                if (this.onComplete != null)
                {
                    this.onComplete.Invoke();
                }
                else if (this.onCompleteObject != null)
                {
                    this.onCompleteObject.Invoke(this.onCompleteParam);
                }
            }
        }
Esempio n. 3
0
    public void init()
    {
        this.hasInitiliazed = true;
        switch (this.type)
        {
        case TweenAction.MOVE_X:
            this.from.x = this.trans.position.x;
            break;

        case TweenAction.MOVE_Y:
            this.from.x = this.trans.position.y;
            break;

        case TweenAction.MOVE_Z:
            this.from.x = this.trans.position.z;
            break;

        case TweenAction.MOVE_LOCAL_X:
            this.from.x = this.trans.localPosition.x;
            break;

        case TweenAction.MOVE_LOCAL_Y:
            this.from.x = this.trans.localPosition.y;
            break;

        case TweenAction.MOVE_LOCAL_Z:
            this.from.x = this.trans.localPosition.z;
            break;

        case TweenAction.MOVE_CURVED:
        case TweenAction.MOVE_CURVED_LOCAL:
        case TweenAction.MOVE_SPLINE:
        case TweenAction.MOVE_SPLINE_LOCAL:
            this.from.x = 0f;
            break;

        case TweenAction.SCALE_X:
            this.from.x = this.trans.localScale.x;
            break;

        case TweenAction.SCALE_Y:
            this.from.x = this.trans.localScale.y;
            break;

        case TweenAction.SCALE_Z:
            this.from.x = this.trans.localScale.z;
            break;

        case TweenAction.ROTATE_X:
            this.from.x = this.trans.eulerAngles.x;
            this.to.x   = LeanTween.closestRot(this.from.x, this.to.x);
            break;

        case TweenAction.ROTATE_Y:
            this.from.x = this.trans.eulerAngles.y;
            this.to.x   = LeanTween.closestRot(this.from.x, this.to.x);
            break;

        case TweenAction.ROTATE_Z:
            this.from.x = this.trans.eulerAngles.z;
            this.to.x   = LeanTween.closestRot(this.from.x, this.to.x);
            break;

        case TweenAction.ROTATE_AROUND:
            this.lastVal      = 0f;
            this.from.x       = 0f;
            this.origRotation = this.trans.rotation;
            break;

        case TweenAction.ROTATE_AROUND_LOCAL:
            this.lastVal      = 0f;
            this.from.x       = 0f;
            this.origRotation = this.trans.localRotation;
            break;

        case TweenAction.CANVAS_ROTATEAROUND:
        case TweenAction.CANVAS_ROTATEAROUND_LOCAL:
            this.lastVal      = 0f;
            this.from.x       = 0f;
            this.origRotation = this.rectTransform.rotation;
            break;

        case TweenAction.CANVAS_PLAYSPRITE:
            this.uiImage = this.trans.gameObject.GetComponent <Image>();
            this.from.x  = 0f;
            break;

        case TweenAction.ALPHA:
        {
            SpriteRenderer component = this.trans.gameObject.GetComponent <SpriteRenderer>();
            if (component == null)
            {
                if ((this.trans.gameObject.GetComponent <Renderer>() != null) && this.trans.gameObject.GetComponent <Renderer>().material.HasProperty("_Color"))
                {
                    this.from.x = this.trans.gameObject.GetComponent <Renderer>().material.color.a;
                }
                else if ((this.trans.gameObject.GetComponent <Renderer>() != null) && this.trans.gameObject.GetComponent <Renderer>().material.HasProperty("_TintColor"))
                {
                    Color color = this.trans.gameObject.GetComponent <Renderer>().material.GetColor("_TintColor");
                    this.from.x = color.a;
                }
                else if (this.trans.childCount > 0)
                {
                    IEnumerator enumerator = this.trans.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            Transform current = (Transform)enumerator.Current;
                            if (current.gameObject.GetComponent <Renderer>() != null)
                            {
                                Color color2 = current.gameObject.GetComponent <Renderer>().material.color;
                                this.from.x = color2.a;
                                break;
                            }
                        }
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable == null)
                        {
                        }
                        disposable.Dispose();
                    }
                }
                break;
            }
            this.from.x = component.color.a;
            break;
        }

        case TweenAction.TEXT_ALPHA:
            this.uiText = this.trans.gameObject.GetComponent <Text>();
            if (this.uiText != null)
            {
                this.from.x = this.uiText.color.a;
            }
            break;

        case TweenAction.CANVAS_ALPHA:
            this.uiImage = this.trans.gameObject.GetComponent <Image>();
            if (this.uiImage != null)
            {
                this.from.x = this.uiImage.color.a;
            }
            break;

        case TweenAction.ALPHA_VERTEX:
            this.from.x = this.trans.GetComponent <MeshFilter>().mesh.colors32[0].a;
            break;

        case TweenAction.COLOR:
        {
            if ((this.trans.gameObject.GetComponent <Renderer>() == null) || !this.trans.gameObject.GetComponent <Renderer>().material.HasProperty("_Color"))
            {
                if ((this.trans.gameObject.GetComponent <Renderer>() != null) && this.trans.gameObject.GetComponent <Renderer>().material.HasProperty("_TintColor"))
                {
                    Color color4 = this.trans.gameObject.GetComponent <Renderer>().material.GetColor("_TintColor");
                    this.setFromColor(color4);
                }
                else if (this.trans.childCount > 0)
                {
                    IEnumerator enumerator2 = this.trans.GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            Transform transform2 = (Transform)enumerator2.Current;
                            if (transform2.gameObject.GetComponent <Renderer>() != null)
                            {
                                Color color5 = transform2.gameObject.GetComponent <Renderer>().material.color;
                                this.setFromColor(color5);
                                break;
                            }
                        }
                    }
                    finally
                    {
                        IDisposable disposable2 = enumerator2 as IDisposable;
                        if (disposable2 == null)
                        {
                        }
                        disposable2.Dispose();
                    }
                }
                break;
            }
            Color col = this.trans.gameObject.GetComponent <Renderer>().material.color;
            this.setFromColor(col);
            break;
        }

        case TweenAction.CALLBACK_COLOR:
            this.diff = new Vector3(1f, 0f, 0f);
            break;

        case TweenAction.TEXT_COLOR:
            this.uiText = this.trans.gameObject.GetComponent <Text>();
            if (this.uiText != null)
            {
                this.setFromColor(this.uiText.color);
            }
            break;

        case TweenAction.CANVAS_COLOR:
            this.uiImage = this.trans.gameObject.GetComponent <Image>();
            if (this.uiImage != null)
            {
                this.setFromColor(this.uiImage.color);
            }
            break;

        case TweenAction.CALLBACK:
            if (this.onCompleteOnStart)
            {
                if (this.onComplete == null)
                {
                    if (this.onCompleteObject != null)
                    {
                        this.onCompleteObject(this.onCompleteParam);
                    }
                    break;
                }
                this.onComplete.Invoke();
            }
            break;

        case TweenAction.MOVE:
            this.from = this.trans.position;
            break;

        case TweenAction.MOVE_LOCAL:
            this.from = this.trans.localPosition;
            break;

        case TweenAction.ROTATE:
        {
            this.from = this.trans.eulerAngles;
            float x = LeanTween.closestRot(this.from.x, this.to.x);
            float y = LeanTween.closestRot(this.from.y, this.to.y);
            this.to = new Vector3(x, y, LeanTween.closestRot(this.from.z, this.to.z));
            break;
        }

        case TweenAction.ROTATE_LOCAL:
        {
            this.from = this.trans.localEulerAngles;
            float introduced35 = LeanTween.closestRot(this.from.x, this.to.x);
            float introduced36 = LeanTween.closestRot(this.from.y, this.to.y);
            this.to = new Vector3(introduced35, introduced36, LeanTween.closestRot(this.from.z, this.to.z));
            break;
        }

        case TweenAction.SCALE:
            this.from = this.trans.localScale;
            break;

        case TweenAction.GUI_MOVE:
            this.from = new Vector3(this.ltRect.rect.x, this.ltRect.rect.y, 0f);
            break;

        case TweenAction.GUI_MOVE_MARGIN:
            this.from = (Vector3) new Vector2(this.ltRect.margin.x, this.ltRect.margin.y);
            break;

        case TweenAction.GUI_SCALE:
            this.from = new Vector3(this.ltRect.rect.width, this.ltRect.rect.height, 0f);
            break;

        case TweenAction.GUI_ALPHA:
            this.from.x = this.ltRect.alpha;
            break;

        case TweenAction.GUI_ROTATE:
            if (!this.ltRect.rotateEnabled)
            {
                this.ltRect.rotateEnabled = true;
                this.ltRect.resetForRotation();
            }
            this.from.x = this.ltRect.rotation;
            break;

        case TweenAction.CANVAS_MOVE:
            this.from = this.rectTransform.anchoredPosition3D;
            break;

        case TweenAction.CANVAS_SCALE:
            this.from = this.rectTransform.localScale;
            break;
        }
        if (((this.type != TweenAction.CALLBACK_COLOR) && (this.type != TweenAction.COLOR)) && ((this.type != TweenAction.TEXT_COLOR) && (this.type != TweenAction.CANVAS_COLOR)))
        {
            this.diff = this.to - this.from;
        }
    }