Ejemplo n.º 1
0
 public override void Unity_Deserialize(int depth)
 {
     if (depth <= 7)
     {
         this.tweenTarget = (SerializedStateReader.Instance.ReadUnityEngineObject() as GameObject);
     }
     this.tweenGroup    = SerializedStateReader.Instance.ReadInt32();
     this.trigger       = (Trigger)SerializedStateReader.Instance.ReadInt32();
     this.playDirection = (Direction)SerializedStateReader.Instance.ReadInt32();
     this.resetOnPlay   = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.resetIfDisabled = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     this.ifDisabledOnPlay    = (EnableCondition)SerializedStateReader.Instance.ReadInt32();
     this.disableWhenFinished = (DisableCondition)SerializedStateReader.Instance.ReadInt32();
     this.includeChildren     = SerializedStateReader.Instance.ReadBoolean();
     SerializedStateReader.Instance.Align();
     if (depth <= 7)
     {
         int num = SerializedStateReader.Instance.ReadInt32();
         this.onFinished = new List <EventDelegate>(num);
         for (int i = 0; i < num; i++)
         {
             EventDelegate eventDelegate = new EventDelegate();
             eventDelegate.Unity_Deserialize(depth + 1);
             this.onFinished.Add(eventDelegate);
         }
     }
     if (depth <= 7)
     {
         this.eventReceiver = (SerializedStateReader.Instance.ReadUnityEngineObject() as GameObject);
     }
     this.callWhenFinished = (SerializedStateReader.Instance.ReadString() as string);
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>

    static public ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
                                       EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);

            // Refresh all panels right away so that there is no one frame delay
            UIPanel[] panels = anim.gameObject.GetComponentsInChildren <UIPanel>();
            for (int i = 0, imax = panels.Length; i < imax; ++i)
            {
                panels[i].Refresh();
            }
        }

        ActiveAnimation aa = anim.GetComponent <ActiveAnimation>();

        if (aa == null)
        {
            aa = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        aa.mAnim             = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.onFinished.Clear();
        aa.Play(clipName, playDirection);
        return(aa);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
        EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);

            // Refresh all panels right away so that there is no one frame delay
            UIPanel[] panels = anim.gameObject.GetComponentsInChildren<UIPanel>();
            for (int i = 0, imax = panels.Length; i < imax; ++i) panels[i].Refresh();
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa == null) aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.eventReceiver = null;
        aa.callWhenFinished = null;
        aa.onFinished = null;
        aa.Play(clipName, playDirection);
        return aa;
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>

    static public ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
                                       EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!anim.gameObject.activeSelf)
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }

            // Enable the game object before animating it
            anim.gameObject.SetActive(true);
        }

        ActiveAnimation aa = anim.GetComponent <ActiveAnimation>();

        if (aa != null)
        {
            aa.enabled = true;
        }
        else
        {
            aa = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        aa.mAnim             = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.Play(clipName, playDirection);
        return(aa);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
        EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        #if UNITY_3_5
        if (!anim.gameObject.active)
        #else
        if (!anim.gameObject.activeSelf)
        #endif
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa != null) aa.enabled = true;
        else aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.eventReceiver = null;
        aa.callWhenFinished = null;
        aa.onFinished = null;
        aa.Play(clipName, playDirection);
        return aa;
    }
Ejemplo n.º 6
0
        //void Start () { mStarted = true; if (tweenTarget == null) tweenTarget = gameObject; }

        //void OnEnable () { if (mStarted && mHighlighted) OnHover(UICamera.IsHighlighted(gameObject)); }

        public override void Reset()
        {
            tweenTarget           = null;
            tweenGroup            = null;
            resetOnPlay           = false;
            ifDisabledOnPlay      = EnableCondition.DoNothing;
            disableWhenFinished   = DisableCondition.DoNotDisable;
            includeChildren       = false;
            tweeningFinishedEvent = null;
        }
Ejemplo n.º 7
0
		//void Start () { mStarted = true; if (tweenTarget == null) tweenTarget = gameObject; }

		//void OnEnable () { if (mStarted && mHighlighted) OnHover(UICamera.IsHighlighted(gameObject)); }
		
		public override void Reset()
		{
			tweenTarget = null;
			tweenGroup = null;
			resetOnPlay = false;
			ifDisabledOnPlay = EnableCondition.DoNothing;
			disableWhenFinished = DisableCondition.DoNotDisable;
			includeChildren = false;
			tweeningFinishedEvent = null;
		}
Ejemplo n.º 8
0
    public unsafe override void Unity_NamedDeserialize(int depth)
    {
        byte[] var_0_cp_0;
        int    var_0_cp_1;

        if (depth <= 7)
        {
            ISerializedNamedStateReader arg_1E_0 = SerializedNamedStateReader.Instance;
            var_0_cp_0  = $FieldNamesStorage.$RuntimeNames;
            var_0_cp_1  = 0;
            this.target = (arg_1E_0.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 265) as Animation);
        }
        if (depth <= 7)
        {
            this.animator = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1069) as Animator);
        }
        this.clipName      = (SerializedNamedStateReader.Instance.ReadString(&var_0_cp_0[var_0_cp_1] + 1078) as string);
        this.trigger       = (Trigger)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 415);
        this.playDirection = (Direction)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 1087);
        this.resetOnPlay   = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1101);
        SerializedNamedStateReader.Instance.Align();
        this.clearSelection = SerializedNamedStateReader.Instance.ReadBoolean(&var_0_cp_0[var_0_cp_1] + 1113);
        SerializedNamedStateReader.Instance.Align();
        this.ifDisabledOnPlay    = (EnableCondition)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 1128);
        this.disableWhenFinished = (DisableCondition)SerializedNamedStateReader.Instance.ReadInt32(&var_0_cp_0[var_0_cp_1] + 1145);
        if (depth <= 7)
        {
            int num = SerializedNamedStateReader.Instance.BeginSequenceGroup(&var_0_cp_0[var_0_cp_1] + 85);
            this.onFinished = new List <EventDelegate>(num);
            for (int i = 0; i < num; i++)
            {
                EventDelegate eventDelegate = new EventDelegate();
                EventDelegate arg_14C_0     = eventDelegate;
                SerializedNamedStateReader.Instance.BeginMetaGroup((IntPtr)0);
                arg_14C_0.Unity_NamedDeserialize(depth + 1);
                SerializedNamedStateReader.Instance.EndMetaGroup();
                this.onFinished.Add(eventDelegate);
            }
            SerializedNamedStateReader.Instance.EndMetaGroup();
        }
        if (depth <= 7)
        {
            this.eventReceiver = (SerializedNamedStateReader.Instance.ReadUnityEngineObject(&var_0_cp_0[var_0_cp_1] + 1165) as GameObject);
        }
        this.callWhenFinished = (SerializedNamedStateReader.Instance.ReadString(&var_0_cp_0[var_0_cp_1] + 1179) as string);
    }
Ejemplo n.º 9
0
    private static int get_ifDisabledOnPlay(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIPlayTween     uIPlayTween      = (UIPlayTween)obj;
            EnableCondition ifDisabledOnPlay = uIPlayTween.ifDisabledOnPlay;
            ToLua.Push(L, ifDisabledOnPlay);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index ifDisabledOnPlay on a nil value");
        }
        return(result);
    }
Ejemplo n.º 10
0
    private static int set_ifDisabledOnPlay(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIPlayTween     uIPlayTween      = (UIPlayTween)obj;
            EnableCondition ifDisabledOnPlay = (EnableCondition)((int)ToLua.CheckObject(L, 2, typeof(EnableCondition)));
            uIPlayTween.ifDisabledOnPlay = ifDisabledOnPlay;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index ifDisabledOnPlay on a nil value");
        }
        return(result);
    }
Ejemplo n.º 11
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection,
		EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!anim.gameObject.active)
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay) return null;

            // Enable the game object before animating it
            anim.gameObject.SetActiveRecursively(true);
        }

        ActiveAnimation aa = anim.GetComponent<ActiveAnimation>();
        if (aa != null) aa.enabled = true;
        else aa = anim.gameObject.AddComponent<ActiveAnimation>();
        aa.mAnim = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.Play(clipName, playDirection);
        return aa;
    }
Ejemplo n.º 12
0
        /// <summary>
        /// Play the specified animation on the specified object.
        /// </summary>

        static public ActiveAnimation Play(Animator anim, string clipName, Direction playDirection,
                                           EnableCondition enableBeforePlay, DisableCondition disableCondition)
        {
            if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !anim.gameObject.activeSelf)
            {
                // If the object is disabled, don't do anything
                if (enableBeforePlay != EnableCondition.EnableThenPlay)
                {
                    return(null);
                }

                // Enable the game object before animating it
                anim.gameObject.SetActive(true);

                // Refresh all panels right away so that there is no one frame delay
            }

            ActiveAnimation aa = anim.GetComponent <ActiveAnimation>();

            if (aa == null)
            {
                aa = anim.gameObject.AddComponent <ActiveAnimation>();
            }
            aa.mAnimator         = anim;
            aa.mDisableDirection = (Direction)(int)disableCondition;
            if (aa.onFinished != null)
            {
                aa.onFinished.RemoveAllListeners();
            }
            aa.Play(clipName, playDirection);

            if (aa.mAnim != null)
            {
                aa.mAnim.Sample();
            }
            else if (aa.mAnimator != null)
            {
                aa.mAnimator.Update(0f);
            }
            return(aa);
        }
Ejemplo n.º 13
0
 public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
 {
     if (!anim.gameObject.activeInHierarchy)
     {
         if (enableBeforePlay != EnableCondition.EnableThenPlay)
         {
             return null;
         }
         NGUITools.SetActive(anim.gameObject, true);
     }
     ActiveAnimation component = anim.GetComponent<ActiveAnimation>();
     if (component == null)
     {
         component = anim.gameObject.AddComponent<ActiveAnimation>();
     }
     else
     {
         component.enabled = true;
     }
     component.mAnim = anim;
     component.mDisableDirection = (Direction)disableCondition;
     component.Play(clipName, playDirection);
     return component;
 }
Ejemplo n.º 14
0
    /// <summary>
    /// Play the specified animation on the specified object.
    /// </summary>

    static public ActiveAnimation Play(Animator anim, string clipName, Direction playDirection,
                                       EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !NGUITools.GetActive(anim.gameObject))
        {
            // If the object is disabled, don't do anything
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }

            // Enable the game object before animating it
            NGUITools.SetActive(anim.gameObject, true);
        }

        ActiveAnimation aa = anim.GetComponent <ActiveAnimation>();

        if (aa == null)
        {
            aa = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        aa.mAnimator         = anim;
        aa.mDisableDirection = (Direction)(int)disableCondition;
        aa.onFinished.Clear();
        aa.Play(clipName, playDirection);

        if (aa.mAnim != null)
        {
            aa.mAnim.Sample();
        }
        else if (aa.mAnimator != null)
        {
            aa.mAnimator.Update(0f);
        }
        return(aa);
    }
Ejemplo n.º 15
0
    public static void TweenPlay(GameObject go, int tweenGroup, Direction playDirection, bool resetOnPlay, EnableCondition ifDisabledOnPlay, DisableCondition disableWhenFinished, bool includeChildren)
    {
        if (!go.activeSelf)
        {
            // If the object is disabled, don't do anything
            if (ifDisabledOnPlay != EnableCondition.EnableThenPlay)
            {
                return;
            }

            // Enable the game object before tweening it
            NGUITools.SetActive(go, true);
        }

        // Gather the tweening components
        UITweener[] mTweens = includeChildren ? go.GetComponentsInChildren <UITweener>() : go.GetComponents <UITweener>();

        if (mTweens.Length == 0)
        {
            // No tweeners found -- should we disable the object?
            if (disableWhenFinished != DisableCondition.DoNotDisable)
            {
                NGUITools.SetActive(go, false);
            }
        }
        else
        {
            bool activated = false;

            // Run through all located tween components
            for (int i = 0, imax = mTweens.Length; i < imax; ++i)
            {
                UITweener tw = mTweens[i];

                // If the tweener's group matches, we can work with it
                if (tw.tweenGroup == tweenGroup)
                {
                    // Ensure that the game objects are enabled
                    if (!activated && !go.activeSelf)
                    {
                        activated = true;
                        NGUITools.SetActive(go, true);
                    }

                    // Toggle or activate the tween component
                    if (playDirection == Direction.Toggle)
                    {
                        tw.Toggle();
                    }
                    else if (playDirection == Direction.Forward)
                    {
                        tw.Play(true);
                    }
                    else
                    {
                        tw.Play(false);
                    }

                    if (resetOnPlay)
                    {
                        tw.Reset();
                    }
                }
            }
        }
    }
Ejemplo n.º 16
0
    public static ActiveAnimation Play(Animator anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !NGUITools.GetActive(((Component)anim).gameObject))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(((Component)anim).gameObject, state: true);
            UIPanel[] componentsInChildren = ((Component)anim).gameObject.GetComponentsInChildren <UIPanel>();
            int       i = 0;
            for (int num = componentsInChildren.Length; i < num; i++)
            {
                componentsInChildren[i].Refresh();
            }
        }
        ActiveAnimation activeAnimation = ((Component)anim).GetComponent <ActiveAnimation>();

        if (activeAnimation == null)
        {
            activeAnimation = ((Component)anim).gameObject.AddComponent <ActiveAnimation>();
        }
        activeAnimation.mAnimator         = anim;
        activeAnimation.mDisableDirection = (Direction)disableCondition;
        activeAnimation.onFinished.Clear();
        activeAnimation.Play(clipName, playDirection);
        if ((Object)activeAnimation.mAnim != null)
        {
            activeAnimation.mAnim.Sample();
        }
        else if ((Object)activeAnimation.mAnimator != null)
        {
            activeAnimation.mAnimator.Update(0f);
        }
        return(activeAnimation);
    }
 public static ActiveAnimation Play(Animation anim, string clipName, AnimationOrTween.Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
 {
     if (!NGUITools.GetActive(anim.gameObject))
     {
         if (enableBeforePlay != EnableCondition.EnableThenPlay)
         {
             return null;
         }
         NGUITools.SetActive(anim.gameObject, true);
         UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren<UIPanel>();
         int index = 0;
         int length = componentsInChildren.Length;
         while (index < length)
         {
             componentsInChildren[index].Refresh();
             index++;
         }
     }
     ActiveAnimation component = anim.GetComponent<ActiveAnimation>();
     if (component == null)
     {
         component = anim.gameObject.AddComponent<ActiveAnimation>();
     }
     component.mAnim = anim;
     component.mDisableDirection = (AnimationOrTween.Direction) disableCondition;
     component.onFinished.Clear();
     component.Play(clipName, playDirection);
     return component;
 }
Ejemplo n.º 18
0
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.gameObject, true);
            UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren <UIPanel>();
            int       i   = 0;
            int       num = componentsInChildren.Length;
            while (i < num)
            {
                componentsInChildren[i].Refresh();
                i++;
            }
        }
        ActiveAnimation activeAnimation = anim.GetComponent <ActiveAnimation>();

        if (activeAnimation == null)
        {
            activeAnimation = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        activeAnimation.mAnim             = anim;
        activeAnimation.mDisableDirection = (Direction)disableCondition;
        activeAnimation.eventReceiver     = null;
        activeAnimation.callWhenFinished  = null;
        activeAnimation.onFinished        = null;
        activeAnimation.Play(clipName, playDirection);
        return(activeAnimation);
    }
Ejemplo n.º 19
0
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.get_gameObject()))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.get_gameObject(), true);
            UIPanel[] componentsInChildren = anim.get_gameObject().GetComponentsInChildren <UIPanel>();
            int       i   = 0;
            int       num = componentsInChildren.Length;
            while (i < num)
            {
                componentsInChildren[i].Refresh();
                i++;
            }
        }
        ActiveAnimation activeAnimation = anim.GetComponent <ActiveAnimation>();

        if (activeAnimation == null)
        {
            activeAnimation = anim.get_gameObject().AddComponent <ActiveAnimation>();
        }
        activeAnimation.mAnim             = anim;
        activeAnimation.mDisableDirection = (Direction)disableCondition;
        activeAnimation.onFinished.Clear();
        activeAnimation.Play(clipName, playDirection);
        if (activeAnimation.mAnim != null)
        {
            activeAnimation.mAnim.Sample();
        }
        else if (activeAnimation.mAnimator != null)
        {
            activeAnimation.mAnimator.Update(0f);
        }
        return(activeAnimation);
    }
    public static ActiveAnimation Play(Animator anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        //IL_0008: Unknown result type (might be due to invalid IL or missing references)
        //IL_000d: Expected O, but got Unknown
        //IL_0021: Unknown result type (might be due to invalid IL or missing references)
        //IL_0027: Expected O, but got Unknown
        //IL_002d: Unknown result type (might be due to invalid IL or missing references)
        //IL_006a: Unknown result type (might be due to invalid IL or missing references)
        if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !NGUITools.GetActive(anim.get_gameObject()))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.get_gameObject(), true);
            UIPanel[] componentsInChildren = anim.get_gameObject().GetComponentsInChildren <UIPanel>();
            int       i = 0;
            for (int num = componentsInChildren.Length; i < num; i++)
            {
                componentsInChildren[i].Refresh();
            }
        }
        ActiveAnimation activeAnimation = anim.GetComponent <ActiveAnimation>();

        if (activeAnimation == null)
        {
            activeAnimation = anim.get_gameObject().AddComponent <ActiveAnimation>();
        }
        activeAnimation.mAnimator         = anim;
        activeAnimation.mDisableDirection = (Direction)disableCondition;
        activeAnimation.onFinished.Clear();
        activeAnimation.Play(clipName, playDirection);
        if (activeAnimation.mAnim != null)
        {
            activeAnimation.mAnim.Sample();
        }
        else if (activeAnimation.mAnimator != null)
        {
            activeAnimation.mAnimator.Update(0f);
        }
        return(activeAnimation);
    }
Ejemplo n.º 21
0
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!NGUITools.GetActive(anim.gameObject))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }

            NGUITools.SetActive(anim.gameObject, true);
            var componentsInChildren = anim.gameObject.GetComponentsInChildren <UIPanel>();
            var index  = 0;
            var length = componentsInChildren.Length;
            while (index < length)
            {
                componentsInChildren[index].Refresh();
                index++;
            }
        }

        var component = anim.GetComponent <ActiveAnimation>();

        if (component == null)
        {
            component = anim.gameObject.AddComponent <ActiveAnimation>();
        }

        component.mAnim             = anim;
        component.mDisableDirection = (Direction)disableCondition;
        component.eventReceiver     = null;
        component.callWhenFinished  = null;
        component.onFinished        = null;
        component.Play(clipName, playDirection);
        return(component);
    }
Ejemplo n.º 22
0
    public static ActiveAnimation Play(Animator anim, String clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !NGUITools.GetActive(anim.gameObject))
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return((ActiveAnimation)null);
            }
            NGUITools.SetActive(anim.gameObject, true);
            UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren <UIPanel>();
            Int32     i   = 0;
            Int32     num = (Int32)componentsInChildren.Length;
            while (i < num)
            {
                componentsInChildren[i].Refresh();
                i++;
            }
        }
        ActiveAnimation activeAnimation = anim.GetComponent <ActiveAnimation>();

        if (activeAnimation == (UnityEngine.Object)null)
        {
            activeAnimation = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        activeAnimation.mAnimator         = anim;
        activeAnimation.mDisableDirection = (Direction)disableCondition;
        activeAnimation.onFinished.Clear();
        activeAnimation.Play(clipName, playDirection);
        if (activeAnimation.mAnim != (UnityEngine.Object)null)
        {
            activeAnimation.mAnim.Sample();
        }
        else if (activeAnimation.mAnimator != (UnityEngine.Object)null)
        {
            activeAnimation.mAnimator.Update(0f);
        }
        return(activeAnimation);
    }
Ejemplo n.º 23
0
 public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
 {
     if (!NGUITools.GetActive(anim.gameObject))
     {
         if (enableBeforePlay != EnableCondition.EnableThenPlay)
         {
             return null;
         }
         NGUITools.SetActive(anim.gameObject, true);
         UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren<UIPanel>();
         int i = 0;
         int num = componentsInChildren.Length;
         while (i < num)
         {
             componentsInChildren[i].Refresh();
             i++;
         }
     }
     ActiveAnimation activeAnimation = anim.GetComponent<ActiveAnimation>();
     if (activeAnimation == null)
     {
         activeAnimation = anim.gameObject.AddComponent<ActiveAnimation>();
     }
     activeAnimation.mAnim = anim;
     activeAnimation.mDisableDirection = (Direction)disableCondition;
     activeAnimation.onFinished.Clear();
     activeAnimation.Play(clipName, playDirection);
     if (activeAnimation.mAnim != null)
     {
         activeAnimation.mAnim.Sample();
     }
     else if (activeAnimation.mAnimator != null)
     {
         activeAnimation.mAnimator.Update(0f);
     }
     return activeAnimation;
 }
Ejemplo n.º 24
0
    public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (!anim.gameObject.activeInHierarchy)
        {
            if (enableBeforePlay != EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            NGUITools.SetActive(anim.gameObject, true);
        }
        ActiveAnimation component = anim.GetComponent <ActiveAnimation>();

        if (component == null)
        {
            component = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        else
        {
            component.enabled = true;
        }
        component.mAnim             = anim;
        component.mDisableDirection = (Direction)disableCondition;
        component.Play(clipName, playDirection);
        return(component);
    }