Exemple #1
0
        public void CreateTween()
        {
            if (this.target == null)
            {
                Debug.LogWarning($"{base.gameObject.name} :: This tween's target is NULL, because the animation was created with a DOTween Pro version older than 0.9.255. To fix this, exit Play mode then simply select this object, and it will update automatically", base.gameObject);
                return;
            }
            if (this.forcedTargetType != null)
            {
                this.targetType = this.forcedTargetType;
            }
            if (this.targetType == null)
            {
                this.targetType = TypeToDOTargetType(this.target.GetType());
            }
            switch (this.animationType)
            {
            case 1:
                if (this.useTargetAsV3)
                {
                    this.isRelative = false;
                    if (this.endValueTransform == null)
                    {
                        Debug.LogWarning($"{base.gameObject.name} :: This tween's TO target is NULL, a Vector3 of (0,0,0) will be used instead", base.gameObject);
                        this.endValueV3 = Vector3.zero;
                    }
                    else
                    {
                        if (this.targetType != 5)
                        {
                            this.endValueV3 = this.endValueTransform.position;
                            break;
                        }
                        RectTransform endValueTransform = this.endValueTransform as RectTransform;
                        if (endValueTransform == null)
                        {
                            Debug.LogWarning($"{base.gameObject.name} :: This tween's TO target should be a RectTransform, a Vector3 of (0,0,0) will be used instead", base.gameObject);
                            this.endValueV3 = Vector3.zero;
                        }
                        else
                        {
                            RectTransform target = this.target as RectTransform;
                            if (target == null)
                            {
                                Debug.LogWarning($"{base.gameObject.name} :: This tween's target and TO target are not of the same type. Please reassign the values", base.gameObject);
                            }
                            else
                            {
                                this.endValueV3 = (Vector3)DOTweenUtils46.SwitchToRectTransform(endValueTransform, target);
                            }
                        }
                    }
                }
                break;

            case 2:
                base.tween = ShortcutExtensions.DOLocalMove(base.transform, this.endValueV3, this.duration, this.optionalBool0);
                goto Label_09D4;

            case 3:
            {
                TargetType targetType = this.targetType;
                if (targetType == 11)
                {
                    base.tween = ShortcutExtensions.DORotate((Transform)this.target, this.endValueV3, this.duration, this.optionalRotationMode);
                }
                else if (targetType == 9)
                {
                    base.tween = ShortcutExtensions43.DORotate((Rigidbody2D)this.target, this.endValueFloat, this.duration);
                }
                else if (targetType == 8)
                {
                    base.tween = ShortcutExtensions.DORotate((Rigidbody)this.target, this.endValueV3, this.duration, this.optionalRotationMode);
                }
                goto Label_09D4;
            }

            case 4:
                base.tween = ShortcutExtensions.DOLocalRotate(base.transform, this.endValueV3, this.duration, this.optionalRotationMode);
                goto Label_09D4;

            case 5:
                base.tween = ShortcutExtensions.DOScale(base.transform, !this.optionalBool0 ? this.endValueV3 : new Vector3(this.endValueFloat, this.endValueFloat, this.endValueFloat), this.duration);
                goto Label_09D4;

            case 6:
                this.isRelative = false;
                switch (this.targetType)
                {
                case 3:
                    base.tween = ShortcutExtensions46.DOColor((Image)this.target, this.endValueColor, this.duration);
                    break;

                case 4:
                    base.tween = ShortcutExtensions.DOColor((Light)this.target, this.endValueColor, this.duration);
                    break;

                case 6:
                    base.tween = ShortcutExtensions.DOColor(((Renderer)this.target).material, this.endValueColor, this.duration);
                    break;

                case 7:
                    base.tween = ShortcutExtensions43.DOColor((SpriteRenderer)this.target, this.endValueColor, this.duration);
                    break;

                case 10:
                    base.tween = ShortcutExtensions46.DOColor((Text)this.target, this.endValueColor, this.duration);
                    break;
                }
                goto Label_09D4;

            case 7:
                this.isRelative = false;
                switch (this.targetType)
                {
                case 2:
                    base.tween = ShortcutExtensions46.DOFade((CanvasGroup)this.target, this.endValueFloat, this.duration);
                    break;

                case 3:
                    base.tween = ShortcutExtensions46.DOFade((Image)this.target, this.endValueFloat, this.duration);
                    break;

                case 4:
                    base.tween = ShortcutExtensions.DOIntensity((Light)this.target, this.endValueFloat, this.duration);
                    break;

                case 6:
                    base.tween = ShortcutExtensions.DOFade(((Renderer)this.target).material, this.endValueFloat, this.duration);
                    break;

                case 7:
                    base.tween = ShortcutExtensions43.DOFade((SpriteRenderer)this.target, this.endValueFloat, this.duration);
                    break;

                case 10:
                    base.tween = ShortcutExtensions46.DOFade((Text)this.target, this.endValueFloat, this.duration);
                    break;
                }
                goto Label_09D4;

            case 8:
                if (this.targetType == 10)
                {
                    base.tween = ShortcutExtensions46.DOText((Text)this.target, this.endValueString, this.duration, this.optionalBool0, this.optionalScrambleMode, this.optionalString);
                }
                goto Label_09D4;

            case 9:
            {
                TargetType targetType = this.targetType;
                if (targetType == 5)
                {
                    base.tween = ShortcutExtensions46.DOPunchAnchorPos((RectTransform)this.target, this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0, this.optionalBool0);
                }
                else if (targetType == 11)
                {
                    base.tween = ShortcutExtensions.DOPunchPosition((Transform)this.target, this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0, this.optionalBool0);
                }
                goto Label_09D4;
            }

            case 10:
                base.tween = ShortcutExtensions.DOPunchRotation(base.transform, this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0);
                goto Label_09D4;

            case 11:
                base.tween = ShortcutExtensions.DOPunchScale(base.transform, this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0);
                goto Label_09D4;

            case 12:
            {
                TargetType targetType = this.targetType;
                if (targetType == 5)
                {
                    base.tween = ShortcutExtensions46.DOShakeAnchorPos((RectTransform)this.target, this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, this.optionalBool0, true);
                }
                else if (targetType == 11)
                {
                    base.tween = ShortcutExtensions.DOShakePosition((Transform)this.target, this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, this.optionalBool0, true);
                }
                goto Label_09D4;
            }

            case 13:
                base.tween = ShortcutExtensions.DOShakeRotation(base.transform, this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, true);
                goto Label_09D4;

            case 14:
                base.tween = ShortcutExtensions.DOShakeScale(base.transform, this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, true);
                goto Label_09D4;

            case 15:
                base.tween = ShortcutExtensions.DOAspect((Camera)this.target, this.endValueFloat, this.duration);
                goto Label_09D4;

            case 0x10:
                base.tween = ShortcutExtensions.DOColor((Camera)this.target, this.endValueColor, this.duration);
                goto Label_09D4;

            case 0x11:
                base.tween = ShortcutExtensions.DOFieldOfView((Camera)this.target, this.endValueFloat, this.duration);
                goto Label_09D4;

            case 0x12:
                base.tween = ShortcutExtensions.DOOrthoSize((Camera)this.target, this.endValueFloat, this.duration);
                goto Label_09D4;

            case 0x13:
                base.tween = ShortcutExtensions.DOPixelRect((Camera)this.target, this.endValueRect, this.duration);
                goto Label_09D4;

            case 20:
                base.tween = ShortcutExtensions.DORect((Camera)this.target, this.endValueRect, this.duration);
                goto Label_09D4;

            case 0x15:
                base.tween = ShortcutExtensions46.DOSizeDelta((RectTransform)this.target, !this.optionalBool0 ? this.endValueV2 : new Vector2(this.endValueFloat, this.endValueFloat), this.duration, false);
                goto Label_09D4;

            default:
                goto Label_09D4;
            }
            switch (this.targetType)
            {
            case 5:
                base.tween = ShortcutExtensions46.DOAnchorPos3D((RectTransform)this.target, this.endValueV3, this.duration, this.optionalBool0);
                break;

            case 8:
                base.tween = ShortcutExtensions.DOMove((Rigidbody)this.target, this.endValueV3, this.duration, this.optionalBool0);
                break;

            case 9:
                base.tween = ShortcutExtensions43.DOMove((Rigidbody2D)this.target, this.endValueV3, this.duration, this.optionalBool0);
                break;

            case 11:
                base.tween = ShortcutExtensions.DOMove((Transform)this.target, this.endValueV3, this.duration, this.optionalBool0);
                break;
            }
Label_09D4:
            if (base.tween == null)
            {
                return;
            }
            if (this.isFrom)
            {
                TweenSettingsExtensions.From <Tweener>((Tweener)base.tween, this.isRelative);
            }
            else
            {
                TweenSettingsExtensions.SetRelative <Tween>(base.tween, this.isRelative);
            }
            TweenSettingsExtensions.OnKill <Tween>(TweenSettingsExtensions.SetAutoKill <Tween>(TweenSettingsExtensions.SetLoops <Tween>(TweenSettingsExtensions.SetDelay <Tween>(TweenSettingsExtensions.SetTarget <Tween>(base.tween, base.gameObject), this.delay), this.loops, this.loopType), this.autoKill), new TweenCallback(this, this.< CreateTween > m__0));
            if (base.isSpeedBased)
            {
                TweenSettingsExtensions.SetSpeedBased <Tween>(base.tween);
            }
            if (this.easeType == 0x25)
            {
                TweenSettingsExtensions.SetEase <Tween>(base.tween, this.easeCurve);
            }
            else
            {
                TweenSettingsExtensions.SetEase <Tween>(base.tween, this.easeType);
            }
            if (!string.IsNullOrEmpty(this.id))
            {
                TweenSettingsExtensions.SetId <Tween>(base.tween, this.id);
            }
            TweenSettingsExtensions.SetUpdate <Tween>(base.tween, this.isIndependentUpdate);
            if (base.hasOnStart)
            {
                if (base.onStart != null)
                {
                    TweenSettingsExtensions.OnStart <Tween>(base.tween, new TweenCallback(base.onStart, this.Invoke));
                }
            }
            else
            {
                base.onStart = null;
            }
            if (base.hasOnPlay)
            {
                if (base.onPlay != null)
                {
                    TweenSettingsExtensions.OnPlay <Tween>(base.tween, new TweenCallback(base.onPlay, this.Invoke));
                }
            }
            else
            {
                base.onPlay = null;
            }
            if (base.hasOnUpdate)
            {
                if (base.onUpdate != null)
                {
                    TweenSettingsExtensions.OnUpdate <Tween>(base.tween, new TweenCallback(base.onUpdate, this.Invoke));
                }
            }
            else
            {
                base.onUpdate = null;
            }
            if (base.hasOnStepComplete)
            {
                if (base.onStepComplete != null)
                {
                    TweenSettingsExtensions.OnStepComplete <Tween>(base.tween, new TweenCallback(base.onStepComplete, this.Invoke));
                }
            }
            else
            {
                base.onStepComplete = null;
            }
            if (base.hasOnComplete)
            {
                if (base.onComplete != null)
                {
                    TweenSettingsExtensions.OnComplete <Tween>(base.tween, new TweenCallback(base.onComplete, this.Invoke));
                }
            }
            else
            {
                base.onComplete = null;
            }
            if (base.hasOnRewind)
            {
                if (base.onRewind != null)
                {
                    TweenSettingsExtensions.OnRewind <Tween>(base.tween, new TweenCallback(base.onRewind, this.Invoke));
                }
            }
            else
            {
                base.onRewind = null;
            }
            if (this.autoPlay)
            {
                TweenExtensions.Play <Tween>(base.tween);
            }
            else
            {
                TweenExtensions.Pause <Tween>(base.tween);
            }
            if (base.hasOnTweenCreated && (base.onTweenCreated != null))
            {
                base.onTweenCreated.Invoke();
            }
        }
        // Used also by DOTweenAnimationInspector when applying runtime changes and restarting
        public void CreateTween()
        {
            if (target == null)
            {
                Debug.LogWarning(string.Format("{0} :: This tween's target is NULL, because the animation was created with a DOTween Pro version older than 0.9.255. To fix this, exit Play mode then simply select this object, and it will update automatically", this.gameObject.name), this.gameObject);
                return;
            }

            if (forcedTargetType != TargetType.Unset)
            {
                targetType = forcedTargetType;
            }
            if (targetType == TargetType.Unset)
            {
                // Legacy DOTweenAnimation (made with a version older than 0.9.450) without stored targetType > assign it now
                targetType = TypeToDOTargetType(target.GetType());
            }

            switch (animationType)
            {
            case DOTweenAnimationType.None:
                break;

            case DOTweenAnimationType.Move:
                if (useTargetAsV3)
                {
                    isRelative = false;
                    if (endValueTransform == null)
                    {
                        Debug.LogWarning(string.Format("{0} :: This tween's TO target is NULL, a Vector3 of (0,0,0) will be used instead", this.gameObject.name), this.gameObject);
                        endValueV3 = Vector3.zero;
                    }
                    else
                    {
                        if (targetType == TargetType.RectTransform)
                        {
                            RectTransform endValueT = endValueTransform as RectTransform;
                            if (endValueT == null)
                            {
                                Debug.LogWarning(string.Format("{0} :: This tween's TO target should be a RectTransform, a Vector3 of (0,0,0) will be used instead", this.gameObject.name), this.gameObject);
                                endValueV3 = Vector3.zero;
                            }
                            else
                            {
                                RectTransform rTarget = target as RectTransform;
                                if (rTarget == null)
                                {
                                    Debug.LogWarning(string.Format("{0} :: This tween's target and TO target are not of the same type. Please reassign the values", this.gameObject.name), this.gameObject);
                                }
                                else
                                {
                                    // Problem: doesn't work inside Awake (ararargh!)
                                    endValueV3 = DOTweenUtils46.SwitchToRectTransform(endValueT, rTarget);
                                }
                            }
                        }
                        else
                        {
                            endValueV3 = endValueTransform.position;
                        }
                    }
                }
                switch (targetType)
                {
                case TargetType.RectTransform:
                    tween = ((RectTransform)target).DOAnchorPos3D(endValueV3, duration, optionalBool0);
                    break;

                case TargetType.Transform:
                    tween = ((Transform)target).DOMove(endValueV3, duration, optionalBool0);
                    break;

                case TargetType.Rigidbody2D:
                    tween = ((Rigidbody2D)target).DOMove(endValueV3, duration, optionalBool0);
                    break;

                case TargetType.Rigidbody:
                    tween = ((Rigidbody)target).DOMove(endValueV3, duration, optionalBool0);
                    break;
                }
                break;

            case DOTweenAnimationType.LocalMove:
                tween = transform.DOLocalMove(endValueV3, duration, optionalBool0);
                break;

            case DOTweenAnimationType.Rotate:
                switch (targetType)
                {
                case TargetType.Transform:
                    tween = ((Transform)target).DORotate(endValueV3, duration, optionalRotationMode);
                    break;

                case TargetType.Rigidbody2D:
                    tween = ((Rigidbody2D)target).DORotate(endValueFloat, duration);
                    break;

                case TargetType.Rigidbody:
                    tween = ((Rigidbody)target).DORotate(endValueV3, duration, optionalRotationMode);
                    break;
                }
                break;

            case DOTweenAnimationType.LocalRotate:
                tween = transform.DOLocalRotate(endValueV3, duration, optionalRotationMode);
                break;

            case DOTweenAnimationType.Scale:
                tween = transform.DOScale(optionalBool0 ? new Vector3(endValueFloat, endValueFloat, endValueFloat) : endValueV3, duration);
                break;

            case DOTweenAnimationType.UIWidthHeight:
                tween = ((RectTransform)target).DOSizeDelta(optionalBool0 ? new Vector2(endValueFloat, endValueFloat) : endValueV2, duration);
                break;

            case DOTweenAnimationType.Color:
                isRelative = false;
                switch (targetType)
                {
                case TargetType.SpriteRenderer:
                    tween = ((SpriteRenderer)target).DOColor(endValueColor, duration);
                    break;

                case TargetType.Renderer:
                    tween = ((Renderer)target).material.DOColor(endValueColor, duration);
                    break;

                case TargetType.Image:
                    tween = ((Image)target).DOColor(endValueColor, duration);
                    break;

                case TargetType.Text:
                    tween = ((Text)target).DOColor(endValueColor, duration);
                    break;

                case TargetType.Light:
                    tween = ((Light)target).DOColor(endValueColor, duration);
                    break;

#if DOTWEEN_TK2D
                case TargetType.tk2dTextMesh:
                    tween = ((tk2dTextMesh)target).DOColor(endValueColor, duration);
                    break;

                case TargetType.tk2dBaseSprite:
                    tween = ((tk2dBaseSprite)target).DOColor(endValueColor, duration);
                    break;
#endif
#if DOTWEEN_TMP
                case TargetType.TextMeshProUGUI:
                    tween = ((TextMeshProUGUI)target).DOColor(endValueColor, duration);
                    break;

                case TargetType.TextMeshPro:
                    tween = ((TextMeshPro)target).DOColor(endValueColor, duration);
                    break;
#endif
                }
                break;

            case DOTweenAnimationType.Fade:
                isRelative = false;
                switch (targetType)
                {
                case TargetType.SpriteRenderer:
                    tween = ((SpriteRenderer)target).DOFade(endValueFloat, duration);
                    break;

                case TargetType.Renderer:
                    tween = ((Renderer)target).material.DOFade(endValueFloat, duration);
                    break;

                case TargetType.Image:
                    tween = ((Image)target).DOFade(endValueFloat, duration);
                    break;

                case TargetType.Text:
                    tween = ((Text)target).DOFade(endValueFloat, duration);
                    break;

                case TargetType.Light:
                    tween = ((Light)target).DOIntensity(endValueFloat, duration);
                    break;

                case TargetType.CanvasGroup:
                    tween = ((CanvasGroup)target).DOFade(endValueFloat, duration);
                    break;

#if DOTWEEN_TK2D
                case TargetType.tk2dTextMesh:
                    tween = ((tk2dTextMesh)target).DOFade(endValueFloat, duration);
                    break;

                case TargetType.tk2dBaseSprite:
                    tween = ((tk2dBaseSprite)target).DOFade(endValueFloat, duration);
                    break;
#endif
#if DOTWEEN_TMP
                case TargetType.TextMeshProUGUI:
                    tween = ((TextMeshProUGUI)target).DOFade(endValueFloat, duration);
                    break;

                case TargetType.TextMeshPro:
                    tween = ((TextMeshPro)target).DOFade(endValueFloat, duration);
                    break;
#endif
                }
                break;

            case DOTweenAnimationType.Text:
                switch (targetType)
                {
                case TargetType.Text:
                    tween = ((Text)target).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    break;

#if DOTWEEN_TK2D
                case TargetType.tk2dTextMesh:
                    tween = ((tk2dTextMesh)target).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    break;
#endif
#if DOTWEEN_TMP
                case TargetType.TextMeshProUGUI:
                    tween = ((TextMeshProUGUI)target).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    break;

                case TargetType.TextMeshPro:
                    tween = ((TextMeshPro)target).DOText(endValueString, duration, optionalBool0, optionalScrambleMode, optionalString);
                    break;
#endif
                }
                break;

            case DOTweenAnimationType.PunchPosition:
                switch (targetType)
                {
                case TargetType.RectTransform:
                    tween = ((RectTransform)target).DOPunchAnchorPos(endValueV3, duration, optionalInt0, optionalFloat0, optionalBool0);
                    break;

                case TargetType.Transform:
                    tween = ((Transform)target).DOPunchPosition(endValueV3, duration, optionalInt0, optionalFloat0, optionalBool0);
                    break;
                }
                break;

            case DOTweenAnimationType.PunchScale:
                tween = transform.DOPunchScale(endValueV3, duration, optionalInt0, optionalFloat0);
                break;

            case DOTweenAnimationType.PunchRotation:
                tween = transform.DOPunchRotation(endValueV3, duration, optionalInt0, optionalFloat0);
                break;

            case DOTweenAnimationType.ShakePosition:
                switch (targetType)
                {
                case TargetType.RectTransform:
                    tween = ((RectTransform)target).DOShakeAnchorPos(duration, endValueV3, optionalInt0, optionalFloat0, optionalBool0);
                    break;

                case TargetType.Transform:
                    tween = ((Transform)target).DOShakePosition(duration, endValueV3, optionalInt0, optionalFloat0, optionalBool0);
                    break;
                }
                break;

            case DOTweenAnimationType.ShakeScale:
                tween = transform.DOShakeScale(duration, endValueV3, optionalInt0, optionalFloat0);
                break;

            case DOTweenAnimationType.ShakeRotation:
                tween = transform.DOShakeRotation(duration, endValueV3, optionalInt0, optionalFloat0);
                break;

            case DOTweenAnimationType.CameraAspect:
                tween = ((Camera)target).DOAspect(endValueFloat, duration);
                break;

            case DOTweenAnimationType.CameraBackgroundColor:
                tween = ((Camera)target).DOColor(endValueColor, duration);
                break;

            case DOTweenAnimationType.CameraFieldOfView:
                tween = ((Camera)target).DOFieldOfView(endValueFloat, duration);
                break;

            case DOTweenAnimationType.CameraOrthoSize:
                tween = ((Camera)target).DOOrthoSize(endValueFloat, duration);
                break;

            case DOTweenAnimationType.CameraPixelRect:
                tween = ((Camera)target).DOPixelRect(endValueRect, duration);
                break;

            case DOTweenAnimationType.CameraRect:
                tween = ((Camera)target).DORect(endValueRect, duration);
                break;
            }

            if (tween == null)
            {
                return;
            }

            if (isFrom)
            {
                ((Tweener)tween).From(isRelative);
            }
            else
            {
                tween.SetRelative(isRelative);
            }
            tween.SetTarget(this.gameObject).SetDelay(delay).SetLoops(loops, loopType).SetAutoKill(autoKill)
            .OnKill(() => tween = null);
            if (isSpeedBased)
            {
                tween.SetSpeedBased();
            }
            if (easeType == Ease.INTERNAL_Custom)
            {
                tween.SetEase(easeCurve);
            }
            else
            {
                tween.SetEase(easeType);
            }
            if (!string.IsNullOrEmpty(id))
            {
                tween.SetId(id);
            }
            tween.SetUpdate(isIndependentUpdate);

            if (hasOnStart)
            {
                if (onStart != null)
                {
                    tween.OnStart(onStart.Invoke);
                }
            }
            else
            {
                onStart = null;
            }
            if (hasOnPlay)
            {
                if (onPlay != null)
                {
                    tween.OnPlay(onPlay.Invoke);
                }
            }
            else
            {
                onPlay = null;
            }
            if (hasOnUpdate)
            {
                if (onUpdate != null)
                {
                    tween.OnUpdate(onUpdate.Invoke);
                }
            }
            else
            {
                onUpdate = null;
            }
            if (hasOnStepComplete)
            {
                if (onStepComplete != null)
                {
                    tween.OnStepComplete(onStepComplete.Invoke);
                }
            }
            else
            {
                onStepComplete = null;
            }
            if (hasOnComplete)
            {
                if (onComplete != null)
                {
                    tween.OnComplete(onComplete.Invoke);
                }
            }
            else
            {
                onComplete = null;
            }

            if (autoPlay)
            {
                tween.Play();
            }
            else
            {
                tween.Pause();
            }

            if (hasOnTweenCreated && onTweenCreated != null)
            {
                onTweenCreated.Invoke();
            }
        }
        // Token: 0x06000157 RID: 343 RVA: 0x000074F8 File Offset: 0x000058F8
        public void CreateTween()
        {
            if (this.target == null)
            {
                Debug.LogWarning(string.Format("{0} :: This tween's target is NULL, because the animation was created with a DOTween Pro version older than 0.9.255. To fix this, exit Play mode then simply select this object, and it will update automatically", base.gameObject.name), base.gameObject);
                return;
            }
            if (this.forcedTargetType != TargetType.Unset)
            {
                this.targetType = this.forcedTargetType;
            }
            if (this.targetType == TargetType.Unset)
            {
                this.targetType = DOTweenAnimation.TypeToDOTargetType(this.target.GetType());
            }
            switch (this.animationType)
            {
            case DOTweenAnimationType.Move:
                if (this.useTargetAsV3)
                {
                    this.isRelative = false;
                    if (this.endValueTransform == null)
                    {
                        Debug.LogWarning(string.Format("{0} :: This tween's TO target is NULL, a Vector3 of (0,0,0) will be used instead", base.gameObject.name), base.gameObject);
                        this.endValueV3 = Vector3.zero;
                    }
                    else if (this.targetType == TargetType.RectTransform)
                    {
                        RectTransform rectTransform = this.endValueTransform as RectTransform;
                        if (rectTransform == null)
                        {
                            Debug.LogWarning(string.Format("{0} :: This tween's TO target should be a RectTransform, a Vector3 of (0,0,0) will be used instead", base.gameObject.name), base.gameObject);
                            this.endValueV3 = Vector3.zero;
                        }
                        else
                        {
                            RectTransform rectTransform2 = this.target as RectTransform;
                            if (rectTransform2 == null)
                            {
                                Debug.LogWarning(string.Format("{0} :: This tween's target and TO target are not of the same type. Please reassign the values", base.gameObject.name), base.gameObject);
                            }
                            else
                            {
                                this.endValueV3 = DOTweenUtils46.SwitchToRectTransform(rectTransform, rectTransform2);
                            }
                        }
                    }
                    else
                    {
                        this.endValueV3 = this.endValueTransform.position;
                    }
                }
                switch (this.targetType)
                {
                case TargetType.RectTransform:
                    this.tween = ((RectTransform)this.target).DOAnchorPos3D(this.endValueV3, this.duration, this.optionalBool0);
                    break;

                case TargetType.Rigidbody:
                    this.tween = ((Rigidbody)this.target).DOMove(this.endValueV3, this.duration, this.optionalBool0);
                    break;

                case TargetType.Rigidbody2D:
                    this.tween = ((Rigidbody2D)this.target).DOMove(this.endValueV3, this.duration, this.optionalBool0);
                    break;

                case TargetType.Transform:
                    this.tween = ((Transform)this.target).DOMove(this.endValueV3, this.duration, this.optionalBool0);
                    break;
                }
                break;

            case DOTweenAnimationType.LocalMove:
                this.tween = base.transform.DOLocalMove(this.endValueV3, this.duration, this.optionalBool0);
                break;

            case DOTweenAnimationType.Rotate:
            {
                TargetType targetType = this.targetType;
                if (targetType != TargetType.Transform)
                {
                    if (targetType != TargetType.Rigidbody2D)
                    {
                        if (targetType == TargetType.Rigidbody)
                        {
                            this.tween = ((Rigidbody)this.target).DORotate(this.endValueV3, this.duration, this.optionalRotationMode);
                        }
                    }
                    else
                    {
                        this.tween = ((Rigidbody2D)this.target).DORotate(this.endValueFloat, this.duration);
                    }
                }
                else
                {
                    this.tween = ((Transform)this.target).DORotate(this.endValueV3, this.duration, this.optionalRotationMode);
                }
                break;
            }

            case DOTweenAnimationType.LocalRotate:
                this.tween = base.transform.DOLocalRotate(this.endValueV3, this.duration, this.optionalRotationMode);
                break;

            case DOTweenAnimationType.Scale:
                this.tween = base.transform.DOScale((!this.optionalBool0) ? this.endValueV3 : new Vector3(this.endValueFloat, this.endValueFloat, this.endValueFloat), this.duration);
                break;

            case DOTweenAnimationType.Color:
                this.isRelative = false;
                switch (this.targetType)
                {
                case TargetType.Image:
                    this.tween = ((Image)this.target).DOColor(this.endValueColor, this.duration);
                    break;

                case TargetType.Light:
                    this.tween = ((Light)this.target).DOColor(this.endValueColor, this.duration);
                    break;

                case TargetType.Renderer:
                    this.tween = ((Renderer)this.target).material.DOColor(this.endValueColor, this.duration);
                    break;

                case TargetType.SpriteRenderer:
                    this.tween = ((SpriteRenderer)this.target).DOColor(this.endValueColor, this.duration);
                    break;

                case TargetType.Text:
                    this.tween = ((Text)this.target).DOColor(this.endValueColor, this.duration);
                    break;
                }
                break;

            case DOTweenAnimationType.Fade:
                this.isRelative = false;
                switch (this.targetType)
                {
                case TargetType.CanvasGroup:
                    this.tween = ((CanvasGroup)this.target).DOFade(this.endValueFloat, this.duration);
                    break;

                case TargetType.Image:
                    this.tween = ((Image)this.target).DOFade(this.endValueFloat, this.duration);
                    break;

                case TargetType.Light:
                    this.tween = ((Light)this.target).DOIntensity(this.endValueFloat, this.duration);
                    break;

                case TargetType.Renderer:
                    this.tween = ((Renderer)this.target).material.DOFade(this.endValueFloat, this.duration);
                    break;

                case TargetType.SpriteRenderer:
                    this.tween = ((SpriteRenderer)this.target).DOFade(this.endValueFloat, this.duration);
                    break;

                case TargetType.Text:
                    this.tween = ((Text)this.target).DOFade(this.endValueFloat, this.duration);
                    break;
                }
                break;

            case DOTweenAnimationType.Text:
            {
                TargetType targetType2 = this.targetType;
                if (targetType2 == TargetType.Text)
                {
                    this.tween = ((Text)this.target).DOText(this.endValueString, this.duration, this.optionalBool0, this.optionalScrambleMode, this.optionalString);
                }
                break;
            }

            case DOTweenAnimationType.PunchPosition:
            {
                TargetType targetType3 = this.targetType;
                if (targetType3 != TargetType.RectTransform)
                {
                    if (targetType3 == TargetType.Transform)
                    {
                        this.tween = ((Transform)this.target).DOPunchPosition(this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0, this.optionalBool0);
                    }
                }
                else
                {
                    this.tween = ((RectTransform)this.target).DOPunchAnchorPos(this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0, this.optionalBool0);
                }
                break;
            }

            case DOTweenAnimationType.PunchRotation:
                this.tween = base.transform.DOPunchRotation(this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0);
                break;

            case DOTweenAnimationType.PunchScale:
                this.tween = base.transform.DOPunchScale(this.endValueV3, this.duration, this.optionalInt0, this.optionalFloat0);
                break;

            case DOTweenAnimationType.ShakePosition:
            {
                TargetType targetType4 = this.targetType;
                if (targetType4 != TargetType.RectTransform)
                {
                    if (targetType4 == TargetType.Transform)
                    {
                        this.tween = ((Transform)this.target).DOShakePosition(this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, this.optionalBool0, true);
                    }
                }
                else
                {
                    this.tween = ((RectTransform)this.target).DOShakeAnchorPos(this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, this.optionalBool0, true);
                }
                break;
            }

            case DOTweenAnimationType.ShakeRotation:
                this.tween = base.transform.DOShakeRotation(this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, true);
                break;

            case DOTweenAnimationType.ShakeScale:
                this.tween = base.transform.DOShakeScale(this.duration, this.endValueV3, this.optionalInt0, this.optionalFloat0, true);
                break;

            case DOTweenAnimationType.CameraAspect:
                this.tween = ((Camera)this.target).DOAspect(this.endValueFloat, this.duration);
                break;

            case DOTweenAnimationType.CameraBackgroundColor:
                this.tween = ((Camera)this.target).DOColor(this.endValueColor, this.duration);
                break;

            case DOTweenAnimationType.CameraFieldOfView:
                this.tween = ((Camera)this.target).DOFieldOfView(this.endValueFloat, this.duration);
                break;

            case DOTweenAnimationType.CameraOrthoSize:
                this.tween = ((Camera)this.target).DOOrthoSize(this.endValueFloat, this.duration);
                break;

            case DOTweenAnimationType.CameraPixelRect:
                this.tween = ((Camera)this.target).DOPixelRect(this.endValueRect, this.duration);
                break;

            case DOTweenAnimationType.CameraRect:
                this.tween = ((Camera)this.target).DORect(this.endValueRect, this.duration);
                break;

            case DOTweenAnimationType.UIWidthHeight:
                this.tween = ((RectTransform)this.target).DOSizeDelta((!this.optionalBool0) ? this.endValueV2 : new Vector2(this.endValueFloat, this.endValueFloat), this.duration, false);
                break;
            }
            if (this.tween == null)
            {
                return;
            }
            if (this.isFrom)
            {
                ((Tweener)this.tween).From(this.isRelative);
            }
            else
            {
                this.tween.SetRelative(this.isRelative);
            }
            this.tween.SetTarget(base.gameObject).SetDelay(this.delay).SetLoops(this.loops, this.loopType).SetAutoKill(this.autoKill).OnKill(delegate
            {
                this.tween = null;
            });
            if (this.isSpeedBased)
            {
                this.tween.SetSpeedBased <Tween>();
            }
            if (this.easeType == Ease.INTERNAL_Custom)
            {
                this.tween.SetEase(this.easeCurve);
            }
            else
            {
                this.tween.SetEase(this.easeType);
            }
            if (!string.IsNullOrEmpty(this.id))
            {
                this.tween.SetId(this.id);
            }
            this.tween.SetUpdate(this.isIndependentUpdate);
            if (this.hasOnStart)
            {
                if (this.onStart != null)
                {
                    this.tween.OnStart(new TweenCallback(this.onStart.Invoke));
                }
            }
            else
            {
                this.onStart = null;
            }
            if (this.hasOnPlay)
            {
                if (this.onPlay != null)
                {
                    this.tween.OnPlay(new TweenCallback(this.onPlay.Invoke));
                }
            }
            else
            {
                this.onPlay = null;
            }
            if (this.hasOnUpdate)
            {
                if (this.onUpdate != null)
                {
                    this.tween.OnUpdate(new TweenCallback(this.onUpdate.Invoke));
                }
            }
            else
            {
                this.onUpdate = null;
            }
            if (this.hasOnStepComplete)
            {
                if (this.onStepComplete != null)
                {
                    this.tween.OnStepComplete(new TweenCallback(this.onStepComplete.Invoke));
                }
            }
            else
            {
                this.onStepComplete = null;
            }
            if (this.hasOnComplete)
            {
                if (this.onComplete != null)
                {
                    this.tween.OnComplete(new TweenCallback(this.onComplete.Invoke));
                }
            }
            else
            {
                this.onComplete = null;
            }
            if (this.hasOnRewind)
            {
                if (this.onRewind != null)
                {
                    this.tween.OnRewind(new TweenCallback(this.onRewind.Invoke));
                }
            }
            else
            {
                this.onRewind = null;
            }
            if (this.autoPlay)
            {
                this.tween.Play <Tween>();
            }
            else
            {
                this.tween.Pause <Tween>();
            }
            if (this.hasOnTweenCreated && this.onTweenCreated != null)
            {
                this.onTweenCreated.Invoke();
            }
        }