示例#1
0
        /// <summary>
        /// 初始化框架编辑器
        /// </summary>
        static public void InitEditorEnvironment()
        {
            //是否为batchmode
            if (Application.isBatchMode)
            {
                Debug.Log("BDFramework version:" + BDLauncher.Version);
            }

            //只有在非Playing的时候才初始化
            if (EditorApplication.isPlayingOrWillChangePlaymode || IsInited)
            {
                return;
            }

            try
            {
                //BD初始化
                //BApplication.Init();
                //BDEditor初始化
                BDEditorApplication.Init();
                //加载主工程的DLL Type
                var assemblyPath      = BApplication.Library + "/ScriptAssemblies/Assembly-CSharp.dll";
                var editorAssemlyPath = BApplication.Library + "/ScriptAssemblies/Assembly-CSharp-Editor.dll";
                if (File.Exists(assemblyPath) && File.Exists(editorAssemlyPath))
                {
                    var gAssembly = Assembly.LoadFile(assemblyPath);
                    var eAssemlby = Assembly.LoadFile(editorAssemlyPath);
                    Types = CollectTypes(gAssembly, eAssemlby).ToArray();
                }

                //编辑器下加载初始化
                BResources.Init(AssetLoadPathType.Editor);
                //编辑器下管理器注册
                ManagerInstHelper.Load(Types);
                //Editor的管理器初始化
                BDFrameworkPipelineHelper.Init();
                //调试器启动
                DebuggerServerProcessManager.Inst.Start();
                //Pipeline初始化
                HotfixPipelineTools.Init();
                //编辑器初始化
                InitEditorTask();
                //编辑器任务
                EditorTaskInstance.OnUnityLoadOrCodeRecompiled();
                //编辑器http服务
                InitEditorHttpServer();
                //最后,完成初始化
                IsInited = true;
                //  Debug.Log("框架编辑器环境初始化成功!");
            }
            catch (Exception e)
            {
                Debug.LogError("框架编辑器环境初始化失败!");
                Debug.LogError(e);
                throw;
            }
        }
 /// <summary>
 /// 当进入paymode
 /// </summary>
 static private void OnEnterPlayMode()
 {
     BDEditorApplication.Init();
     InitEditorTask();
     EditorTaskInstance.OnEnterWillPlayMode();
 }
 /// <summary>
 /// 编辑器的Update
 /// </summary>
 static public void EditorUpdate()
 {
     //编辑器任务的update
     EditorTaskInstance?.OnEditorUpdate();
 }