Beispiel #1
0
        public static int Validate()
        {
            if (TweenManager._requiresActiveReorganization)
            {
                TweenManager.ReorganizeActiveTweens();
            }
            int num = 0;

            for (int i = 0; i < TweenManager._maxActiveLookupId + 1; i++)
            {
                Tween tween = TweenManager._activeTweens[i];
                if (!tween.Validate())
                {
                    num++;
                    TweenManager.MarkForKilling(tween);
                }
            }
            if (num > 0)
            {
                TweenManager.DespawnTweens(TweenManager._KillList, false);
                int num2 = TweenManager._KillList.Count - 1;
                for (int j = num2; j > -1; j--)
                {
                    TweenManager.RemoveActiveTween(TweenManager._KillList[j]);
                }
                TweenManager._KillList.Clear();
            }
            return(num);
        }
Beispiel #2
0
        public static void Update(UpdateType updateType, float deltaTime, float independentTime)
        {
            if (TweenManager._requiresActiveReorganization)
            {
                TweenManager.ReorganizeActiveTweens();
            }
            TweenManager.isUpdateLoop = true;
            bool flag = false;
            int  num  = TweenManager._maxActiveLookupId + 1;

            for (int i = 0; i < num; i++)
            {
                Tween tween = TweenManager._activeTweens[i];
                if (tween != null && tween.updateType == updateType)
                {
                    if (!tween.active)
                    {
                        flag = true;
                        TweenManager.MarkForKilling(tween);
                    }
                    else if (tween.isPlaying)
                    {
                        tween.creationLocked = true;
                        float num2 = (tween.isIndependentUpdate ? independentTime : deltaTime) * tween.timeScale;
                        if (!tween.delayComplete)
                        {
                            num2 = tween.UpdateDelay(tween.elapsedDelay + num2);
                            if (num2 <= -1f)
                            {
                                flag = true;
                                TweenManager.MarkForKilling(tween);
                                goto IL_1CB;
                            }
                            if (num2 <= 0f)
                            {
                                goto IL_1CB;
                            }
                        }
                        if (!tween.startupDone && !tween.Startup())
                        {
                            flag = true;
                            TweenManager.MarkForKilling(tween);
                        }
                        else
                        {
                            float num3  = tween.position;
                            bool  flag2 = num3 >= tween.duration;
                            int   num4  = tween.completedLoops;
                            if (tween.duration <= 0f)
                            {
                                num3 = 0f;
                                num4 = ((tween.loops == -1) ? (tween.completedLoops + 1) : tween.loops);
                            }
                            else
                            {
                                if (tween.isBackwards)
                                {
                                    num3 -= num2;
                                    while (num3 < 0f)
                                    {
                                        if (num4 <= 0)
                                        {
                                            break;
                                        }
                                        num3 += tween.duration;
                                        num4--;
                                    }
                                }
                                else
                                {
                                    num3 += num2;
                                    while (num3 >= tween.duration && (tween.loops == -1 || num4 < tween.loops))
                                    {
                                        num3 -= tween.duration;
                                        num4++;
                                    }
                                }
                                if (flag2)
                                {
                                    num4--;
                                }
                                if (tween.loops != -1 && num4 >= tween.loops)
                                {
                                    num3 = tween.duration;
                                }
                            }
                            bool flag3 = Tween.DoGoto(tween, num3, num4, UpdateMode.Update);
                            if (flag3)
                            {
                                flag = true;
                                TweenManager.MarkForKilling(tween);
                            }
                        }
                    }
                }
                IL_1CB :;
            }
            if (flag)
            {
                TweenManager.DespawnTweens(TweenManager._KillList, false);
                int num5 = TweenManager._KillList.Count - 1;
                for (int j = num5; j > -1; j--)
                {
                    TweenManager.RemoveActiveTween(TweenManager._KillList[j]);
                }
                TweenManager._KillList.Clear();
            }
            TweenManager.isUpdateLoop = false;
        }
Beispiel #3
0
        internal static void Update(UpdateType updateType, float deltaTime, float independentTime)
        {
            if (TweenManager._requiresActiveReorganization)
            {
                TweenManager.ReorganizeActiveTweens();
            }
            TweenManager.isUpdateLoop = true;
            bool flag = false;
            int  num  = TweenManager._maxActiveLookupId + 1;

            for (int i = 0; i < num; i++)
            {
                Tween tween = TweenManager._activeTweens[i];
                float num2;
                if (tween != null && tween.updateType == updateType)
                {
                    if (!tween.active)
                    {
                        flag = true;
                        TweenManager.MarkForKilling(tween);
                    }
                    else if (tween.isPlaying)
                    {
                        tween.creationLocked = true;
                        num2 = (tween.isIndependentUpdate ? independentTime : deltaTime) * tween.timeScale;
                        if (!tween.delayComplete)
                        {
                            num2 = tween.UpdateDelay(tween.elapsedDelay + num2);
                            if (num2 <= -1f)
                            {
                                flag = true;
                                TweenManager.MarkForKilling(tween);
                            }
                            else if (!(num2 <= 0f))
                            {
                                if (tween.playedOnce && tween.onPlay != null)
                                {
                                    Tween.OnTweenCallback(tween.onPlay);
                                }
                                goto IL_00d0;
                            }
                            continue;
                        }
                        goto IL_00d0;
                    }
                }
                continue;
IL_00d0:
                if (!tween.startupDone && !tween.Startup())
                {
                    flag = true;
                    TweenManager.MarkForKilling(tween);
                }
                else
                {
                    float position = tween.position;
                    bool  flag2    = position >= tween.duration;
                    int   num3     = tween.completedLoops;
                    if (tween.duration <= 0f)
                    {
                        position = 0f;
                        num3     = ((tween.loops == -1) ? (tween.completedLoops + 1) : tween.loops);
                    }
                    else
                    {
                        if (tween.isBackwards)
                        {
                            position -= num2;
                            while (position < 0f && num3 > 0)
                            {
                                position += tween.duration;
                                num3--;
                            }
                        }
                        else
                        {
                            position += num2;
                            while (true)
                            {
                                if (!(position >= tween.duration))
                                {
                                    break;
                                }
                                if (tween.loops != -1 && num3 >= tween.loops)
                                {
                                    break;
                                }
                                position -= tween.duration;
                                num3++;
                            }
                        }
                        if (flag2)
                        {
                            num3--;
                        }
                        if (tween.loops != -1 && num3 >= tween.loops)
                        {
                            position = tween.duration;
                        }
                    }
                    if (Tween.DoGoto(tween, position, num3, UpdateMode.Update))
                    {
                        flag = true;
                        TweenManager.MarkForKilling(tween);
                    }
                }
            }
            if (flag)
            {
                if (TweenManager._despawnAllCalledFromUpdateLoopCallback)
                {
                    TweenManager._despawnAllCalledFromUpdateLoopCallback = false;
                }
                else
                {
                    TweenManager.DespawnTweens(TweenManager._KillList, false);
                    for (int num4 = TweenManager._KillList.Count - 1; num4 > -1; num4--)
                    {
                        TweenManager.RemoveActiveTween(TweenManager._KillList[num4]);
                    }
                }
                TweenManager._KillList.Clear();
            }
            TweenManager.isUpdateLoop = false;
        }