//FOR ADDING NEW node void ContextCallback(object obj) { string clb = obj.ToString(); switch (clb) { case ("startNode"): EditorBaseNode startNode = new EditorStartNode(mousePos); NodeManager.Instance.addNode(startNode); ActiveNode = startNode; startNodeAdded = true; break; case ("dialogueNode"): EditorBaseNode dialogueNode = new EditorDialogueNode(mousePos); NodeManager.Instance.addNode(dialogueNode); ActiveNode = dialogueNode; break; case ("decisionNode"): EditorBaseNode decisionNode = new EditorDecisionNode(mousePos); NodeManager.Instance.addNode(decisionNode); ActiveNode = decisionNode; break; case ("gotoNode"): EditorBaseNode gotoNode = new EditorGotoNode(mousePos); NodeManager.Instance.addNode(gotoNode); ActiveNode = gotoNode; //Instantiate gotonode here break; } }
// // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // / //Lo uso para cargar los nodos de un arbol void LoadNode(Vector2 rectPos, List <string> dialogues, List <Choice> conections, string nodeType) { BaseNode baseNode; //Se fija si es un portal o uno de dialogo normal if (nodeType == NodeType.Dialogue.ToString()) { baseNode = new EditorDialogueNode(rectPos.x, rectPos.y, dialogueNodeWidth, dialogueNodeHeight, currentName, NodeType.Dialogue); } else { var node = new EditorPortalNode(rectPos.x, rectPos.y, portalNodeWidth, portalNodeHeight, currentName, NodeType.Portal); if (node.connected.Any()) { node.portalDestination = conections[0].connectionID.ToString(); } baseNode = node; } for (int i = 0; i < dialogues.Count; i++) { baseNode.dialogues.Add(dialogues[i]); } for (int i = 0; i < conections.Count; i++) { OptionButton oButton = new OptionButton(); oButton.destination = conections[i].connectionID; oButton.text = conections[i].text; baseNode.connected.Add(oButton); } _allNodes.Add(baseNode); Repaint(); }