コード例 #1
0
        public override IEnumerator ExecuteNode(NodeExecutionContext context)
        {
            NTGraph g = graph as NTGraph;

            NodePort port = GetPort(variablePath);

            object portValue = port.GetInputValue();

            if (!port.IsConnected)
            {
                portValue = backingValue;
            }

            object value = null;


            if (portValue != null)
            {
                if (!string.IsNullOrEmpty(variablePath))
                {
                    value = g.variableDelegate.GetValue(dataKey);

                    if (value == null)
                    {
                        yield break;
                    }

                    ReflectionUtilities.SetValueOf(ref value, portValue, variablePath.Split('/').ToList());

                    g.variableDelegate.SetValue(dataKey, value);
                }
                else
                {
                    value = portValue;
                }
            }
            else
            {
            }


            yield return(null);
        }
コード例 #2
0
        public override IEnumerator ExecuteNode(NodeExecutionContext context)
        {
            NTGraph g = graph as NTGraph;

            NodePort port = GetPort(dataKey);

            object portValue = port.GetInputValue();

            if (!port.IsConnected)
            {
                portValue = backingValue;
            }

            if (portValue != null)
            {
                g.variableDelegate.SetUserVariable(dataKey, portValue);
            }

            yield return(null);
        }
コード例 #3
0
        public override object GetValue(NodePort port)
        {
            if (graph is NTGraph)
            {
                NTGraph g             = (NTGraph)graph;
                object  variableValue = g.variableDelegate.GetUserVariable(dataKey);

                if (variableValue != null)
                {
                    return(variableValue);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        public override object GetValue(NodePort port)
        {
            if (graph is NTGraph)
            {
                NTGraph g             = (NTGraph)graph;
                object  variableValue = g.variableDelegate.GetValue(dataKey);

                if (variableValue != null)
                {
                    if (!string.IsNullOrEmpty(variablePath))
                    {
                        object value = ReflectionUtilities.GetValueOf(new List <string>(variablePath.Split('/')), variableValue);

                        if (value != null && value is  SceneGameObjectReference)
                        {
                            value = ((SceneGameObjectReference)value).reference;
                        }

                        return(value);
                    }
                    else
                    {
                        return(g.variableDelegate.GetSceneGameObject(dataKey));
                    }
                }
                else if (string.IsNullOrEmpty(variablePath))
                {
                    return(g.variableDelegate.GetSceneGameObject(dataKey));;
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
    public void SpawnGraph()
    {
        if (nodes != null)
        {
            nodes.Clear();
        }
        else
        {
            nodes = new List <IUGUINode>();
        }

        if (graph == null)
        {
            return;
        }

        for (int i = 0; i < graph.nodes.Count; i++)
        {
            Node node = graph.nodes[i];

            if (node == null)
            {
                continue;
            }

            UGUIBaseNode runtimeNode = null;

            runtimeNode = Instantiate(nodePrefab);

            runtimeNode.transform.SetParent(scrollRect.content);
            runtimeNode.node  = node;
            runtimeNode.graph = this;
            runtimeNode.transform.localPosition = new Vector2(node.position.x, -node.position.y);
            runtimeNode.transform.localScale    = Vector3.one;
            runtimeNode.name = node.GetType().Name;

            runtimeNode.SetColor();

            runtimeNode.gameObject.SetActive(true);

            nodes.Add(runtimeNode);
        }

        if (graph is NTGraph)
        {
            NTGraph gnt = (NTGraph)graph;

            if (gnt.packedNodes == null)
            {
                gnt.packedNodes = new List <NodeGroupGraph>();
            }

            foreach (var extra in gnt.packedNodes)
            {
                UGUIGroupedNode runtimeNode = null;

                runtimeNode = Instantiate(groupedNodePrefab);

                runtimeNode.transform.SetParent(scrollRect.content);
                runtimeNode.group = extra;
                runtimeNode.graph = this;
                runtimeNode.transform.localPosition = new Vector2(extra.position.x, -extra.position.y);
                runtimeNode.transform.localScale    = Vector3.one;
                runtimeNode.name = "Extra thing????";

                runtimeNode.GetComponent <Image>().color = Color.green;
                runtimeNode.gameObject.SetActive(true);
                nodes.Add(runtimeNode);
            }
        }
    }
コード例 #6
0
 public DrawingObject(ROOTNET.Interface.NTGraph g)
 {
     _g = g;
 }
コード例 #7
0
 public GraphContext(NTGraph g)
 {
     _g = new NTGraph[] { g };
 }