void DisplaySheetInfo(Sheet sheet) { string outputPath = PlayerPrefs.GetString("ExcelToJson_OutputPath"); EditorGUILayout.BeginHorizontal(GUILayout.MinHeight(30)); GUILayout.Space(10f); CustomEditorTools.DrawLabel(sheet.sheetName, 100f, "OL Title"); GUILayout.Space(5f); if (CustomEditorTools.DrawMiniButton("Convert")) { ExcelToJsonConvert.ConvertToJson(sheet, outputPath); CustomEditorTools.DisplayNoticeDialog("Notice", "Completed Convert Excel To Json"); return; } GUILayout.Space(5f); EditorGUILayout.LabelField(sheet.outputName + ".json"); EditorGUILayout.EndHorizontal(); }
void DisplayExcelFile() { string outputPath = PlayerPrefs.GetString("ExcelToJson_OutputPath"); CustomEditorTools.DrawHeader("Excel File Info"); CustomEditorTools.BeginContents(); EditorGUILayout.BeginHorizontal(); if (CustomEditorTools.DrawMiniButton("Clear Excel Data")) { _currentBookInfo.Clear(); } if (CustomEditorTools.DrawMiniButton("Remove All Json")) { DirectoryInfo outputDir = new DirectoryInfo(outputPath); if (outputDir.Exists) { FileInfo[] files = outputDir.GetFiles(); for (int i = files.Length - 1; i >= 0; i--) { FileUtil.DeleteFileOrDirectory(outputPath + "/" + files[i].Name); } } AssetDatabase.Refresh(); } if (CustomEditorTools.DrawMiniButton("All Convert")) { if (_currentBookInfo.Count <= 0) { CustomEditorTools.DisplayNoticeDialog("Warring", "Excel Data Empty, Select Excel Data"); return; } for (int i = 0; i < _currentBookInfo.Count; i++) { for (int j = 0; j < _currentBookInfo [i].sheet.Length; j++) { ExcelToJsonConvert.ConvertToJson(_currentBookInfo [i].sheet[j], outputPath); } } CustomEditorTools.DisplayNoticeDialog("Notice", "Completed Convert Excel To Json"); } EditorGUILayout.EndHorizontal(); CustomEditorTools.EndContens(); CustomEditorTools.BeginContents(); _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, GUILayout.MinHeight(200f)); for (int i = _currentBookInfo.Count - 1; i >= 0; i--) { CustomEditorTools.BeginContents(); EditorGUILayout.BeginHorizontal(); bool foldOut = GUILayout.Toggle(_currentBookInfo[i].foldOut, _currentBookInfo[i].fileName, "Foldout", GUILayout.MaxWidth(200f), GUILayout.MinWidth(200f)); if (foldOut != _currentBookInfo[i].foldOut) { _currentBookInfo[i].foldOut = foldOut; } EditorGUILayout.EndHorizontal(); if (_currentBookInfo[i].foldOut) { if (_currentBookInfo[i].sheet == null) { continue; } for (int j = 0; j < _currentBookInfo[i].sheet.Length; j++) { DisplaySheetInfo(_currentBookInfo [i].sheet [j]); } } CustomEditorTools.EndContens(); } EditorGUILayout.EndScrollView(); CustomEditorTools.EndContens(); }