public void Awake() { GameObject go = GameObject.Find("GlobalScripts"); if (go != null) { MLSNetManager = go.GetComponent(typeof(LSNetManager)) as LSNetManager; MGSNetManager = go.GetComponent(typeof(GSNetManager)) as GSNetManager; MDataTableManager = go.GetComponent(typeof(DataTableManager)) as DataTableManager; MGameDataManager = go.GetComponent(typeof(GameDataManager)) as GameDataManager; MHQGeneralManager = go.GetComponent(typeof(HQGeneralManager)) as HQGeneralManager; MGUIManager = go.GetComponent(typeof(GUIManager)) as GUIManager; MGUILayoutManager = go.GetComponent(typeof(GUILayoutManager)) as GUILayoutManager; MSceneManager = go.GetComponent(typeof(SceneManager)) as SceneManager; MPlayerManager = go.GetComponent(typeof(PlayerManager)) as PlayerManager; MNpcManager = go.GetComponent(typeof(NpcManager)) as NpcManager; MSkillManager = go.GetComponent(typeof(SkillManager)) as SkillManager; MTaskManager = go.GetComponent <TaskManager>() as TaskManager; M3DItemManager = go.GetComponent <EZ3DItemManager>() as EZ3DItemManager; MConnectManager = go.GetComponent <NativeConnectManager>() as NativeConnectManager; MRepeateEventManager = go.GetComponent <RepeateEventManager>() as RepeateEventManager; MAffectorManager = go.GetComponent <AffectorManager>() as AffectorManager; MEffectManager = go.GetComponent(typeof(EffectManager)) as EffectManager; MSoundManager = go.GetComponent(typeof(SoundManager)) as SoundManager; MCopySweepManager = go.GetComponent(typeof(CopySweepManager)) as CopySweepManager; MFingerEvent = go.GetComponent <FingerEvent>() as FingerEvent; MCameraController = go.GetComponentInChildren <CameraController>() as CameraController; MCamTrackController = go.GetComponentInChildren <CameraTrackController>() as CameraTrackController; MTeachManager = go.GetComponent(typeof(TeachManager)) as TeachManager; MGUIDataManager = go.GetComponent(typeof(GUIDataManager)) as GUIDataManager; MPushDataManager = go.GetComponent(typeof(PushDataManager)) as PushDataManager; MBundleManager = go.GetComponent(typeof(BundleManager)) as BundleManager; MResourceManager = go.GetComponent <ResourceMgr>() as ResourceMgr; MPortDefenseManager = go.GetComponent <PortDefenseManager>() as PortDefenseManager; MPortVieManager = go.GetComponent <PortVieManager>() as PortVieManager; MJunHunManager = go.GetComponent <JunHunManager>() as JunHunManager; MJobManager = go.GetComponent <JobManager>() as JobManager; mArenaInfoManager = go.GetComponent <ArenaInfoManager> () as ArenaInfoManager; mProduceManager = go.GetComponent <ProduceManager>() as ProduceManager; mEvolutionManager = go.GetComponent <EvolutionManager>() as EvolutionManager; mShopDataManager = go.GetComponent <ShopDataManager>() as ShopDataManager; MStarter = go.GetComponent <Starter>(); } }
void Awake() { if (guiData == null) { DontDestroyOnLoad(gameObject); guiData = this; } else if (guiData != this) { Destroy(gameObject); } } // end of awake