private void GenerateCode() { _isGenerateCode = true; string csName = _tempTableConfig.TableName + "SerializeData.cs"; if (string.IsNullOrEmpty(_tempTableConfig.CodePath)) { string path = EditorUtility.SaveFolderPanel(LanguageUtils.CreateInfoSelectFolder, Application.dataPath, ""); int index = path.IndexOf("Asset"); if (index < 0) { if (EditorUtility.DisplayDialog(LanguageUtils.CommonSaveFailed, LanguageUtils.CommonNullPath, "OK")) { _isGenerateCode = false; return; } } path = path.Substring(index, path.Length - index); _tempTableConfig.CodePath = path + "/" + csName; } else { if (Path.GetFileName(_tempTableConfig.CodePath) != csName) { _tempTableConfig.CodePath = Path.GetDirectoryName(_tempTableConfig.CodePath) + "/" + csName; } } if (string.IsNullOrEmpty(_tempTableConfig.PrimaryKey)) { if (EditorUtility.DisplayDialog(LanguageUtils.CommonSaveFailed, LanguageUtils.CreateInfoPrimaryKeyIsNull, "OK")) { _isGenerateCode = false; return; } } EditorApplication.LockReloadAssemblies(); try { GenerateCode code = new GenerateCode(_tempTableConfig); if (!code.GenerateTable()) { if (EditorUtility.DisplayDialog(LanguageUtils.CommonSaveFailed, LanguageUtils.CreateInfoCodeError, "OK")) { _isGenerateCode = false; return; } } EditorApplication.UnlockReloadAssemblies(); _isGenerateCode = false; if (EditorUtility.DisplayDialog("success", LanguageUtils.CommonSaveSuccess, "OK")) { AssetDatabase.Refresh(); } } catch (Exception ex) { EditorApplication.UnlockReloadAssemblies(); _isGenerateCode = false; EditorUtility.DisplayDialog(LanguageUtils.CommonSaveFailed, ex.Message, "OK"); } }