static public void OnForceImpotChangedExcel() { //判断是否导入设置 if (BDEditorApplication.BDFrameworkEditorSetting.BuildSqlSetting.IsForceImportChangedExcelOnWillEnterPlaymode) { var(changedExcelList, newEcxcelInfoMap) = ExcelEditorTools.GetChangedExcels(); if (changedExcelList.Count > 0) { BDebug.Log("-----------------强制导入修改的excel文件.begin-----------------", "red"); SqliteLoder.LoadLocalDBOnEditor(Application.streamingAssetsPath, BApplication.RuntimePlatform); { //开始导入 foreach (var excel in changedExcelList) { var path = AssetDatabase.GUIDToAssetPath(excel); Excel2SQLiteTools.Excel2SQLite(path, DBType.Local); } } SqliteLoder.Close(); BDebug.Log("-----------------强制导入修改的excel文件.end-----------------", "red"); } //保存配置 ExcelEditorTools.SaveExcelCacheInfo(newEcxcelInfoMap); } }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { //判断设置 var BuildSqlSetting = BDEditorApplication.BDFrameworkEditorSetting.BuildSqlSetting; if (!BuildSqlSetting.IsAutoImportSqlWhenExcelChange) { return; } //开始导表 var excelList = new List <string>(); foreach (var asset in importedAssets) { if (asset.EndsWith("xlsx", StringComparison.OrdinalIgnoreCase) && asset.Contains("Table", StringComparison.OrdinalIgnoreCase) && !asset.Contains("~")) { excelList.Add(asset); } } if (excelList.Count > 0) { SqliteLoder.LoadLocalDBOnEditor(Application.streamingAssetsPath, BApplication.RuntimePlatform); float counter = 1f; foreach (var excel in excelList) { Excel2SQLiteTools.Excel2SQLite(excel, DBType.Local); EditorUtility.DisplayProgressBar("自动导表", excel, counter / excelList.Count); counter++; } EditorUtility.ClearProgressBar(); BDebug.Log("自动导表完成!"); SqliteLoder.Close(); } }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { var excelList = new List <string>(); foreach (var asset in importedAssets) { if (asset.EndsWith("xlsx") && asset.Contains("Table") && !asset.Contains("~")) { excelList.Add(asset); } } if (excelList.Count > 0) { SqliteLoder.LoadLocalDBOnEditor(Application.streamingAssetsPath, BApplication.RuntimePlatform); float counter = 1f; foreach (var excel in excelList) { Excel2SQLiteTools.Excel2SQLite(excel, DBType.Local); EditorUtility.DisplayProgressBar("自动导表", excel, counter / excelList.Count); counter++; } EditorUtility.ClearProgressBar(); BDebug.Log("自动导表完成!"); SqliteLoder.Close(); } }