private void Awake() { if (HonoBehaviorSystem._instance == (UnityEngine.Object)null) { return; } HonoBehaviorSystem[] array = UnityEngine.Object.FindObjectsOfType <HonoBehaviorSystem>(); if ((Int32)array.Length == 1) { return; } HonoBehaviorSystem[] array2 = array; for (Int32 i = 0; i < (Int32)array2.Length; i++) { HonoBehaviorSystem honoBehaviorSystem = array2[i]; if (honoBehaviorSystem != HonoBehaviorSystem._instance) { UnityEngine.Object.Destroy(honoBehaviorSystem.gameObject); } } }
public void UnregisterHonoBehavior(Boolean dispose = false) { HonoBehaviorSystem.RemoveBehavior(this, dispose); }
private void Update() { if (PersistenSingleton <UIManager> .Instance.IsPause) { return; } Int32 num = 1; if (this._fastMode) { num = this.GetFastForwardFactor(); } for (Int32 i = 0; i < num; i++) { if (HonoBehaviorSystem.IdleLoopCount > 0) { HonoBehaviorSystem.IdleLoopCount--; } else { if (this._fastMode != this._nextFastMode) { if (this._nextFastMode) { for (Int32 j = 0; j < this._behaviorList.Count; j++) { this._behaviorList[j].HonoOnStartFastForwardMode(); } } else { for (Int32 k = 0; k < this._behaviorList.Count; k++) { this._behaviorList[k].HonoOnStopFastForwardMode(); } } this._fastMode = this._nextFastMode; } for (Int32 l = 0; l < this._behaviorList.Count; l++) { if (this._behaviorList[l].IsEnabled()) { this._behaviorList[l].HonoUpdate(); } } while (this._justAddLists[0].Count != 0 || this._justAddLists[1].Count != 0) { List <HonoBehavior> list = this._GetCurrentJustAddList(); this._SwapJustAddList(); for (Int32 m = 0; m < list.Count; m++) { list[m].HonoStart(); if (this.IsFastForwardModeActive()) { list[m].HonoOnStartFastForwardMode(); } else { list[m].HonoOnStopFastForwardMode(); } } for (Int32 n = 0; n < list.Count; n++) { if (list[n].IsEnabled()) { list[n].HonoUpdate(); } this._behaviorList.Add(list[n]); } list.Clear(); } for (Int32 num2 = 0; num2 < this._behaviorList.Count; num2++) { if (this._behaviorList[num2].IsEnabled()) { this._behaviorList[num2].HonoLateUpdate(); } } for (Int32 num3 = 0; num3 < this._justRemoveList.Count; num3++) { this._justRemoveList[num3].HonoOnDestroy(); Int32 num4 = this._behaviorList.IndexOf(this._justRemoveList[num3]); if (num4 != -1) { this._behaviorList.RemoveAt(num4); UnityEngine.Object.Destroy(this._justRemoveList[num3]); } } this._justRemoveList.Clear(); for (Int32 num5 = 0; num5 < this._justDisposeList.Count; num5++) { HonoBehaviorSystem.RemoveGameObject(this._justDisposeList[num5]); } this._justDisposeList.Clear(); if (HonoBehaviorSystem.ExtraLoopCount > 0) { i -= HonoBehaviorSystem.ExtraLoopCount; HonoBehaviorSystem.ExtraLoopCount = 0; } } } }
public void RegisterHonoBehavior() { HonoBehaviorSystem.AddBehavior(this); }