Exemple #1
0
        private void DrawActualWindow(CatGraph.Node node, Vector2 position)
        {
            GUIStyle style = node.ChooseStyle();

            node.SetPosition(position);
            GUI.Window(node.ID, node.Size, WindowFunction, string.Empty, style);
        }
Exemple #2
0
 private void EndConnection()
 {
     CatGraph.Node startNode = _selectedNode;
     CheckNodeSelection();
     if (_selectedNode != null && _selectedNode.Action != null && _selectedNode.Action == startNode.Action)
     {
         Undo.RecordObject(_catGraph, "Establish Connection");
         startNode.SetTransition(_selectedNode);
     }
     _isConnecting = false;
 }
Exemple #3
0
 private void CheckNodeSelection()
 {
     _selectedNode = null;
     foreach (CatGraph.Node node in _catGraph.Nodes)
     {
         if (node.Size.Contains(_mousePosition))
         {
             _selectedNode = node;
             break;
         }
     }
 }
Exemple #4
0
        private void WindowFunction(int id)
        {
            CatGraph.Node node = _catGraph.GetNode(id);
            if (node == null)
            {
                return;
            }
            float height   = 15f;
            float distance = height + 2f;
            float width    = node.Size.width;

            GUI.Label(new Rect(10, 2f, width, height), "Reaction description");
            node.Text = GUI.TextArea(new Rect(5, distance, width - 10, node.Size.height - 4 * distance), node.Text);
            GUI.Label(new Rect(10, node.Size.height - 3 * distance, width, height), "Method name");
            node.MethodName = GUI.TextArea(new Rect(5, node.Size.height - 2 * distance, width - 10, height), node.MethodName);
            GUI.Label(new Rect(width / 2 - 5, node.Size.height - height, width / 2, height), "o");
        }