void OnGUI() { bool isBuilding = CheckIsBuilding(); if (isBuilding) { if (step == EBuildStep.CreateSourceFile | step == EBuildStep.CreateBinaryFile) { EditorUtility.DisplayProgressBar("Building...", "Do not close windows... ", 0.5f); GUILayout.Label("Waiting for building complete..."); } if (step == EBuildStep.None) { EditorUtility.DisplayProgressBar("Building...", "Do not close windows... ", 0.9f); GUILayout.Label("Waiting for cleaning complete..."); } } else { if (GUILayout.Button("Build Csv Class")) { JumpCsvCodeGenerator.CreateAllCsvClassSourceFiles("Build/CSV/Common", "Build/CSV/Common"); } if (!JumpCsvEditorHelper.ContainsJumpCsvAssetsFiles()) { GUILayout.Label("Please setup settings before build csv files"); } else if (IsNeedRebuild()) { if (GUILayout.Button("Build")) { if (EditorApplication.isCompiling) { return; } if (step != EBuildStep.None) { return; } try { JumpCsvCodeGenerator.CreateAllCsvClassSourceFiles("Build/CSV/Common", "Build/CSV/Common"); step = EBuildStep.CreateSourceFile; AssetDatabase.Refresh(); } catch (Exception e) { Debug.LogError(e.ToString()); step = EBuildStep.None; } } } else { GUILayout.Label("No files need to build"); } } }
void Update() { if (step == EBuildStep.CreateBinaryFile && !EditorApplication.isCompiling) { step = EBuildStep.None; EditorUtility.ClearProgressBar(); } if (step == EBuildStep.CreateSourceFile && !EditorApplication.isCompiling) { try { JumpCsvCodeGenerator.CreateAllCsvBinaryFiles(); step = EBuildStep.CreateBinaryFile; AssetDatabase.Refresh(); } catch (Exception) { Debug.LogError("Generate Binary Faild"); EditorUtility.ClearProgressBar(); step = EBuildStep.None; } } }