Exemple #1
0
 public static void Draw(CanvasElement <TNodeData, TRouteData> canvasElement)
 {
     if (canvasElement != null)
     {
         canvasElement.OnDraw();
     }
 }
Exemple #2
0
        public bool OnGUIDetail(Rect viewRect)
        {
            bool hasSelected = (canvas.operation.selection.SelectedCount() > 0);

            if (hasSelected)
            {
                CanvasElement <TNodeData, TRouteData> element = canvas.operation.selection.FirstSelected();
                if (element != null)
                {
                    bool handled = false;
                    if (!handled)
                    {
                        Node <TNodeData, TRouteData> node = element as Node <TNodeData, TRouteData>;
                        if (node != null && node.data != null)
                        {
                            handled = true;
                            GUILayout.BeginArea(viewRect);
                            node.data.OnDetailGUI(new Rect(Vector2.zero, viewRect.size));
                            GUILayout.EndArea();
                        }
                    }
                    if (!handled)
                    {
                        Route <TNodeData, TRouteData> route = element as Route <TNodeData, TRouteData>;
                        if (route != null && route.data != null)
                        {
                            handled = true;
                            GUILayout.BeginArea(viewRect);
                            route.data.OnDetailGUI(new Rect(Vector2.zero, viewRect.size));
                            GUILayout.EndArea();
                        }
                    }

                    if (!handled)
                    {
                        Debug.LogError("invalid element selected");
                    }
                }
            }
            return(hasSelected);
        }
Exemple #3
0
 public static void Remove(CanvasElement <TNodeData, TRouteData> canvasElement)
 {
     canvasElement.OnRemove();
     canvasElement.canvas = null;
 }
Exemple #4
0
 public static void Add(Canvas <TNodeData, TRouteData> canvas, CanvasElement <TNodeData, TRouteData> canvasElement)
 {
     canvasElement.canvas = canvas;
     canvasElement.OnAdd();
 }
Exemple #5
0
 public bool HasSelected(CanvasElement <TNodeData, TRouteData> element)
 {
     return(currentSelected.Contains(element));
 }
Exemple #6
0
 public int Select(CanvasElement <TNodeData, TRouteData> element)
 {
     currentSelected.Clear();
     currentSelected.Add(element);
     return(currentSelected.Count);
 }