Esempio n. 1
0
 public static void DrawLineCanvasSpace(CanvasTransform t, Vector2 start, Vector2 end, Color color, float width)
 {
     start = t.CanvasToScreenSpace(start);
     end   = t.CanvasToScreenSpace(end);
     if (t.IsScreenAxisLineInView(start, end))
     {
         DrawLineScreenSpace(start, end, color, width);
     }
 }
Esempio n. 2
0
        public static void DrawNode(
            CanvasTransform t,
            BonsaiNode node,
            Color statusColor)
        {
            // Convert the node rect from canvas to screen space.
            Rect screenRect = node.RectPositon;

            screenRect.position = t.CanvasToScreenSpace(screenRect.position);

            // Remember the original color that way it is reset when the function exits.
            Color originalColor = GUI.color;

            DrawNodeBackground(screenRect, statusColor);

            // The node contents are grouped together within the node body.
            GUI.BeginGroup(screenRect);

            // Make the body of node local to the group coordinate space.
            Rect localRect = node.RectPositon;

            localRect.position = Vector2.zero;

            // Draw the contents inside the node body, automatically laid out.
            GUILayout.BeginArea(localRect, GUIStyle.none);

            DrawNodeTypeBackground(node);
            DrawExitStatus(node);
            DrawNodeContent(node);
            DrawBreakpoint(node);
            DrawPreOrderIndex(node);

            GUILayout.EndArea();

            GUI.EndGroup();
            GUI.color = originalColor;
        }
Esempio n. 3
0
 public static void DrawLineCanvasSpace(CanvasTransform t, Vector2 start, Vector2 end, Color color)
 {
     start = t.CanvasToScreenSpace(start);
     end   = t.CanvasToScreenSpace(end);
     DrawLineScreenSpace(start, end, color);
 }
Esempio n. 4
0
 public static void DrawPort(CanvasTransform t, Rect portRect)
 {
     // Convert the body rect from canvas to screen space.
     portRect.position = t.CanvasToScreenSpace(portRect.position);
     GUI.DrawTexture(portRect, BonsaiPreferences.Instance.portTexture, ScaleMode.StretchToFill);
 }