Exemplo n.º 1
0
        public void UnregisterFrameTimeObserver(IViewFrameTimeObserver observer)
        {
            int num = this.frameTimeObservers.IndexOf(observer);

            if (num >= 0)
            {
                this.frameTimeObservers.RemoveAt(num);
                this.frameMiter.OnRemove(num);
            }
        }
Exemplo n.º 2
0
 public void RegisterFrameTimeObserver(IViewFrameTimeObserver observer)
 {
     if (observer == null)
     {
         return;
     }
     if (this.frameTimeObservers.IndexOf(observer) < 0)
     {
         this.frameTimeObservers.Add(observer);
     }
 }
Exemplo n.º 3
0
        public int IndexOf(IViewFrameTimeObserver element)
        {
            IViewFrameTimeObserver[] array = this.Array;
            int length = this.Length;

            for (int i = 0; i < length; i++)
            {
                if (array[i].Equals(element))
                {
                    return(i);
                }
            }
            return(-1);
        }
Exemplo n.º 4
0
        public void OnUpdate()
        {
            float num  = this.Now();
            float num2 = num - this.timeLast;

            this.timeLast = num;
            float num3 = num2;
            int   num4 = 0;

            while (num3 > 0f)
            {
                float num5 = (num3 <= this.timePerFrame) ? num3 : this.timePerFrame;
                this.physMiter.Init(this.physTimeObservers.Length);
                while (this.physMiter.Active())
                {
                    IViewPhysicsTimeObserver viewPhysicsTimeObserver = this.physTimeObservers.Array[this.physMiter.Index];
                    viewPhysicsTimeObserver.OnViewPhysicsTime(num5);
                    this.physMiter.Next();
                }
                this.physMiter.Reset();
                if (++num4 == 5)
                {
                    break;
                }
                num3 -= num5;
            }
            this.frameMiter.Init(this.frameTimeObservers.Length);
            while (this.frameMiter.Active())
            {
                IViewFrameTimeObserver viewFrameTimeObserver = this.frameTimeObservers.Array[this.frameMiter.Index];
                viewFrameTimeObserver.OnViewFrameTime(num2);
                this.frameMiter.Next();
            }
            this.frameMiter.Reset();
            this.clockMiter.Init(this.clockTimeObservers.Length);
            while (this.clockMiter.Active())
            {
                ViewClockTimeObserver viewClockTimeObserver = this.clockTimeObservers.Array[this.clockMiter.Index];
                float num6     = viewClockTimeObserver.Accumulator + num2;
                float tickSize = viewClockTimeObserver.TickSize;
                while (num6 >= tickSize)
                {
                    viewClockTimeObserver.Observer.OnViewClockTime(tickSize);
                    num6 -= tickSize;
                }
                viewClockTimeObserver.Accumulator = num6;
                this.clockMiter.Next();
            }
            this.clockMiter.Reset();
        }
Exemplo n.º 5
0
        public void Add(IViewFrameTimeObserver element)
        {
            IViewFrameTimeObserver[] array = this.Array;
            int length   = this.Length;
            int capacity = this.Capacity;

            if (length == capacity)
            {
                int num = capacity * 2;
                IViewFrameTimeObserver[] array2 = new IViewFrameTimeObserver[num];
                for (int i = 0; i < length; i++)
                {
                    array2[i] = array[i];
                }
                this.Array    = array2;
                this.Capacity = num;
                array         = array2;
            }
            array[length] = element;
            this.Length++;
        }
Exemplo n.º 6
0
        public void Insert(int index, IViewFrameTimeObserver element)
        {
            IViewFrameTimeObserver[] array = this.Array;
            int length   = this.Length;
            int capacity = this.Capacity;

            if (length == capacity)
            {
                int num = capacity * 2;
                IViewFrameTimeObserver[] array2 = new IViewFrameTimeObserver[num];
                for (int i = 0; i < length; i++)
                {
                    array2[i] = array[i];
                }
                this.Array    = array2;
                this.Capacity = num;
                array         = array2;
            }
            if (index == length)
            {
                array[length] = element;
                this.Length++;
            }
            else
            {
                IViewFrameTimeObserver viewFrameTimeObserver = array[index];
                array[index] = element;
                for (int j = index + 1; j < length; j++)
                {
                    IViewFrameTimeObserver viewFrameTimeObserver2 = array[j];
                    array[j] = viewFrameTimeObserver;
                    viewFrameTimeObserver = viewFrameTimeObserver2;
                }
                array[length] = viewFrameTimeObserver;
                this.Length++;
            }
        }