From 21ea44a475013a57ff09a53f298677f25e589810 Mon Sep 17 00:00:00 2001 From: jl_ios Date: Sat, 15 Aug 2020 16:38:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=A1=A8=E5=B7=A5=E5=85=B7=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExcelTool/DataConfig/DataConfigWindow.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Editor/ExcelTool/DataConfig/DataConfigWindow.cs b/Assets/Scripts/Editor/ExcelTool/DataConfig/DataConfigWindow.cs index 6b108b158a..50c3ea39b8 100644 --- a/Assets/Scripts/Editor/ExcelTool/DataConfig/DataConfigWindow.cs +++ b/Assets/Scripts/Editor/ExcelTool/DataConfig/DataConfigWindow.cs @@ -15,6 +15,7 @@ namespace GameEditor.Core.DataConfig static string m_Bench; static string[] m_Files; static bool[] m_Choose; + static string shellPath; [MenuItem("Data Config/Export")] private static void ShowConfigWin() @@ -33,14 +34,16 @@ namespace GameEditor.Core.DataConfig private static void LoadDic() { - m_Files = Directory.GetDirectories(m_ExcelPath, "*", SearchOption.TopDirectoryOnly); - m_Choose = new bool[m_Files.Length]; - - for (int i = 0; i < m_Files.Length; i++) + if (!string.IsNullOrEmpty(m_ExcelPath) && Directory.Exists(m_ExcelPath)) { - m_Choose[i] = m_Files[i] == m_Bench; - } + m_Files = Directory.GetDirectories(m_ExcelPath, "*", SearchOption.TopDirectoryOnly); + m_Choose = new bool[m_Files.Length]; + for (int i = 0; i < m_Files.Length; i++) + { + m_Choose[i] = m_Files[i] == m_Bench; + } + } } private static void SaveLocalConfig() { @@ -71,7 +74,7 @@ namespace GameEditor.Core.DataConfig //Application.dataPath 只能在主线程中获取 int lastIndex = Application.dataPath.LastIndexOf("/"); - string shellPath = Application.dataPath.Substring(0, lastIndex) + "/Shell/"; + shellPath = Application.dataPath.Substring(0, lastIndex) + "/Shell/"; // 新开线程防止锁死 Thread newThread = new Thread(new ParameterizedThreadStart(CmdOpenDirectory)); @@ -123,7 +126,7 @@ namespace GameEditor.Core.DataConfig EditorGUILayout.Space(); EditorGUILayout.LabelField("请选择分支:"); - if(m_Files.Length != 0) + if(m_Files != null && m_Files.Length != 0) { for (int i = 0; i < m_Files.Length; i++) { @@ -131,7 +134,6 @@ namespace GameEditor.Core.DataConfig } } else { - EditorGUILayout.LabelField("未找到分支"); } EditorGUILayout.EndVertical();