/// <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); }); }
/// <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(); } }