|
|
@ -14,6 +14,7 @@ namespace JXSoft { |
|
|
|
AnimBool m_ShowExtraFields; |
|
|
|
AnimBool m_ShowExtraFields; |
|
|
|
private JsonData jsonData; |
|
|
|
private JsonData jsonData; |
|
|
|
private List<bool> hoverArrowGroup; |
|
|
|
private List<bool> hoverArrowGroup; |
|
|
|
|
|
|
|
private Vector2 scrollRect; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MenuItem("JXSoft/Loader/JsonFileLoader")] |
|
|
|
[MenuItem("JXSoft/Loader/JsonFileLoader")] |
|
|
@ -33,15 +34,19 @@ namespace JXSoft { |
|
|
|
JsonFile = (TextAsset)EditorGUILayout.ObjectField("JsonFile", JsonFile, typeof(TextAsset), true); |
|
|
|
JsonFile = (TextAsset)EditorGUILayout.ObjectField("JsonFile", JsonFile, typeof(TextAsset), true); |
|
|
|
if (GUILayout.Button("AnalyzeJsonFile")) |
|
|
|
if (GUILayout.Button("AnalyzeJsonFile")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (JsonFile != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
jsonData = JsonMapper.ToObject(JsonFile.text); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (GUILayout.Button("Clear")) { |
|
|
|
if (GUILayout.Button("Clear")) { |
|
|
|
jsonData.Clear(); |
|
|
|
jsonData.Clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (JsonFile != null) { |
|
|
|
scrollRect = EditorGUILayout.BeginScrollView(scrollRect); |
|
|
|
jsonData = JsonMapper.ToObject(JsonFile.text); |
|
|
|
if (jsonData!=null) { |
|
|
|
loadData(jsonData); |
|
|
|
loadData(jsonData); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
EditorGUILayout.EndScrollView(); |
|
|
|
} |
|
|
|
} |
|
|
|
public void loadData(JsonData data) { |
|
|
|
public void loadData(JsonData data) { |
|
|
|
foreach (string key in data.Keys) |
|
|
|
foreach (string key in data.Keys) |
|
|
@ -63,17 +68,24 @@ namespace JXSoft { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
public void loadArray(JsonData data) { |
|
|
|
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()); |
|
|
|
EditorGUILayout.LabelField(v.ToString(), EditorStyles.boldLabel); |
|
|
|
if (v.IsArray) { |
|
|
|
loadArray(v); |
|
|
|
loadArray(v); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
EditorGUILayout.TextField("", v.ToString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
EditorGUILayout.EndVertical(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void generateCode(JsonData data) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|