예제 #1
0
        // Checks if a Component that can be animated with the given animationType is attached to the src
        bool Validate(GameObject targetGO)
        {
            if (_src.animationType == DOTweenAnimation.AnimationType.None)
            {
                return(false);
            }

            Component srcTarget;

            // First check for external plugins
#if false // TK2D_MARKER
            if (_Tk2dAnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _Tk2dAnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = targetGO.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
#endif
#if false // TEXTMESHPRO_MARKER
            if (_TMPAnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _TMPAnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = targetGO.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
#endif
            // Then check for regular stuff
            if (_AnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _AnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = targetGO.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
            return(false);
        }
        // Checks if a Component that can be animated with the given animationType is attached to the src
        bool Validate()
        {
            if (_src.animationType == DOTweenAnimationType.None)
            {
                return(false);
            }

            Component srcTarget;

            // First check for external plugins
#if DOTWEEN_TK2D
            if (_Tk2dAnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _Tk2dAnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = _src.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
#endif
#if DOTWEEN_TMP
            if (_TMPAnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _TMPAnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = _src.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
#endif
            // Then check for regular stuff
            if (_AnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _AnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = _src.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
            return(false);
        }
        bool Validate(GameObject targetGO)
        {
            if (_src.animationType == DOTweenAnimation.AnimationType.None)
            {
                return(false);
            }

            Component srcTarget;

#if false
            if (_Tk2dAnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _Tk2dAnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = targetGO.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
#endif
#if false
            if (_TMPAnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _TMPAnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = targetGO.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
#endif
            if (_AnimationTypeToComponent.ContainsKey(_src.animationType))
            {
                foreach (Type t in _AnimationTypeToComponent[_src.animationType])
                {
                    srcTarget = targetGO.GetComponent(t);
                    if (srcTarget != null)
                    {
                        _src.target     = srcTarget;
                        _src.targetType = DOTweenAnimation.TypeToDOTargetType(t);
                        return(true);
                    }
                }
            }
            return(false);
        }