//draw the node window //change this to edit node instead void DrawOptionWindow(int id) { //edit the node if (GUILayout.Button("Edit Info")) { //windowsToAttach.Add(id); OptionSettings.OpenWindow(options[id], node); } GUI.DragWindow(); }
void DrawBody() { GUILayout.BeginArea(mainSection); //if windowstotattach is 2 and the connecting node isn't parented to that if (windowsToAttach.Count == 2 && !(nodeConnections[windowsToAttach[0]].Contains(windowsToAttach[1]))) { attachedWindows.Add(windowsToAttach[0]); attachedWindows.Add(windowsToAttach[1]); //create new dialogueOption //then open up dialogue window editor dialogueOption opt = new dialogueOption(); OptionSettings.OpenWindow(opt, nodes[windowsToAttach[0]]); opt._dest = windowsToAttach[1]; //add the dialogue option to the thingy thing nodes[windowsToAttach[0]]._options.Add(opt); nodeConnections[windowsToAttach[0]].Add(windowsToAttach[1]); windowsToAttach = new List <int>(); } if (attachedWindows.Count >= 2) { for (int i = 0; i < attachedWindows.Count; i += 2) { DrawNodeCurve(windows[attachedWindows[i]], windows[attachedWindows[i + 1]]); } } if (redrawLinks) { Debug.Log("Redrawing"); for (int i = 0; i < nodes.Count; i++) { //Debug.Log("Node " + i); for (int j = 0; j < nodeConnections[i].Count; j++) { //Debug.Log("EY"); DrawNodeCurve(windows[i], windows[nodeConnections[i][j]]); } } redrawLinks = false; } //for the node editor //mark beginning area for all popup windows BeginWindows(); //iterate over the contained windows and draw them for (int i = 0; i < windows.Count; i++) { windows[i] = GUI.Window(i, windows[i], DrawNodeWindow, "Node " + i); } EndWindows(); GUILayout.EndArea(); }