Esempio n. 1
0
    public void GroupNodes()
    {
        RuntimeGraph runtimeGraph = GetComponentInParent <RuntimeGraph>();

        runtimeGraph.GroupSelected();
        runtimeGraph.Refresh();
        Close();
    }
Esempio n. 2
0
    private void CreateGetNode()
    {
        if (!rg)
        {
            return;
        }

        NTScrollRect ntScrollRect = rg.GetComponentInChildren <NTScrollRect>();

        if (ntScrollRect == null)
        {
            return;
        }

        Vector2 nodePosition = Vector2.zero;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(
            (RectTransform)ntScrollRect.content.transform,
            Input.mousePosition, GetComponentInParent <Canvas>().worldCamera, out nodePosition
            );

        nodePosition = new Vector2(nodePosition.x - 80, -nodePosition.y);

        Node node = rg.graph.AddNode(typeof(GetNTVariableNode));

        node.position = nodePosition;
        node.name     = "GET - (" + SessionManager.Instance.selectedSceneObject.name + ")";

        if (propertyType == PropertyType.SceneReference)
        {
            ((GetNTVariableNode)node).SetVariableKey(SessionManager.Instance.selectedSceneObject.data.id, typeof(string), path, typeof(SceneGameObject));
        }
        else
        {
            ((GetNTVariableNode)node).SetVariableKey(SessionManager.Instance.selectedSceneObject.data.id, typeof(string), path, data.GetType());
        }

        rg.Refresh();
    }
Esempio n. 3
0
    public void DuplicateNode()
    {
        RuntimeGraph      runtimeGraph = GetComponentInParent <RuntimeGraph>();
        List <XNode.Node> newNodes     = new List <XNode.Node>();

        if (runtimeGraph.selectedNodes.Count > 0)
        {
            for (int i = 0; i < runtimeGraph.selectedNodes.Count; i++)
            {
                IUGUINode  n       = runtimeGraph.selectedNodes[i];
                XNode.Node newNode = n.DuplicateNode();
                newNodes.Add(newNode);
            }
        }
        else
        {
            if (selected is IUGUINode n)
            {
                XNode.Node newNode = n.DuplicateNode();
                newNodes.Add(newNode);
            }
        }

        /*
         * // Set new nodes as selected
         * List<IUGUINode> newSelected = new List<IUGUINode>();
         * runtimeGraph.Refresh();
         *
         * foreach (XNode.Node n in newNodes)
         * {
         *  IUGUINode nodeRuntime = runtimeGraph.GetRuntimeNode(n);
         *  newSelected.Add(nodeRuntime);
         * }
         * // TODO: No actualiza a nivel visual los colores de los seleccionados
         * runtimeGraph.selectedNodes = newSelected;
         */
        runtimeGraph.selectedNodes.Clear();

        runtimeGraph.Refresh();
        Close();
    }
Esempio n. 4
0
    public void RemoveNode()
    {
        RuntimeGraph runtimeGraph = GetComponentInParent <RuntimeGraph>();

        if (runtimeGraph.selectedNodes.Count > 0)
        {
            for (int i = runtimeGraph.selectedNodes.Count - 1; i >= 0; i--)
            {
                IUGUINode n = runtimeGraph.selectedNodes[i];
                n.RemoveNode();
            }

            runtimeGraph.selectedNodes = new List <IUGUINode>();
        }
        else
        {
            selected.Remove();
        }

        runtimeGraph.Refresh();
        Close();
    }