public void parseNodeString(string save) { string[] saveStrings = save.Replace(DataSimulator.DS_SAVELOAD_CHILD_START.ToString(), "") .Replace(DataSimulator.DS_SAVELOAD_CHILD_END.ToString(), "") .Split(DataSimulator.DS_SAVELOAD_SEPERATOR); for (int i = 0; i < saveStrings.Length; i++) { DSOutputData newData = new DSOutputData(); newData.name = saveStrings [i]; string[] splitDataName = newData.name.Split('/'); newData.data = ds.datas.Find(x => x.name.Equals(splitDataName [0])).fields.Find(x => x.name.Equals(splitDataName [1])); dataList.Add(newData); } }
public override void draw() { rect.height = 25f + dataList.Count * 20f + (actionType == DSOutputType.Export ? 55f : 0) + 75f; drawInOutPoint(); titleRect = rect; titleRect.height = 20f; extendedRect = rect; extendedRect.y = rect.y + titleRect.height - 1f; extendedRect.height = rect.height - titleRect.height; GUILayout.BeginArea(titleRect, title, GUI.skin.box); GUILayout.EndArea(); GUILayout.BeginArea(extendedRect, GUI.skin.box); GUILayout.BeginVertical(); GUILayout.Space(5f); GUILayout.BeginHorizontal(); GUILayout.Label("Type:", GUILayout.Width(labelWidth)); actionType = (DSOutputType)EditorGUILayout.EnumPopup(actionType); GUILayout.EndHorizontal(); if (actionType == DSOutputType.Export) { GUILayout.BeginHorizontal(); GUILayout.Label("Save To:", GUILayout.Width(labelWidth)); GUILayout.Label(exportPath, GUILayout.Width(rect.width - labelWidth - 20f - 15f)); if (GUILayout.Button("..", GUILayout.Width(20f))) { exportPath = EditorUtility.OpenFolderPanel("Save To", "", ""); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("File Name:", GUILayout.Width(labelWidth)); exportName = EditorGUILayout.TextField(exportName); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Action:", GUILayout.Width(labelWidth)); exportType = (DSExportType)EditorGUILayout.EnumPopup(exportType); GUILayout.EndHorizontal(); } GUILayout.Label("Output Data:"); for (int n = 0; n < dataList.Count; n++) { if (GUILayout.Button(dataList[n].name)) { DSOutputData data = dataList [n]; GenericMenu dropDownMenu = new GenericMenu(); for (int i = 0; i < ds.datas.Count; i++) { for (int j = 0; j < ds.datas [i].fields.Count; j++) { string itemName = ds.datas [i].name + "/" + ds.datas [i].fields [j].name; IDSData item = ds.datas [i].fields [j]; dropDownMenu.AddItem(new GUIContent(itemName), false, () => { data.data = item; data.name = itemName; }); } } dropDownMenu.ShowAsContext(); } } if (GUILayout.Button("+", GUILayout.Width(20f))) { DSOutputData newData = new DSOutputData(); newData.data = null; newData.name = ""; dataList.Add(newData); } GUILayout.EndVertical(); GUILayout.EndArea(); }