// 切换服务器流程 //public static CGamePro_ChangeScene s_pProcChangeScene; //初始化静态变量 public static void InitStaticMemeber() { s_EventManager = new Events(); //PrefabLoaderManager.Init(); Main main = Tool.Main(); if (main.m_UseCSHotFixDll) { s_MainHotFixManager = new HotFixManager(); s_MainHotFixManager.Init("HotFix"); UnityEngine.Debug.Log("Use Manual .Net"); } else { s_MainHotFixManager_SystemDll = new HotFixManager_SystemDll(); s_MainHotFixManager_SystemDll.Init("HotFix"); UnityEngine.Debug.Log("Use System .Net"); } //初始化所有的循环实例 s_ProcStartApp = new CGamePro_StartApplication(); //启动游戏 s_ProcLogIn = new CGamePro_Login(); //!< 登录循环 //s_pProcCharCreate = new CGamePro_CharCreate(); //!< 人物创建流程 s_ProcBattle = new CGamePro_Battle(); //!< 主游戏循环 s_ProcLobby = new CGamePro_Lobby(); //NetworkManager.Init(); //NetworkManager.StartNetwork(NetworkProtol.Tcp); s_TimerManager = new TimerManager(); //s_RoleManager = new CObjectManager(); //s_VariableManager = new VariableManager(); //s_JBmanager = new JBManager(); s_BattleManager = new BattleManager(); ////------------------------------------------------------------------- ////初始化工作节点 //s_pVariableSystem.Initial(object.Zero); //s_pEventSystem.Initial(object.Zero); //s_pWorldManager.Initial(object.Zero); //if (s_pUISystem != null) s_pUISystem.Initial(object.Zero); //DataManager.Init(); MessageManager.RegMessages(); InputManager.Init(); //s_JBmanager.Init(null, null); //Test------------------------------------------------------------- s_BattleManager.Init(); s_ActiveProcedure = s_ProcStartApp; s_EventManager.OnHurtEvent.SafeInvoke(12, 11); s_EventManager.OnCameraPositionChangedEvent.SafeInvoke(); }
//释放静态变量 public static void ReleaseStaticMember() { if (s_BattleManager != null) { s_BattleManager.Destroy(); s_BattleManager = null; } if (s_TimerManager != null) { s_TimerManager.Destroy(); s_TimerManager = null; } //if (s_JBmanager != null) //{ // s_JBmanager.Destroy(); // s_JBmanager = null; //} MessageManager.UnregMessages(); //NetworkManager.Destroy(); //DataManager.Destroy(); //释放所有的循环实例 if (s_ProcLogIn != null) { s_ProcLogIn = null; } if (s_ProcBattle != null) { s_ProcBattle = null; } if (s_ProcLobby != null) { s_ProcLobby = null; } s_ProcPrev = s_ActiveProcedure = null; if (s_MainHotFixManager != null) { s_MainHotFixManager.OnApplicationQuit(); s_MainHotFixManager.Destroy(); s_MainHotFixManager = null; } if (s_MainHotFixManager_SystemDll != null) { s_MainHotFixManager_SystemDll.OnApplicationQuit(); s_MainHotFixManager_SystemDll.Destroy(); s_MainHotFixManager_SystemDll = null; } s_EventManager = null; //PrefabLoaderManager.Destroy(); }