Beispiel #1
0
        public void Draw()
        {
            if (!_isVisible)
            {
                return;
            }

            _Styles.Init();
            _area = _process.relativeArea.SetWidth(_IcoSize * 6 + _IcosDistance * 5 + _HPadding * 2)
                    .SetHeight(_HeaderHeight + _IcoSize + _VPadding * 2);
            _area   = _area.SetX(_process.relativeArea.xMax - _area.width - _Margin).Shift(0, _Margin, 0, 0);
            _area.x = (int)_area.x;
            _area.y = (int)_area.y;

            // Background
            DeGUI.DrawColoredSquare(_area, Color.black);
            using (new DeGUI.ColorScope(DeGUI.colors.global.blue)) GUI.Box(_area.Expand(1), "", DeGUI.styles.box.outline01);

            // Header
            Rect headerR = _area.SetHeight(_HeaderHeight);

            GUI.Label(headerR, string.Format("{0} nodes selected", _process.selection.selectedNodes.Count), _Styles.headerLabel);

            // Align buttons
            for (int i = 0; i < 6; ++i)
            {
                Rect icoR = new Rect(_area.x + _HPadding + (_IcoSize + _IcosDistance) * i, _area.y + _VPadding + _HeaderHeight, _IcoSize, _IcoSize);
                if (GUI.Button(icoR, IndexToIcon(i), _Styles.btIco) && Event.current.button == 0)
                {
                    AlignSelectedNodes(IndexToGroupAlignment(i));
                }
            }
        }
Beispiel #2
0
        void DrawRuntimeSourceBar(Color color, float percentage, float?markerPercentage = null, float?truePercentage = null, Color?trueColor = null)
        {
            int  totLines = Mathf.Max(1, Mathf.CeilToInt(percentage)); // Volume can go beyond 1, so add more lines
            Rect lineRect = GUILayoutUtility.GetRect(0, 2 * totLines + totLines - 1, GUILayout.ExpandWidth(true));

            lineRect.x     += 15;
            lineRect.y     -= 1;
            lineRect.width -= 15;
            Color guiOrColor = GUI.color;

            for (int i = 0; i < totLines; ++i)
            {
                Rect  r = new Rect(lineRect.x, lineRect.y + (2 * i + i), lineRect.width, 2);
                float p = percentage <= 1 ? percentage
                    : i < totLines - 1 ? 1 : percentage % 1;
                GUI.color = Color.black;
                GUI.Box(r, "", DeGUI.styles.box.flat);
                if (p <= 0)
                {
                    continue;
                }
                r.width  *= p;
                GUI.color = color;
                GUI.Box(r, "", DeGUI.styles.box.flat);
                if (i == 0 && truePercentage != null)
                {
                    // True bar
                    float truePerc = (float)truePercentage;
                    p         = lineRect.width * truePerc;
                    r         = new Rect(lineRect.x, lineRect.y, p, 2);
                    GUI.color = trueColor == null ? Color.green : (Color)trueColor;
                    GUI.Box(r, "", DeGUI.styles.box.flat);
                    if (!Mathf.Approximately(truePerc, percentage) && truePerc > 0 && truePerc < 1)
                    {
                        // Black divider
                        r = new Rect(lineRect.x + (p < 2 ? 0 : p - 2), r.y, 2, r.height);
                        DeGUI.DrawColoredSquare(r, Color.black);
                    }
                    if (markerPercentage != null)
                    {
                        // Marker
                        p = lineRect.width * (float)markerPercentage;
                        r = new Rect(lineRect.x + (p < 2 ? 0 : p - 2), r.y, 2, r.height);
                        DeGUI.DrawColoredSquare(r, Color.white);
                    }
                }
            }
            GUI.color = guiOrColor;
            GUILayout.Space(2);
        }
Beispiel #3
0
        public static void Draw(NodeProcessDebug debug, Rect processArea)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            const int bgPadding = 6;
            const int dist      = 2;

            _LabelsTxts[0] = "<b><color=#ff0000>NodeProcess DEBUG</color></b>";
            _LabelsTxts[1] = string.Format(
                "<b>Panning Avrg <color=#4290f5>FPS</color> (Layout/Repaint/Layout+Repaint):</b> <color=#ffd845>{0:N2}</color> / <color=#ffd845>{1:N2}</color> / <color=#ffd845>{2:N2}</color>",
                debug.panningData.avrgFps_Layout,
                debug.panningData.avrgFps_Repaint,
                debug.panningData.avrgFps_LayoutAndRepaint
                );
            _LabelsTxts[2] = string.Format(
                "<b>Panning Avrg <color=#4290f5>MS</color> (Layout/Repaint/Layout+Repaint):</b> <color=#ffd845>{0:N2}</color> / <color=#ffd845>{1:N2}</color> / <color=#ffd845>{2:N2}</color>",
                debug.panningData.avrgDrawTime_Layout,
                debug.panningData.avrgDrawTime_Repaint,
                debug.panningData.avrgDrawTime_LayoutAndRepaint
                );

            Rect bgR = new Rect(processArea.x, processArea.y, 0, bgPadding * 2);

            for (int i = 0; i < _LabelsTxts.Length; ++i)
            {
                Vector2 labelSize = Styles.fpsLabel.CalcSize(new GUIContent(_LabelsTxts[i]));
                _LabelsRects[i] = new Rect(bgR.x + bgPadding, bgR.yMax - bgPadding, labelSize.x, labelSize.y);
                if (bgR.width < labelSize.x + bgPadding * 2)
                {
                    bgR.width = labelSize.x + bgPadding * 2;
                }
                if (i > 0)
                {
                    bgR.height += dist;
                }
                bgR.height += labelSize.y;
            }

            DeGUI.DrawColoredSquare(bgR, new Color(0, 0, 0, 0.8f));
            for (int i = 0; i < _LabelsTxts.Length; ++i)
            {
                GUI.Label(_LabelsRects[i], _LabelsTxts[i], Styles.fpsLabel);
            }
        }