Browse Source

添加了相关滚动条

master
DESKTOP-B25GA9E\W35 2 years ago
parent
commit
269061511b
  1. 30
      Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs

30
Assets/DataGenerateTools/src/JsonGenerate/JsonFileLoaderEditor.cs

@ -14,6 +14,7 @@ namespace JXSoft { @@ -14,6 +14,7 @@ namespace JXSoft {
AnimBool m_ShowExtraFields;
private JsonData jsonData;
private List<bool> hoverArrowGroup;
private Vector2 scrollRect;
[MenuItem("JXSoft/Loader/JsonFileLoader")]
@ -33,15 +34,19 @@ namespace JXSoft { @@ -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 { @@ -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) {
}
}
}

Loading…
Cancel
Save