예제 #1
0
 public Point(NodeWindow masterNode, Point.Type type, GUIStyle style, Action <Connection.Point> onClick)
 {
     this.masterNode             = masterNode;
     this.type                   = type;
     this.style                  = style;
     this.onClickConnectionPoint = onClick;
     rect = new Rect(0, 0, 20f, 20f);
 }
예제 #2
0
        public void Draw()
        {
            Vector2 i = inPoint.rect.center;
            Vector2 o = outPoint.rect.center;

            inTangent  = Vector2.left * 80f;
            outTangent = Vector2.right * 80f;

            if (i.x <= o.x)
            {
                if (i.y < o.y)
                {
                    inTangent  += Vector2.up * 200f;
                    outTangent += Vector2.up * 200f;
                }
                else
                {
                    inTangent  += Vector2.down * 200f;
                    outTangent += Vector2.down * 200f;
                }
            }

            Handles.DrawBezier(
                inPoint.rect.center,
                outPoint.rect.center,
                inPoint.rect.center + inTangent,
                outPoint.rect.center + outTangent,
                Color.white,
                null,
                2f
                );


            for (int j = 0; j < conditions.Count; j++)
            {
                NodeWindow evt       = conditions[j];
                float      condWidth = GUI.skin.label.CalcSize(new GUIContent(evt.nodeName)).x + 10f;
                Vector2    condPos   = (i + o + inTangent + outTangent - new Vector2(condWidth, condHeight)) * 0.5f;
                GUI.Label(new Rect(condPos.x, condPos.y + 30f + j * (condHeight + 2f), condWidth, condHeight), new GUIContent(evt.nodeName), (GUIStyle)"AssetLabel");
            }

            Vector2 wh = new Vector2(btnWidth, btnHeight);

            connRect = new Rect((i + o + inTangent + outTangent - wh * 0.5f) * 0.5f, wh);
            if (onClickRemoveConnection != null && getEvents != null)
            {
                GUI.Box(connRect, new GUIContent(), (GUIStyle)"flow var 4");
            }

            if (stopPrev)
            {
                GUI.Box(new Rect(connRect.x, connRect.y - 20f, 200f, connRect.height), new GUIContent("Stop"), (GUIStyle)"OL Minus");
            }
        }
예제 #3
0
 public GroupPoint(NodeWindow groupNode, Type type, GUIStyle style, Action <Point> onClick) : base(null, type, style, onClick)
 {
     this.groupNode = groupNode;
 }