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 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 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(); } }
public void OnGUI() { if (BDEditorApplication.BDFrameworkEditorSetting == null) { return; } var BuildSqlSetting = BDEditorApplication.BDFrameworkEditorSetting.BuildSqlSetting; GUILayout.BeginVertical(); GUILayout.Label("3.表格打包", EditorGUIHelper.LabelH2); GUILayout.Space(5); if (GUILayout.Button("表格导出成Sqlite", GUILayout.Width(300), GUILayout.Height(30))) { //3.打包表格 Excel2SQLiteTools.AllExcel2SQLite(Application.streamingAssetsPath, BApplication.RuntimePlatform); Excel2SQLiteTools.CopySqlToOther(Application.streamingAssetsPath, BApplication.RuntimePlatform); } GUILayout.Space(10); if (BuildSqlSetting != null) { BuildSqlSetting.IsForceImportChangedExcelOnWillEnterPlaymode = EditorGUILayout.Toggle("PlayMode强制导表", BuildSqlSetting.IsForceImportChangedExcelOnWillEnterPlaymode); BuildSqlSetting.IsAutoImportSqlWhenExcelChange = EditorGUILayout.Toggle("Excel修改自动导表", BuildSqlSetting.IsAutoImportSqlWhenExcelChange); } GUILayout.EndVertical(); }
public void OnGUI() { var setting = BDEditorApplication.BDFrameWorkFrameEditorSetting; GUILayout.BeginVertical(); GUILayout.Label("3.表格打包", EditorGUIHelper.LabelH2); GUILayout.Space(5); if (GUILayout.Button("表格导出成Sqlite", GUILayout.Width(300), GUILayout.Height(30))) { //3.打包表格 Excel2SQLiteTools.AllExcel2SQLite(Application.streamingAssetsPath, BApplication.RuntimePlatform); Excel2SQLiteTools.CopySqlToOther(Application.streamingAssetsPath, BApplication.RuntimePlatform); } GUILayout.Space(10); if (setting != null) { setting.BuildSetting.IsForceImportChangedExcelOnWillEnterPlaymode = EditorGUILayout.Toggle("Playmode导入变动Excel", setting.BuildSetting.IsForceImportChangedExcelOnWillEnterPlaymode); } GUILayout.EndVertical(); }