public override void Init() { AppContext.managerList = new List <IModule>(); AppContext.ToBeAdd = new List <IModule>(); base.Init(); SceneRoot = new GameObject("SceneRoot"); SceneRoot.ResetTransform(transform); mono = gameobject.AddComponent <GameMono>(); UnityEngine.Object.DontDestroyOnLoad(gameobject); }
public void Subscribe(GameMono obj) { GameMono[] temp = Monos; Monos = new GameMono[temp.Length + 1]; for (int i = 0; i < temp.Length; i++) { Monos[i] = temp[i]; } obj.gameId = currId; Monos[temp.Length] = obj; currId++; }
public void Unsubscribe(GameMono obj) { int tempId = 0; GameMono[] temp = Monos; Monos = new GameMono[temp.Length - 1]; for (int i = 0; i < temp.Length; i++) { if (temp[i].gameId != obj.gameId) { Monos[tempId] = temp[i]; tempId++; } } }