示例#1
0
        public static LinkInfo From(NodeInfo nodeInfo, Slot slot, Node node)
        {
            Tuple<Slot, Node> tuple = new Tuple<Slot, Node>(slot, node);
            LinkInfo linkInfo;

            if (!linkInfos.TryGetValue(tuple, out linkInfo))
                linkInfos.Add(tuple, linkInfo = new LinkInfo(nodeInfo, slot, node));

            return linkInfo;
        }
示例#2
0
        private LinkInfo(NodeInfo nodeInfo, Slot slot, Node node)
        {
            Slot = slot;
            SlotInfo = SlotInfo.From(nodeInfo, slot);
            SlotInfo.PropertyChanged += SlotInfo_PropertyChanged;

            Node = node;
            NodeInfo = NodeInfo.From(nodeInfo.FlowInfo, node);
            NodeInfo.PropertyChanged += NodeInfo_PropertyChanged;
        }
示例#3
0
        private IEnumerable<Node> GetAllNodes(Node node, List<Node> knownNodes)
        {
            if (knownNodes.Contains(node))
                yield break;

            yield return node;
            knownNodes.Add(node);

            foreach (Slot slot in node.Slots)
                foreach (Node slotNode in slot.Nodes)
                    foreach (Node subNode in GetAllNodes(slotNode, knownNodes))
                    {
                        if (knownNodes.Contains(subNode))
                            continue;

                        yield return subNode;
                        knownNodes.Add(subNode);
                    }
        }
        protected virtual NodeStep EvaluateNode(Node node)
        {
            NodeStep step;
            Log.Trace("Entering node {0}", node.GetType().Name);

            try
            {
                step = node.Evaluate();
            }
            catch
            {
                step = new NodeStep(NodeResult.Fail, null);
            }

            if (evaluating)
                Log.Trace("Exiting node {0} with result {1}{2}", node.GetType().Name, step.Result, step.Slot == null ? "" : (" by slot " + step.Slot.Name));

            return step;
        }
示例#5
0
 private NodeInfo(FlowInfo flowInfo, Node node)
 {
     FlowInfo = flowInfo;
     Node = node;
     NodeAnchorBinder.PropertyChanged += NodeAnchorBinder_PropertyChanged;
 }
示例#6
0
        public static NodeInfo From(FlowInfo flowInfo, Node node)
        {
            NodeInfo nodeInfo;

            if (!nodeInfos.TryGetValue(node, out nodeInfo))
                nodeInfos.Add(node, nodeInfo = new NodeInfo(flowInfo, node));

            return nodeInfo;
        }
示例#7
0
 public AddNodeAction(FlowInfo flow, Node node)
 {
     FlowInfo = flow;
     Node = node;
 }