private void AddChoicePort(DialougeNode dialogNode) { var generatedPort = GeneratePort(dialogNode, Direction.Output); var outputPortCount = dialogNode.outputContainer.Query("connector").ToList().Count; generatedPort.portName = $"Choice {outputPortCount}"; dialogNode.outputContainer.Add(generatedPort); dialogNode.RefreshExpandedState(); dialogNode.RefreshPorts(); }
private DialougeNode GenerateEntryPointNode() { var node = new DialougeNode { title = "START", GUID = Guid.NewGuid().ToString(), DialogueText = "ENTRYPOINT", entryPoint = true }; var generatedPort = GeneratePort(node, Direction.Output); generatedPort.name = "Next"; node.outputContainer.Add(generatedPort); node.RefreshExpandedState(); node.RefreshPorts(); node.SetPosition(new Rect(100, 200, 100, 150)); return(node); }
public DialougeNode CreateDialogueNode(string nodeName) { var dialogNode = new DialougeNode { title = nodeName, DialogueText = nodeName, GUID = Guid.NewGuid().ToString() }; var inputPort = GeneratePort(dialogNode, Direction.Input, Port.Capacity.Multi); inputPort.name = "Input"; dialogNode.inputContainer.Add(inputPort); var button = new Button(() => { AddChoicePort(dialogNode); }); button.text = "New choice"; dialogNode.titleContainer.Add(button); dialogNode.RefreshExpandedState(); dialogNode.RefreshPorts(); dialogNode.SetPosition(new Rect(Vector2.zero, defaultNodeSize)); return(dialogNode); }