Esempio n. 1
0
    public static void DrawTitleRect(Rect rect, string title, string content, Color color, Color bg, float width)
    {
        GLDraw.DrawFillBox(rect, color, bg, width);
        int top   = 20;
        var lRect = new Rect(rect.x, rect.y + 2, rect.width, top);

        GLDraw.DrawLine(
            new Vector2(rect.x, lRect.yMax),
            new Vector2(rect.x + rect.width, lRect.yMax),
            color, 1);
        GUI.Label(lRect, title);
        var bRect = new Rect(rect.x, rect.y + top + 2, rect.width, rect.height - top);

        GUI.Label(bRect, content);
    }
Esempio n. 2
0
    private void OnDrawGUI()
    {
        if (root == null)
        {
            if (Event.current.type == EventType.ContextClick)
            {
                GenericMenu m = new GenericMenu();
                m.AddItem(new GUIContent("Open Tree"), false, OpenTree);
                m.AddSeparator("");
                ProcessMenu(m, null);
                m.ShowAsContext();
            }
            if (!string.IsNullOrEmpty(currenPath))
            {
                OpenTree(currenPath);
            }
        }
        else
        {
            runstate = null;
            //runNodeName = string.Empty;
            var rect = new Rect(0, 0, position.width, position.height);
            //scroll = GUI.BeginScrollView(rect, scroll, new Rect(0, 0, lastoffset.x, lastoffset.y));
            Vector2   mine;
            RunStatus?runState;
            var       runing = CheckRunning(root.guid, out runState);
            //GUI.BeginClip (rect);
            lastoffset = DrawRoot(root, new Vector2(offsetx, offsety), runing, runState, out mine);
            //GUI.EndClip ();
            //lastoffset.x;

            if (currentDrag != null)
            {
                var p     = Event.current.mousePosition;
                var prect = new Rect(p.x, p.y, width, height);
                DrawNode(prect, currentDrag, new StateOfEditor(), false, false, null);
            }



            if (Event.current.type == EventType.mouseUp)
            {
                if (currentDrag != null)
                {
                    currentDrag     = null;
                    currentShowDrag = null;
                }
            }

            if (Event.current.type == EventType.MouseDrag)
            {
                currentShowDrag = null;
            }

            if (currentShowDrag.HasValue)
            {
                GLDraw.DrawFillBox(currentShowDrag.Value, Color.black, Color.green, 1);
            }
            //GUI.EndScrollView();
        }
    }