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) { + + } } }