Ejemplo n.º 1
0
        private void InitGameCore(UseScriptType _scripttype)
        {
            if (!CheckInited(false))
            {
                DLog.LogError("不允许重复初始化GameCore,请检查代码");
                return;
            }
            SetPath();

            GameObject tobj = new GameObject("GameUpdateManager-" + AppName);

            GameObject.DontDestroyOnLoad(tobj);
            GManager = tobj.AddComponent <GameUpdateManager>();

            tobj = new GameObject("PlayAudioManager-" + AppName);
            GameObject.DontDestroyOnLoad(tobj);
            AudioManager = tobj.AddComponent <PlayAudioManager>();

            tobj = new GameObject("LoaderManager-" + AppName);
            GameObject.DontDestroyOnLoad(tobj);
            LManager = tobj.AddComponent <LoaderManager>();
            LManager.Init(AppName, AppPersistentResDataPath, AppStreamingAssetsResDataPath, AppResourcesDataPath);

            CManager = new CorotineManager(AppName, this);
            SManager = new ScriptManager(AppName, _scripttype);

            mIsInited = true;
        }
Ejemplo n.º 2
0
        override protected void DisposeNoGcCode()
        {
            if (IsSceneLoading)
            {
                DLog.LogError("异步加载场景未完成时,此时进行卸载GameCore操作,可能引起场景错乱.");
            }
            //公用
            PublicUpdateManager.ClearByKey(AppName);
            NetTool.HttpNet.ClearByKey(AppName);
            NetTool.TCPNet.Instance.ClearAppDelgate(AppName);

            for (int i = mScriptInterfaces.Count - 1; i >= 0; i--)
            {
                ScriptInterface.BehaviourInterfaceBase tscript = mScriptInterfaces[i];
                if (tscript == null)
                {
                    continue;
                }
                if (!tscript.mAppName.Equals(AppName))
                {
                    continue;
                }
                tscript.ClearScriptObject();
            }
            mScriptInterfaces.Clear();

            for (int i = mDontDestroyList.Count - 1; i >= 0; i--)
            {
                DestroyImmediate(mDontDestroyList[i]);
            }
            mDontDestroyList.Clear();

            GManager.DestroyManager();
            AudioManager.DestroyManager();
            LManager.DestroyManager();
            CManager.Dispose();
            SManager.Dispose();

            GManager     = null;
            LManager     = null;
            SManager     = null;
            AudioManager = null;
            CManager     = null;
        }