コード例 #1
0
    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);
    }
コード例 #2
0
    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);
    }