コード例 #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;
            }
        }
コード例 #2
0
ファイル: Gun.cs プロジェクト: yimengfan/BDFramework.Core
 void Start()
 {
     //加载接口初始化
     BResources.Init(BAssetLoadPathType);
     //预热
     BResources.WarmPool(bulletPath, 10);
     //测试删除
     this.StartCoroutine(TestDestory());
     //Notes
     // Make sure the prefab is inactive, or else it will run update before first use
 }
コード例 #3
0
    // Use this for initialization
    private void Awake()
    {
        this.gameObject.AddComponent <IEnumeratorTool>();

        BResources.Init(IsAssetBundleModel);
        //热更资源模式
        if (IsAssetBundleModel)
        {
            //开始启动逻辑
            var dd = DataListenerServer.Create("BDFrameLife");
            dd.AddData("OnAssetBundleOever");
            dd.AddListener("OnAssetBundleOever", (o) =>
            {
                //等待ab完成
                OnLaunch();
            });
        }
        else
        {
            OnLaunch();
        }
    }
コード例 #4
0
        /// <summary>

        #region 启动热更逻辑

        /// <summary>
        /// 初始化
        /// 修改版本,让这个启动逻辑由使用者自行处理
        /// </summary>
        /// <param name="mainProjectTypes">Editor模式下,UPM隔离了DLL需要手动传入</param>
        /// <param name="GameId">单游戏更新启动不需要id,多游戏更新需要id号</param>
        public void Launch(Type[] mainProjectTypes, Action <bool> clrBindingAction, string gameId = "default")
        {
            BDebug.Log("【Launch】Persistent:" + Application.persistentDataPath);
            BDebug.Log("【Launch】StreamingAsset:" + Application.streamingAssetsPath);
            //主工程启动
            IGameStart mainStart;

            foreach (var type in mainProjectTypes)
            {
                //TODO 这里有可能先访问到 IGamestart的Adaptor
                if (type.IsClass && type.GetInterface(nameof(IGameStart)) != null)
                {
                    BDebug.Log("【Launch】主工程Start! " + type.FullName);
                    mainStart = Activator.CreateInstance(type) as IGameStart;
                    if (mainStart != null)
                    {
                        //注册
                        mainStart.Start();
                        OnUpdate     += mainStart.Update;
                        OnLateUpdate += mainStart.LateUpdate;
                        break;
                    }
                }
            }


            BDebug.Log("【Launch】框架资源版本验证!");
            //开始资源检测
            BasePackageAssetsHelper.CheckBasePackageVersion(BApplication.RuntimePlatform, () =>
            {
                //1.美术目录
                BResources.Init(GameConfig.ArtRoot);
                //2.sql
                SqliteLoder.Init(GameConfig.SQLRoot);
                //3.脚本,这个启动会开启所有的逻辑
                ScriptLoder.Init(GameConfig.CodeRoot, GameConfig.CodeRunMode, mainProjectTypes, clrBindingAction);
            });
        }
コード例 #5
0
        /// <summary>
        /// 初始化
        /// 修改版本,让这个启动逻辑由使用者自行处理
        /// </summary>
        /// <param name="scriptPath"></param>
        /// <param name="artPath"></param>
        /// <param name=""></param>
        public void Launch()
        {
            //初始化资源加载
            BResources.Init(IsAssetbundleModel);
            SqliteLoder.Init();


            if (IsAssetbundleModel)
            {
                //开始启动逻辑
                var dd = DataListenerServer.Create("BDFrameLife");
                dd.AddData("OnAssetBundleOever");
                dd.AddListener("OnAssetBundleOever", (o) =>
                {
                    //等待ab完成后,开始脚本逻辑
                    LaunchScrpit();
                });
            }
            else
            {
                LaunchScrpit();
            }
        }
コード例 #6
0
 static public void Register()
 {
     //这里开启Assetbundle模式
     BResources.Init(AssetLoadPathType.DevOpsPublish);
 }
コード例 #7
0
 static public void Register()
 {
     BResources.Init(AssetLoadPathType.Editor);
 }