示例#1
0
        public override ExitNode BuildReturnNode(NodeBuilder <ExitNode> builder)
        {
            var node = builder.Build() as ExitNode;

            node.IsEditable = true;
            node.X          = 750;
            node.Y          = 300;

            node.AddExecPin(Direction.Input, canBeRenamed: true);

            return(node);
        }
示例#2
0
        public override EntryNode BuildEntryNode(NodeBuilder <EntryNode> builder)
        {
            var node = builder.Build() as EntryNode;

            node.IsEditable = true;
            node.X          = 100;
            node.Y          = 300;

            node.AddExecPin(Direction.Output, canBeRenamed: true);

            return(node);
        }
示例#3
0
        public override ExitNode BuildReturnNode(NodeBuilder <ExitNode> builder)
        {
            var node = builder.Build() as ExitNode;

            node.IsEditable = false;
            node.X          = 750;
            node.Y          = 300;

            node.AddExecPin(Direction.Input);
            node.AddDataPin <string>(Direction.Input, "Text");

            return(node);
        }
示例#4
0
        public override EntryNode BuildEntryNode(NodeBuilder <EntryNode> builder)
        {
            var node = builder.Build() as EntryNode;

            node.IsEditable = false;
            node.X          = 100;
            node.Y          = 300;

            node.AddExecPin(Direction.Output);
            node.AddDataPin <string>(Direction.Output, "Text");

            return(node);
        }
示例#5
0
        public override ExitNode BuildReturnNode(NodeBuilder <ExitNode> builder)
        {
            var node = builder.Build() as ExitNode;

            node.IsEditable = false;
            node.X          = 750;
            node.Y          = 300;

            node.AddExecPin(Direction.Input);
            node.AddDataPin <double[]>(Direction.Input, "Red");
            node.AddDataPin <double[]>(Direction.Input, "Green");
            node.AddDataPin <double[]>(Direction.Input, "Blue");
            node.AddDataPin <int>(Direction.Input, "Width");
            node.AddDataPin <int>(Direction.Input, "Height");

            return(node);
        }
示例#6
0
        public IEnumerable <Node> LoadNodes(IArchive nodesArchive)
        {
            var nodes = nodesArchive.ReadAll <Archive>();

            foreach (var node in nodes)
            {
                var templateId = node.Read <Guid>(nameof(Node.TemplateId));
                if (templateId != Guid.Empty)
                {
                    var builder = new NodeBuilder(this, new NodeBuilder.Configuration(ServiceProvider, templateId));
                    var result  = builder.Build();
                    if (result != null)
                    {
                        result.Load(node);
                        AddNode(result);
                        yield return(result);
                    }
                    else
                    {
                        var name = node.Read <string>(nameof(Node.Name));
                        _output.Write($"Could not load node: {name} -> {templateId}", OutputType.Warning);
                    }
                }
                else // it's a default node spawned by the graph or a variable
                {
                    var instanceId = node.Read <Guid>(nameof(Node.Id));
                    if (instanceId == EntryNode.InstanceId)
                    {
                        Entry.Load(node);
                    }
                    else if (instanceId == ExitNode.InstanceId)
                    {
                        Exit.Load(node);
                    }
                    else // it's a variable
                    {
                        var type   = node.Read <Type>(nameof(VariableNode.Type));
                        var result = this.AddVariable(type);
                        result.Load(node);
                    }
                }
            }
        }