private void Play(bool forward)
 {
     if (this.target == null)
     {
         this.target = base.GetComponentInChildren <Animation>();
     }
     if (this.target != null)
     {
         if (this.clearSelection && (UICamera.selectedObject == base.gameObject))
         {
             UICamera.selectedObject = null;
         }
         int num = -(int)this.playDirection;
         AnimationOrTween.Direction playDirection = !forward ? ((AnimationOrTween.Direction)num) : this.playDirection;
         ActiveAnimation            animation     = ActiveAnimation.Play(this.target, this.clipName, playDirection, this.ifDisabledOnPlay, this.disableWhenFinished);
         if (animation != null)
         {
             if (this.resetOnPlay)
             {
                 animation.Reset();
             }
             animation.onFinished = this.onFinished;
             if ((this.eventReceiver != null) && !string.IsNullOrEmpty(this.callWhenFinished))
             {
                 animation.eventReceiver    = this.eventReceiver;
                 animation.callWhenFinished = this.callWhenFinished;
             }
             else
             {
                 animation.eventReceiver = null;
             }
         }
     }
 }
    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.eventReceiver     = null;
        component.callWhenFinished  = null;
        component.onFinished        = null;
        component.Play(clipName, playDirection);
        return(component);
    }
Example #3
0
 // Token: 0x0600025D RID: 605 RVA: 0x000193A4 File Offset: 0x000175A4
 public void Play(bool forward, bool onlyIfDifferent)
 {
     if (this.target || this.animator)
     {
         if (onlyIfDifferent)
         {
             if (this.mActivated == forward)
             {
                 return;
             }
             this.mActivated = forward;
         }
         if (this.clearSelection && UICamera.selectedObject == base.gameObject)
         {
             UICamera.selectedObject = null;
         }
         int num = (int)(-(int)this.playDirection);
         AnimationOrTween.Direction direction       = forward ? this.playDirection : ((AnimationOrTween.Direction)num);
         ActiveAnimation            activeAnimation = this.target ? ActiveAnimation.Play(this.target, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished) : ActiveAnimation.Play(this.animator, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished);
         if (activeAnimation != null)
         {
             if (this.resetOnPlay)
             {
                 activeAnimation.Reset();
             }
             for (int i = 0; i < this.onFinished.Count; i++)
             {
                 EventDelegate.Add(activeAnimation.onFinished, new EventDelegate.Callback(this.OnFinished), true);
             }
         }
     }
 }
 // Token: 0x0600493D RID: 18749 RVA: 0x0011761C File Offset: 0x0011581C
 private void Play(bool forward)
 {
     if (this.target == null)
     {
         this.target = base.GetComponentInChildren <Animation>();
     }
     if (this.target != null)
     {
         if (this.clearSelection && global::UICamera.selectedObject == base.gameObject)
         {
             global::UICamera.selectedObject = null;
         }
         int num = (int)(-(int)this.playDirection);
         AnimationOrTween.Direction direction       = (AnimationOrTween.Direction)((!forward) ? num : ((int)this.playDirection));
         global::ActiveAnimation    activeAnimation = global::ActiveAnimation.Play(this.target, this.clipName, direction, this.ifDisabledOnPlay, this.disableWhenFinished);
         if (this.resetOnPlay)
         {
             activeAnimation.Reset();
         }
         if (this.eventReceiver != null && !string.IsNullOrEmpty(this.callWhenFinished))
         {
             activeAnimation.eventReceiver    = this.eventReceiver;
             activeAnimation.callWhenFinished = this.callWhenFinished;
         }
     }
 }
    // Token: 0x06004A12 RID: 18962 RVA: 0x0011D7C4 File Offset: 0x0011B9C4
    public static global::ActiveAnimation Play(Animation anim, string clipName, AnimationOrTween.Direction playDirection, AnimationOrTween.EnableCondition enableBeforePlay, AnimationOrTween.DisableCondition disableCondition)
    {
        if (!anim.gameObject.activeInHierarchy)
        {
            if (enableBeforePlay != AnimationOrTween.EnableCondition.EnableThenPlay)
            {
                return(null);
            }
            global::NGUITools.SetActive(anim.gameObject, true);
        }
        global::ActiveAnimation activeAnimation = anim.GetComponent <global::ActiveAnimation>();

        if (activeAnimation != null)
        {
            activeAnimation.enabled = true;
        }
        else
        {
            activeAnimation = anim.gameObject.AddComponent <global::ActiveAnimation>();
        }
        activeAnimation.mAnim             = anim;
        activeAnimation.mDisableDirection = (AnimationOrTween.Direction)disableCondition;
        activeAnimation.Play(clipName, playDirection);
        return(activeAnimation);
    }
Example #6
0
    public static ActiveAnimation Play(Animation anim, string clipName, AnimationOrTween.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.enabled = true;
        }
        else
        {
            component = anim.gameObject.AddComponent <ActiveAnimation>();
        }
        component.mAnim             = anim;
        component.mDisableDirection = (AnimationOrTween.Direction)disableCondition;
        component.Play(clipName, playDirection);
        return(component);
    }
 // Token: 0x06000341 RID: 833 RVA: 0x0002012C File Offset: 0x0001E32C
 private void Play(string clipName, AnimationOrTween.Direction playDirection)
 {
     if (playDirection == AnimationOrTween.Direction.Toggle)
     {
         playDirection = ((this.mLastDirection != AnimationOrTween.Direction.Forward) ? AnimationOrTween.Direction.Forward : AnimationOrTween.Direction.Reverse);
     }
     if (this.mAnim != null)
     {
         base.enabled       = true;
         this.mAnim.enabled = false;
         if (string.IsNullOrEmpty(clipName))
         {
             if (!this.mAnim.isPlaying)
             {
                 this.mAnim.Play();
             }
         }
         else if (!this.mAnim.IsPlaying(clipName))
         {
             this.mAnim.Play(clipName);
         }
         foreach (object obj in this.mAnim)
         {
             AnimationState animationState = (AnimationState)obj;
             if (string.IsNullOrEmpty(clipName) || animationState.name == clipName)
             {
                 float num = Mathf.Abs(animationState.speed);
                 animationState.speed = num * (float)playDirection;
                 if (playDirection == AnimationOrTween.Direction.Reverse && animationState.time == 0f)
                 {
                     animationState.time = animationState.length;
                 }
                 else if (playDirection == AnimationOrTween.Direction.Forward && animationState.time == animationState.length)
                 {
                     animationState.time = 0f;
                 }
             }
         }
         this.mLastDirection = playDirection;
         this.mNotify        = true;
         this.mAnim.Sample();
         return;
     }
     if (this.mAnimator != null)
     {
         if (base.enabled && this.isPlaying && this.mClip == clipName)
         {
             this.mLastDirection = playDirection;
             return;
         }
         base.enabled        = true;
         this.mNotify        = true;
         this.mLastDirection = playDirection;
         this.mClip          = clipName;
         this.mAnimator.Play(this.mClip, 0, (playDirection == AnimationOrTween.Direction.Forward) ? 0f : 1f);
     }
 }
 private void Play(string clipName, AnimationOrTween.Direction playDirection)
 {
     if (this.mAnim != null)
     {
         base.enabled       = true;
         this.mAnim.enabled = false;
         if (playDirection == AnimationOrTween.Direction.Toggle)
         {
             playDirection = (this.mLastDirection == AnimationOrTween.Direction.Forward) ? AnimationOrTween.Direction.Reverse : AnimationOrTween.Direction.Forward;
         }
         if (string.IsNullOrEmpty(clipName))
         {
             if (!this.mAnim.isPlaying)
             {
                 this.mAnim.Play();
             }
         }
         else if (!this.mAnim.IsPlaying(clipName))
         {
             this.mAnim.Play(clipName);
         }
         IEnumerator enumerator = this.mAnim.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 AnimationState current = (AnimationState)enumerator.Current;
                 if (string.IsNullOrEmpty(clipName) || (current.name == clipName))
                 {
                     float num = Mathf.Abs(current.speed);
                     current.speed = num * ((float)playDirection);
                     if ((playDirection == AnimationOrTween.Direction.Reverse) && (current.time == 0f))
                     {
                         current.time = current.length;
                     }
                     else if ((playDirection == AnimationOrTween.Direction.Forward) && (current.time == current.length))
                     {
                         current.time = 0f;
                     }
                 }
             }
         }
         finally
         {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable != null)
             {
                 disposable.Dispose();
             }
         }
         this.mLastDirection = playDirection;
         this.mNotify        = true;
         this.mAnim.Sample();
     }
 }
 private void Play(string clipName, AnimationOrTween.Direction playDirection)
 {
     if (this.mAnim != null)
     {
         base.enabled = true;
         this.mAnim.enabled = false;
         if (playDirection == AnimationOrTween.Direction.Toggle)
         {
             playDirection = (this.mLastDirection == AnimationOrTween.Direction.Forward) ? AnimationOrTween.Direction.Reverse : AnimationOrTween.Direction.Forward;
         }
         if (string.IsNullOrEmpty(clipName))
         {
             if (!this.mAnim.isPlaying)
             {
                 this.mAnim.Play();
             }
         }
         else if (!this.mAnim.IsPlaying(clipName))
         {
             this.mAnim.Play(clipName);
         }
         IEnumerator enumerator = this.mAnim.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 AnimationState current = (AnimationState) enumerator.Current;
                 if (string.IsNullOrEmpty(clipName) || (current.name == clipName))
                 {
                     float num = Mathf.Abs(current.speed);
                     current.speed = num * ((float) playDirection);
                     if ((playDirection == AnimationOrTween.Direction.Reverse) && (current.time == 0f))
                     {
                         current.time = current.length;
                     }
                     else if ((playDirection == AnimationOrTween.Direction.Forward) && (current.time == current.length))
                     {
                         current.time = 0f;
                     }
                 }
             }
         }
         finally
         {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable == null)
             {
             }
             disposable.Dispose();
         }
         this.mLastDirection = playDirection;
         this.mNotify = true;
         this.mAnim.Sample();
     }
 }
Example #10
0
 private void Play(string clipName, Direction playDirection)
 {
     if (this.mAnim != null)
     {
         base.enabled       = true;
         this.mAnim.enabled = false;
         if (playDirection == Direction.Toggle)
         {
             playDirection = ((this.mLastDirection == Direction.Forward) ? Direction.Reverse : Direction.Forward);
         }
         bool flag = string.IsNullOrEmpty(clipName);
         if (flag)
         {
             if (!this.mAnim.isPlaying)
             {
                 this.mAnim.Play();
             }
         }
         else if (!this.mAnim.IsPlaying(clipName))
         {
             this.mAnim.Play(clipName);
         }
         foreach (AnimationState animationState in this.mAnim)
         {
             if (string.IsNullOrEmpty(clipName) || animationState.name == clipName)
             {
                 float num = Mathf.Abs(animationState.speed);
                 animationState.speed = num * (float)playDirection;
                 if (playDirection == Direction.Reverse && animationState.time == 0f)
                 {
                     animationState.time = animationState.length;
                 }
                 else if (playDirection == Direction.Forward && animationState.time == animationState.length)
                 {
                     animationState.time = 0f;
                 }
             }
         }
         this.mLastDirection = playDirection;
         this.mNotify        = true;
         this.mAnim.Sample();
     }
 }
Example #11
0
 private void Play(string clipName, AnimationOrTween.Direction playDirection)
 {
     if (this.mAnim != null)
     {
         base.enabled       = true;
         this.mAnim.enabled = false;
         if (playDirection == AnimationOrTween.Direction.Toggle)
         {
             playDirection = (this.mLastDirection == AnimationOrTween.Direction.Forward) ? AnimationOrTween.Direction.Reverse : AnimationOrTween.Direction.Forward;
         }
         if (string.IsNullOrEmpty(clipName))
         {
             if (!this.mAnim.isPlaying)
             {
                 this.mAnim.Play();
             }
         }
         else if (!this.mAnim.IsPlaying(clipName))
         {
             this.mAnim.Play(clipName);
         }
         foreach (AnimationState state in this.mAnim)
         {
             if (string.IsNullOrEmpty(clipName) || (state.name == clipName))
             {
                 float num = Mathf.Abs(state.speed);
                 state.speed = num * ((float)playDirection);
                 if ((playDirection == AnimationOrTween.Direction.Reverse) && (state.time == 0f))
                 {
                     state.time = state.length;
                 }
                 else if ((playDirection == AnimationOrTween.Direction.Forward) && (state.time == state.length))
                 {
                     state.time = 0f;
                 }
             }
         }
         this.mLastDirection = playDirection;
         this.mNotify        = true;
         this.mAnim.Sample();
     }
 }
    // Token: 0x06000345 RID: 837 RVA: 0x000203C8 File Offset: 0x0001E5C8
    public static ActiveAnimation Play(Animator anim, string clipName, AnimationOrTween.Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
    {
        if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !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.mAnimator         = anim;
        activeAnimation.mDisableDirection = (AnimationOrTween.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(Animation anim, string clipName, AnimationOrTween.Direction playDirection)
 {
     return(Play(anim, clipName, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable));
 }
 // Token: 0x06000344 RID: 836 RVA: 0x000203BC File Offset: 0x0001E5BC
 public static ActiveAnimation Play(Animation anim, AnimationOrTween.Direction playDirection)
 {
     return(ActiveAnimation.Play(anim, null, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable));
 }