From 269061511b3709f485ebd4ec769e04f8ce6a4952 Mon Sep 17 00:00:00 2001 From: "DESKTOP-B25GA9E\\W35" <1733709035@qq.com> Date: Fri, 17 Mar 2023 16:11:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/JsonGenerate/JsonFileLoaderEditor.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs b/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs index 0c8190d..9ceb760 100644 --- a/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs +++ b/Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs @@ -14,6 +14,7 @@ namespace JXSoft { AnimBool m_ShowExtraFields; private JsonData jsonData; private List hoverArrowGroup; + private Vector2 scrollRect; [MenuItem("JXSoft/Loader/JsonFileLoader")] @@ -33,15 +34,19 @@ namespace JXSoft { JsonFile = (TextAsset)EditorGUILayout.ObjectField("JsonFile", JsonFile, typeof(TextAsset), true); if (GUILayout.Button("AnalyzeJsonFile")) { - + if (JsonFile != null) + { + jsonData = JsonMapper.ToObject(JsonFile.text); + } } if (GUILayout.Button("Clear")) { jsonData.Clear(); } - if (JsonFile != null) { - jsonData = JsonMapper.ToObject(JsonFile.text); + scrollRect = EditorGUILayout.BeginScrollView(scrollRect); + if (jsonData!=null) { loadData(jsonData); } + EditorGUILayout.EndScrollView(); } public void loadData(JsonData data) { foreach (string key in data.Keys) @@ -63,17 +68,24 @@ namespace JXSoft { } } public void loadArray(JsonData data) { - if (data.IsArray) + foreach (JsonData v in data) { - foreach (JsonData v in data) + EditorGUILayout.BeginVertical("Label"); + if (v.IsArray) { - EditorGUILayout.TextField(v.GetType().ToString(), v.ToString()); - if (v.IsArray) { - loadArray(v); - } + EditorGUILayout.LabelField(v.ToString(), EditorStyles.boldLabel); + loadArray(v); } + else { + EditorGUILayout.TextField("", v.ToString()); + } + EditorGUILayout.EndVertical(); } } + + public void generateCode(JsonData data) { + + } } }