/// <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); } }
/// <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); } }
public void AddLateUpdatable(ILateUpdatable updatable) { if (!lateList.Contains(updatable)) { lateList.Add(updatable); } }
public void Remove(ILateUpdatable client) { if (_lateUpdates.Contains(client)) { _lateUpdates.Remove(client); } }
public void RemoveLateUpdatable(ILateUpdatable updatable) { if (lateList.Contains(updatable)) { lateList.Remove(updatable); } }
public void Add(ILateUpdatable client) { if (!_lateUpdates.Contains(client)) { _lateUpdates.Add(client); } }
public void RegisterLateUpdatableObject(ILateUpdatable obj) { if (!lateUpdateObjects.Contains(obj)) { lateUpdateObjects.Add(obj); } }
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); }
public void AddLateUpdatable(ILateUpdatable updatable) { if (updatable == null) { return; } mLateUpdatables.Union(updatable); }
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; }
/// <summary> /// 削除します /// </summary> public static void Remove(ILateUpdatable obj) { if (m_isQuit) { return; } Initialize(); m_list.Remove(obj); }
/// <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; } } }
/// <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--); } } }
/// <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)); }
/// <summary> /// Invokes <see cref="TimeManager.RemoveLateUpdatable(ILateUpdatable)"/> /// </summary> /// <param name="updatable"></param> public static void DisableLateUpdates(this ILateUpdatable updatable) { TimeManager.RemoveLateUpdatable(updatable); }
/// <summary> /// Unregister a late updatable object. /// </summary> public void UnregisterLateUpdatable(ILateUpdatable updatable) { Argument.NotNull(() => updatable); this.lateUpdatables.Remove(updatable); }
/// <summary> /// Invokes <see cref="TimeManager.AddLateUpdatable(ILateUpdatable)"/> /// </summary> /// <param name="updatable"></param> public static void EnableLateUpdates(this ILateUpdatable updatable) { TimeManager.AddLateUpdatable(updatable); }