public void Draw(MenuDesign menu)
        {
            if (!(menu.nodes.Count > nodeIn) || !(menu.nodes.Count > nodeOut) || !(menu.nodes [nodeOut].outPoint.Count > buttonOut))
            {
                NodeEditor.RemoveConnection(this);
                return;
            }
            Rect rectIn  = menu.nodes [nodeIn].inPoint.rect;
            Rect rectOut = menu.nodes [nodeOut].outPoint [buttonOut].rect;

            DrawShadow(rectIn, rectOut);
            Handles.DrawBezier(
                rectIn.center,
                rectOut.center,
                rectIn.center + Vector2.left * 50f,
                rectOut.center - Vector2.left * 50f,
                NodeEditor.lineColor,
                null,
                NodeEditor.lineWidht
                );

            Vector3 btnPos  = (rectIn.center + rectOut.center) * 0.5f;
            float   btnSize = 24f;

            if (GUI.Button(new Rect(btnPos.x - (btnSize * 0.5f), btnPos.y - (btnSize * 0.5f), btnSize, btnSize), "╳", style))
            {
                NodeEditor.RemoveConnection(this);
            }
        }
示例#2
0
        public void Draw(MenuDesign menu, GUISkin skin)
        {
            if (buttonOut == null || menuOrigin == null || menuTarget == null)
            {
                NodeEditor.RemoveConnection(this);
                return;
            }
            Rect rectIn  = menuTarget.inPoint.rect;
            Rect rectOut = buttonOut.rect;

            DrawShadow(rectIn, rectOut);
            Handles.DrawBezier(
                rectIn.center,
                rectOut.center,
                rectIn.center + Vector2.left * 50f,
                rectOut.center - Vector2.left * 50f,
                NodeEditor.lineColor,
                null,
                NodeEditor.lineWidht
                );

            Vector3 btnPos  = (rectIn.center + rectOut.center) * 0.5f;
            float   btnSize = 24f;

            if (GUI.Button(new Rect(btnPos.x - (btnSize * 0.5f), btnPos.y - (btnSize * 0.5f), btnSize, btnSize), "╳", skin.button))
            {
                NodeEditor.RemoveConnection(this);
            }
        }
 public override void OnInspectorGUI()
 {
     m = (MenuDesign)target;
     base.OnInspectorGUI();
     if (GUILayout.Button("Open Editor"))
     {
         NodeEditor.OpenWindow(m);
     }
 }
示例#4
0
        public static void OpenWindow(MenuDesign m)
        {
            NodeEditor window = GetWindow <NodeEditor>();

            window.menudesign   = m;
            window.titleContent = new GUIContent(m.name);
            window.OnEnable();
            if (singleton)
            {
                singleton.OnDrag(-singleton.offset);
                singleton.offset = singleton.drag = Vector2.zero;
            }
        }