예제 #1
0
 /// <summary>
 /// Disable <see cref="ILateUpdatable"/> late updates
 /// </summary>
 /// <param name="updatable">Updatable to disable</param>
 public static void RemoveLateUpdatable(ILateUpdatable updatable)
 {
     if (IsRunning)
     {
         Instance.lateUpdatables.RemoveSwapBack(updatable);
     }
 }
예제 #2
0
 /// <summary>
 /// Enable <see cref="ILateUpdatable"/> late updates
 /// </summary>
 /// <param name="updatable">Updatable to enable</param>
 public static void AddLateUpdatable(ILateUpdatable updatable)
 {
     if (IsRunning)
     {
         Instance.lateUpdatables.AddUnique(updatable);
     }
 }
예제 #3
0
 public void AddLateUpdatable(ILateUpdatable updatable)
 {
     if (!lateList.Contains(updatable))
     {
         lateList.Add(updatable);
     }
 }
예제 #4
0
 public void Remove(ILateUpdatable client)
 {
     if (_lateUpdates.Contains(client))
     {
         _lateUpdates.Remove(client);
     }
 }
예제 #5
0
 public void RemoveLateUpdatable(ILateUpdatable updatable)
 {
     if (lateList.Contains(updatable))
     {
         lateList.Remove(updatable);
     }
 }
예제 #6
0
 public void Add(ILateUpdatable client)
 {
     if (!_lateUpdates.Contains(client))
     {
         _lateUpdates.Add(client);
     }
 }
예제 #7
0
 public void RegisterLateUpdatableObject(ILateUpdatable obj)
 {
     if (!lateUpdateObjects.Contains(obj))
     {
         lateUpdateObjects.Add(obj);
     }
 }
예제 #8
0
 public void DeRegisterLateUpdatableObject(ILateUpdatable obj)
 {
     if (lateUpdateObjects.Contains(obj))
     {
         lateUpdateObjects.Remove(obj);
     }
 }
        private void RefreshArrayUpdatable()
        {
            int index1 = this.tail - 1;

label_9:
            for (int index2 = 0; index2 < this.arrayUpdatable.Length; ++index2)
            {
                if (this.arrayUpdatable[index2] == null)
                {
                    for (; index2 < index1; --index1)
                    {
                        ILateUpdatable lateUpdatable = this.arrayUpdatable[index1];
                        if (lateUpdatable != null)
                        {
                            this.arrayUpdatable[index2] = lateUpdatable;
                            this.arrayUpdatable[index1] = (ILateUpdatable)null;
                            --index1;
                            goto label_9;
                        }
                    }
                    this.tail = index2;
                    break;
                }
            }
            if (!this.m_ReduceArraySizeWhenNeed || this.tail >= this.arrayUpdatable.Length / 2)
            {
                return;
            }
            Array.Resize <ILateUpdatable>(ref this.arrayUpdatable, this.arrayUpdatable.Length / 2);
        }
 public static void RemoveUpdatableST(ILateUpdatable _updatable)
 {
     if (_updatable == null || !Singleton <LateUpdateManager> .IsInstance())
     {
         return;
     }
     Singleton <LateUpdateManager> .Instance.RemoveUpdatable(_updatable);
 }
예제 #11
0
 public void AddLateUpdatable(ILateUpdatable updatable)
 {
     if (updatable == null)
     {
         return;
     }
     mLateUpdatables.Union(updatable);
 }
예제 #12
0
 public void RemoveLateUpdatable(ILateUpdatable updatable)
 {
     if (updatable == null)
     {
         return;
     }
     mLateUpdatables.Remove(updatable);
 }
 private void AddUpdatable(ILateUpdatable _updatable)
 {
     if (this.arrayUpdatable.Length == this.tail)
     {
         Array.Resize <ILateUpdatable>(ref this.arrayUpdatable, checked (this.tail * 2));
     }
     this.arrayUpdatable[this.tail++] = _updatable;
 }
예제 #14
0
 /// <summary>
 /// 削除します
 /// </summary>
 public static void Remove(ILateUpdatable obj)
 {
     if (m_isQuit)
     {
         return;
     }
     Initialize();
     m_list.Remove(obj);
 }
예제 #15
0
        /// <summary>
        /// Register a late updatable object.
        /// </summary>
        public void RegisterLateUpdatable(ILateUpdatable updatable)
        {
            Argument.NotNull(() => updatable);

            if (lateUpdatables.Contains(updatable))
            {
                throw new FormattedException("Late updatable {TypeName} is already registered.", updatable.GetType().Name);
            }

            this.lateUpdatables.Add(updatable);
        }
 private void RemoveUpdatable(ILateUpdatable _updatable)
 {
     for (int index = 0; index < this.arrayUpdatable.Length; ++index)
     {
         if (this.arrayUpdatable[index] == _updatable)
         {
             this.arrayUpdatable[index] = (ILateUpdatable)null;
             break;
         }
     }
 }
예제 #17
0
        /// <summary>
        /// Updates this object.
        /// All the <see cref="IUpdatable"/> and <see cref="ILateUpdatable"/> added to this object will be updated as well.
        /// </summary>
        public void Update()
        {
            TimeSpan timeSinceLastUpdate = DateTime.Now - lastUpdateTime;

            lastUpdateTime = DateTime.Now;

            for (int i = 0; i < updatables.Count; i++)
            {
                IUpdatable updatable = updatables[i].Target;
                if (updatable != null)
                {
                    updatable.Update(timeSinceLastUpdate);
                }
                else
                {
                    updatables.RemoveAt(i--);
                }
            }

            TimeSpan timeSinceLastLateUpdate = DateTime.Now - lastLateUpdateTime;

            lastLateUpdateTime = DateTime.Now;

            for (int i = 0; i < lateUpdatables.Count; i++)
            {
                ILateUpdatable lateUpdatable = lateUpdatables[i].Target;
                if (lateUpdatable != null)
                {
                    lateUpdatable.LateUpdate(timeSinceLastLateUpdate);
                }
                else
                {
                    lateUpdatables.RemoveAt(i--);
                }
            }
        }
예제 #18
0
 /// <summary>
 /// Adds a new <see cref="ILateUpdatable"/> to be updated.
 /// </summary>
 /// <param name="lateUpdatable">The object to be updated.</param>
 public void AddLateUpdatable(ILateUpdatable lateUpdatable)
 {
     lateUpdatables.Add(new WeakReference <ILateUpdatable>(lateUpdatable));
 }
예제 #19
0
 /// <summary>
 /// Invokes <see cref="TimeManager.RemoveLateUpdatable(ILateUpdatable)"/>
 /// </summary>
 /// <param name="updatable"></param>
 public static void DisableLateUpdates(this ILateUpdatable updatable)
 {
     TimeManager.RemoveLateUpdatable(updatable);
 }
예제 #20
0
        /// <summary>
        /// Unregister a late updatable object.
        /// </summary>
        public void UnregisterLateUpdatable(ILateUpdatable updatable)
        {
            Argument.NotNull(() => updatable);

            this.lateUpdatables.Remove(updatable);
        }
예제 #21
0
 /// <summary>
 /// Invokes <see cref="TimeManager.AddLateUpdatable(ILateUpdatable)"/>
 /// </summary>
 /// <param name="updatable"></param>
 public static void EnableLateUpdates(this ILateUpdatable updatable)
 {
     TimeManager.AddLateUpdatable(updatable);
 }