コード例 #1
0
    private void CreateNodes()
    {
        ActorStateNode        tempNode;
        List <AINodePortData> nodePorts;

        foreach (var node in _containerCache.nodeData)
        {
            if (node.GUID == "0")
            {
                tempNode = _targetGraphView.GenerateEntryPointNode(node.ports.Count > 0 ? node.ports.First().cond : null);
                tempNode.SetPosition(new Rect(node.position, _targetGraphView.defaultNodeSize));
                _targetGraphView.AddElement(tempNode);
                continue;
            }
            tempNode = _targetGraphView.GenerateAINode(node.title, node.relevantState);

            tempNode.GUID = node.GUID;
            tempNode.SetPosition(new Rect(node.position, _targetGraphView.defaultNodeSize));
            //tempNode.relevantState = node.relevantState;
            _targetGraphView.AddElement(tempNode);

            //nodePorts = _containerCache.nodeData.Where(x => x.GUID == node.GUID).ToList();
            nodePorts = node.ports;
            nodePorts.ForEach(x => _targetGraphView.AddConditionPort(tempNode, x.cond, x.destState, x.portName));
            tempNode.RefreshPorts();
            tempNode.RefreshExpandedState();
        }

        /*
         *
         * if (Nodes.Any())
         * {
         *  foreach(ActorStateNode node in Nodes)
         *  {
         *      _targetGraphView.AddElement(node);
         *  }
         *
         * }
         * else
         * {
         *
         * }*/
    }
コード例 #2
0
    private void CreateNodes()
    {
        foreach (var nodeData in _containerCache.AINodeData)
        {
            //Instead use enum?
            var tempNode = _targetGraphView.CreateAINode(nodeData.AItext, Vector2.zero);
            tempNode.GUID = nodeData.Guid;
            _targetGraphView.AddElement(tempNode);

            var nodePorts = _containerCache.NodeLinks.Where(x => x.BaseNodeGUID == nodeData.Guid).ToList();
            nodePorts.ForEach(x => _targetGraphView.AddChoicePort(tempNode, x.PortName));
        }
    }