static public void Insert() { var h1 = new APITestHero() { Id = 1 }; var h2 = new APITestHero() { Id = 2 }; var h3 = new APITestHero() { Id = 3 }; if (SqliteLoder.Connection == null) { SqliteLoder.Load(Application.streamingAssetsPath); } SqliteHelper.DB.CreateDB <APITestHero>(); SqliteHelper.DB.InsertTable(new List <APITestHero>() { h1, h2, h3 }); }
/// <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("Persistent:" + Application.persistentDataPath); BDebug.Log("StreamingAsset:" + Application.streamingAssetsPath); //主工程启动 IGameStart mainStart; foreach (var type in mainProjectTypes) { if (type.GetInterface(nameof(IGameStart)) != null) { mainStart = Activator.CreateInstance(type) as IGameStart; //注册 mainStart.Start(); OnUpdate += mainStart.Update; OnLateUpdate += mainStart.LateUpdate; break; } } //开始资源检测 AssetHelper.AssetHelper.CheckAssetPackageVersion(Application.platform, () => { //1.美术目录 BResources.Load(GameConfig.ArtRoot, GameConfig.CustomArtRoot); //2.sql SqliteLoder.Load(GameConfig.SQLRoot); //3.脚本,这个启动会开启所有的逻辑 ScriptLoder.Load(GameConfig.CodeRoot, GameConfig.CodeRunMode, mainProjectTypes, clrBindingAction); }); }
/// <summary> /// 初始化 /// 修改版本,让这个启动逻辑由使用者自行处理 /// </summary> /// <param name="GameId">单游戏更新启动不需要id,多游戏更新需要id号</param> public void Launch(string GameId = "") { BDebug.Log("Persistent:" + Application.persistentDataPath); BDebug.Log("StreamingAsset:" + Application.streamingAssetsPath); //开始资源检测 AssetHelper.AssetHelper.CheckAssetPackageVersion(Application.platform, () => { //1.美术目录 BResources.Load(GameConfig.ArtRoot, GameConfig.CustomArtRoot); //2.sql SqliteLoder.Load(GameConfig.SQLRoot); //3.脚本,这个启动会开启所有的逻辑 ScriptLoder.Load(GameConfig.CodeRoot, GameConfig.CodeRunMode); }); }
static public void BDEditorInit() { #region 注册所以管理器,让管理器在编辑器下生效 //项目所有类 var types = typeof(BDLauncher).Assembly.GetTypes().ToList(); //编辑器所有类 var editorTypes = typeof(BDEditorMenuEnum).Assembly.GetTypes(); types.AddRange(editorTypes); List <IMgr> mgrs = new List <IMgr>(); foreach (var t in types) { if (t != null && t.BaseType != null && t.BaseType.FullName != null && t.BaseType.FullName.Contains(".ManagerBase`2")) { var i = t.BaseType.GetProperty("Inst").GetValue(null, null) as IMgr; mgrs.Add(i); continue; } } foreach (var t in types) { foreach (var mgr in mgrs) { mgr.CheckType(t); } } Debug.Log("BDFrameEditor:管理器注册完成"); #endregion DebuggerServerProcessManager.Inst.Start(); BDEditorHelper.Init(); BResources.Load(""); SqliteLoder.Load(Application.streamingAssetsPath); }
/// <summary> /// 初始化 /// 修改版本,让这个启动逻辑由使用者自行处理 /// </summary> /// <param name="GameId">单游戏更新启动不需要id,多游戏更新需要id号</param> public void Launch(string GameId = "") { //初始化资源加载 string coderoot = ""; string sqlroot = ""; string artroot = ""; //各自的路径 //art if (ArtRoot == AssetLoadPath.Editor) { if (Application.isEditor) { //默认不走AssetBundle artroot = ""; } else { //手机默认直接读取Assetbundle artroot = Application.persistentDataPath; } } else if (ArtRoot == AssetLoadPath.Persistent) { artroot = Application.persistentDataPath; } else if (ArtRoot == AssetLoadPath.StreamingAsset) { artroot = Application.streamingAssetsPath; } //sql if (SQLRoot == AssetLoadPath.Editor) { //sql 默认读streaming sqlroot = Application.streamingAssetsPath; } else if (SQLRoot == AssetLoadPath.Persistent) { sqlroot = Application.persistentDataPath; } else if (SQLRoot == AssetLoadPath.StreamingAsset) { sqlroot = Application.streamingAssetsPath; } //code if (CodeRoot == AssetLoadPath.Editor) { //sql 默认读streaming coderoot = ""; } else if (CodeRoot == AssetLoadPath.Persistent) { coderoot = Application.persistentDataPath; } else if (CodeRoot == AssetLoadPath.StreamingAsset) { coderoot = Application.streamingAssetsPath; } //多游戏更新逻辑 if (Application.isEditor == false) { if (GameId != "") { artroot = artroot + "/" + GameId; coderoot = coderoot + "/" + GameId; sqlroot = sqlroot + "/" + GameId; } } //sql SqliteLoder.Load(sqlroot); //art BResources.Load(artroot); //code LoadScrpit(coderoot); }
/// <summary> /// 初始化 /// 修改版本,让这个启动逻辑由使用者自行处理 /// </summary> /// <param name="GameId">单游戏更新启动不需要id,多游戏更新需要id号</param> public void Launch(string GameId = "") { //初始化资源加载 string coderoot = ""; string sqlroot = ""; string artroot = ""; //各自的路径 //art if (Config.ArtRoot == AssetLoadPath.Editor) { if (Application.isEditor) { //默认不走AssetBundle artroot = ""; } else { //手机默认直接读取Assetbundle artroot = Application.persistentDataPath; } } else if (Config.ArtRoot == AssetLoadPath.Persistent) { artroot = Application.persistentDataPath; } else if (Config.ArtRoot == AssetLoadPath.StreamingAsset) { if (string.IsNullOrEmpty(Config.CustomArtRoot) == false) { artroot = Config.CustomArtRoot; } else { artroot = Application.streamingAssetsPath; } } //sql if (Config.SQLRoot == AssetLoadPath.Editor) { //sql 默认读streaming sqlroot = Application.streamingAssetsPath; } else if (Config.SQLRoot == AssetLoadPath.Persistent) { sqlroot = Application.persistentDataPath; } else if (Config.SQLRoot == AssetLoadPath.StreamingAsset) { sqlroot = Application.streamingAssetsPath; } //code if (Config.CodeRoot == AssetLoadPath.Editor) { //sql 默认读streaming coderoot = ""; } else if (Config.CodeRoot == AssetLoadPath.Persistent) { coderoot = Application.persistentDataPath; } else if (Config.CodeRoot == AssetLoadPath.StreamingAsset) { coderoot = Application.streamingAssetsPath; } //多游戏更新逻辑 if (Application.isEditor == false) { if (GameId != "") { artroot = artroot + "/" + GameId; coderoot = coderoot + "/" + GameId; sqlroot = sqlroot + "/" + GameId; } } //异步 BResources.Load(artroot, () => { //sql SqliteLoder.Load(sqlroot); //异步 这里如果代码很早的时候就开始走表格逻辑,有可能报错, //但是大部分游戏应该不会,三层回调太丑,暂时用这个 ScriptLoder.Load(coderoot, Config.CodeRunMode); }); if (OnBDFrameLaunch != null) { OnBDFrameLaunch(); } }
static public void OpenSqlite() { SqliteLoder.Load(Application.streamingAssetsPath); }
/// <summary> /// 初始化 /// 修改版本,让这个启动逻辑由使用者自行处理 /// </summary> /// <param name="GameId">单游戏更新启动不需要id,多游戏更新需要id号</param> public void Launch(string GameId = "") { //初始化资源加载 string coderoot = ""; string sqlroot = ""; string artroot = ""; //各自的路径 //art if (ArtRoot == AssetLoadPath.Editor) { if (Application.isEditor) { //默认不走AssetBundle artroot = ""; } else { //手机默认直接读取Assetbundle artroot = Application.persistentDataPath; } } else if (ArtRoot == AssetLoadPath.Persistent) { artroot = Application.persistentDataPath; } else if (ArtRoot == AssetLoadPath.StreamingAsset) { artroot = Application.streamingAssetsPath; } //sql if (SQLRoot == AssetLoadPath.Editor) { //sql 默认读streaming sqlroot = Application.streamingAssetsPath; } else if (SQLRoot == AssetLoadPath.Persistent) { sqlroot = Application.persistentDataPath; } else if (SQLRoot == AssetLoadPath.StreamingAsset) { sqlroot = Application.streamingAssetsPath; } //code if (CodeRoot == AssetLoadPath.Editor) { //sql 默认读streaming coderoot = ""; } else if (CodeRoot == AssetLoadPath.Persistent) { coderoot = Application.persistentDataPath; } else if (CodeRoot == AssetLoadPath.StreamingAsset) { coderoot = Application.streamingAssetsPath; } //多游戏更新逻辑 if (Application.isEditor == false) { if (GameId != "") { artroot = artroot + "/" + GameId; coderoot = coderoot + "/" + GameId; sqlroot = sqlroot + "/" + GameId; } } //开始初始化 BResources.Load(artroot); SqliteLoder.Load(sqlroot); //非内部加载 if (artroot != "") { //开始启动逻辑 var dd = DataListenerServer.Create("BDFrameLife"); dd.AddData("OnAssetBundleOever"); dd.AddListener("OnAssetBundleOever", (o) => { //等待ab完成后,开始脚本逻辑 LoadScrpit(coderoot); }); } else { LoadScrpit(coderoot); } }