Beispiel #1
0
 // Token: 0x06000097 RID: 151 RVA: 0x0000403C File Offset: 0x0000223C
 private static bool ApplyInternalCycle(Sequence s, float fromPos, float toPos, UpdateMode updateMode, bool useInverse, bool prevPosIsInverse, bool multiCycleStep = false)
 {
     if (toPos < fromPos)
     {
         for (int i = s._sequencedObjs.Count - 1; i > -1; i--)
         {
             if (!s.active)
             {
                 return(true);
             }
             ABSSequentiable abssequentiable = s._sequencedObjs[i];
             if (abssequentiable.sequencedEndPosition >= toPos && abssequentiable.sequencedPosition <= fromPos)
             {
                 if (abssequentiable.tweenType == TweenType.Callback)
                 {
                     if (updateMode == UpdateMode.Update && prevPosIsInverse)
                     {
                         Tween.OnTweenCallback(abssequentiable.onStart);
                     }
                 }
                 else
                 {
                     float num = toPos - abssequentiable.sequencedPosition;
                     if (num < 0f)
                     {
                         num = 0f;
                     }
                     Tween tween = (Tween)abssequentiable;
                     if (tween.startupDone)
                     {
                         tween.isBackwards = true;
                         if (TweenManager.Goto(tween, num, false, updateMode))
                         {
                             return(true);
                         }
                         if (multiCycleStep && tween.tweenType == TweenType.Sequence)
                         {
                             if (s.position <= 0f && s.completedLoops == 0)
                             {
                                 tween.position = 0f;
                             }
                             else
                             {
                                 bool flag = s.completedLoops == 0 || (s.isBackwards && (s.completedLoops < s.loops || s.loops == -1));
                                 if (tween.isBackwards)
                                 {
                                     flag = !flag;
                                 }
                                 if (useInverse)
                                 {
                                     flag = !flag;
                                 }
                                 if (s.isBackwards && !useInverse && !prevPosIsInverse)
                                 {
                                     flag = !flag;
                                 }
                                 tween.position = (flag ? 0f : tween.duration);
                             }
                         }
                     }
                 }
             }
         }
     }
     else
     {
         int count = s._sequencedObjs.Count;
         for (int j = 0; j < count; j++)
         {
             if (!s.active)
             {
                 return(true);
             }
             ABSSequentiable abssequentiable2 = s._sequencedObjs[j];
             if (abssequentiable2.sequencedPosition <= toPos && abssequentiable2.sequencedEndPosition >= fromPos)
             {
                 if (abssequentiable2.tweenType == TweenType.Callback)
                 {
                     if (updateMode == UpdateMode.Update && ((!s.isBackwards && !useInverse && !prevPosIsInverse) || (s.isBackwards && useInverse && !prevPosIsInverse)))
                     {
                         Tween.OnTweenCallback(abssequentiable2.onStart);
                     }
                 }
                 else
                 {
                     float num2 = toPos - abssequentiable2.sequencedPosition;
                     if (num2 < 0f)
                     {
                         num2 = 0f;
                     }
                     Tween tween2 = (Tween)abssequentiable2;
                     tween2.isBackwards = false;
                     if (TweenManager.Goto(tween2, num2, false, updateMode))
                     {
                         return(true);
                     }
                     if (multiCycleStep && tween2.tweenType == TweenType.Sequence)
                     {
                         if (s.position <= 0f && s.completedLoops == 0)
                         {
                             tween2.position = 0f;
                         }
                         else
                         {
                             bool flag2 = s.completedLoops == 0 || (!s.isBackwards && (s.completedLoops < s.loops || s.loops == -1));
                             if (tween2.isBackwards)
                             {
                                 flag2 = !flag2;
                             }
                             if (useInverse)
                             {
                                 flag2 = !flag2;
                             }
                             if (s.isBackwards && !useInverse && !prevPosIsInverse)
                             {
                                 flag2 = !flag2;
                             }
                             tween2.position = (flag2 ? 0f : tween2.duration);
                         }
                     }
                 }
             }
         }
     }
     return(false);
 }
        // Token: 0x0600015C RID: 348 RVA: 0x00007778 File Offset: 0x00005978
        internal static bool DoGoto(Tween t, float toPosition, int toCompletedLoops, UpdateMode updateMode)
        {
            if (!t.startupDone && !t.Startup())
            {
                return(true);
            }
            if (!t.playedOnce && updateMode == UpdateMode.Update)
            {
                t.playedOnce = true;
                if (t.onStart != null)
                {
                    Tween.OnTweenCallback(t.onStart);
                    if (!t.active)
                    {
                        return(true);
                    }
                }
                if (t.onPlay != null)
                {
                    Tween.OnTweenCallback(t.onPlay);
                    if (!t.active)
                    {
                        return(true);
                    }
                }
            }
            float prevPosition = t.position;
            int   num          = t.completedLoops;

            t.completedLoops = toCompletedLoops;
            bool flag  = t.position <= 0f && num <= 0;
            bool flag2 = t.isComplete;

            if (t.loops != -1)
            {
                t.isComplete = (t.completedLoops == t.loops);
            }
            int num2 = 0;

            if (updateMode == UpdateMode.Update)
            {
                if (t.isBackwards)
                {
                    num2 = ((t.completedLoops < num) ? (num - t.completedLoops) : ((toPosition <= 0f && !flag) ? 1 : 0));
                    if (flag2)
                    {
                        num2--;
                    }
                }
                else
                {
                    num2 = ((t.completedLoops > num) ? (t.completedLoops - num) : 0);
                }
            }
            else if (t.tweenType == TweenType.Sequence)
            {
                num2 = num - toCompletedLoops;
                if (num2 < 0)
                {
                    num2 = -num2;
                }
            }
            t.position = toPosition;
            if (t.position > t.duration)
            {
                t.position = t.duration;
            }
            else if (t.position <= 0f)
            {
                if (t.completedLoops > 0 || t.isComplete)
                {
                    t.position = t.duration;
                }
                else
                {
                    t.position = 0f;
                }
            }
            bool flag3 = t.isPlaying;

            if (t.isPlaying)
            {
                if (!t.isBackwards)
                {
                    t.isPlaying = !t.isComplete;
                }
                else
                {
                    t.isPlaying = (t.completedLoops != 0 || t.position > 0f);
                }
            }
            bool         useInversePosition = t.loopType == LoopType.Yoyo && ((t.position < t.duration) ? (t.completedLoops % 2 != 0) : (t.completedLoops % 2 == 0));
            UpdateNotice updateNotice       = (!flag && ((t.loopType == LoopType.Restart && t.completedLoops != num) || (t.position <= 0f && t.completedLoops <= 0))) ? UpdateNotice.RewindStep : UpdateNotice.None;

            if (t.ApplyTween(prevPosition, num, num2, useInversePosition, updateMode, updateNotice))
            {
                return(true);
            }
            if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate)
            {
                Tween.OnTweenCallback(t.onUpdate);
            }
            if (t.position <= 0f && t.completedLoops <= 0 && !flag && t.onRewind != null)
            {
                Tween.OnTweenCallback(t.onRewind);
            }
            if (num2 > 0 && updateMode == UpdateMode.Update && t.onStepComplete != null)
            {
                for (int i = 0; i < num2; i++)
                {
                    Tween.OnTweenCallback(t.onStepComplete);
                }
            }
            if (t.isComplete && !flag2 && t.onComplete != null)
            {
                Tween.OnTweenCallback(t.onComplete);
            }
            if (!t.isPlaying && flag3 && (!t.isComplete || !t.autoKill) && t.onPause != null)
            {
                Tween.OnTweenCallback(t.onPause);
            }
            return(t.autoKill && t.isComplete);
        }