protected override void DrawOpenNodeContent(ConversationDataControl content, ConversationNodeDataControl node) { ConversationNodeEditor editor = null; if (editors.TryGetValue(node, out editor)) { editor.draw(); } }
void nodeWindow(int id) { ConversationNode myNode = conversation.getAllNodes()[id]; ConversationNodeEditor editor = null; editors.TryGetValue(myNode, out editor); if (editor != null && editor.Collapsed) { GUIContent bttext = new GUIContent(TC.get("GeneralText.Open")); Rect btrect = GUILayoutUtility.GetRect(bttext, buttonstyle); GUILayout.BeginHorizontal(); if (GUI.Button(btrect, bttext)) { editor.Collapsed = false; } ; GUILayout.EndHorizontal(); } else { string[] editorNames = ConversationNodeEditorFactory.Intance.CurrentConversationNodeEditors; GUILayout.BeginHorizontal(); int preEditorSelected = ConversationNodeEditorFactory.Intance.ConversationNodeEditorIndex(myNode); int editorSelected = EditorGUILayout.Popup(preEditorSelected, editorNames); if (GUILayout.Button("-", collapseStyle, GUILayout.Width(15), GUILayout.Height(15))) { editor.Collapsed = true; GUIContent bttext = new GUIContent(TC.get("GeneralText.Open")); Rect btrect = GUILayoutUtility.GetRect(bttext, buttonstyle); editor.Window = new Rect(editor.Window.x, editor.Window.y, btrect.width, btrect.height); } if (GUILayout.Button("X", closeStyle, GUILayout.Width(15), GUILayout.Height(15))) { } //effects.getEffects().Remove(myEffect); GUILayout.EndHorizontal(); GUILayout.BeginVertical(); if (editor == null || preEditorSelected != editorSelected) { bool firstEditor = (editor == null); editor = ConversationNodeEditorFactory.Intance.createConversationNodeEditorFor(editorNames[editorSelected]); editor.setParent(this); if (firstEditor) { editor.Node = myNode; } else { setNode(myNode, editor.Node); } if (editors.ContainsKey(myNode)) { editor.Window = editors[myNode].Window; } else { editor.Window = tmpRects[myNode]; } editors.Remove(myNode); editors.Add(editor.Node, editor); } editor.draw(); GUILayout.EndVertical(); } if (Event.current.type != EventType.layout) { Rect lastRect = GUILayoutUtility.GetLastRect(); Rect myRect = editors[myNode].Window; myRect.height = lastRect.y + lastRect.height; editors[myNode].Window = myRect; this.Repaint(); } if (Event.current.type == EventType.mouseMove) { if ( new Rect(0, 0, editors[myNode].Window.width, editors[myNode].Window.height).Contains( Event.current.mousePosition)) { hovering = id; } } if (Event.current.type == EventType.mouseDown) { if (hovering == id) { focusing = hovering; } if (lookingChildNode != null) { // link creation between nodes if (lookingChildNode.getChildCount() > 0) { lookingChildNode.removeChild(lookingChildSlot); } lookingChildNode.addChild(lookingChildSlot, myNode); // finishing search lookingChildNode = null; } } GUI.DragWindow(); }