Exemplo n.º 1
0
        void DrawOnlyVisibleEntries(Rect rect, Vector2 scrollPosition)
        {
            OnBeginDraw();
            largestEntry = 0;

            int size = this.size;

            for (int i = 0; i < size; i++)
            {
                float positionY = entryHeight * i;
                bool  isVisible = positionY + entryHeight > scrollPosition.y && positionY < scrollPosition.y + rect.height;
                if (!isVisible)
                {
                    continue;
                }

                largestEntry = Mathf.Max(GetEntryWidth(entries[i]), largestEntry);
                Rect entryRect = new Rect(0, positionY, Mathf.Max(largestEntry, rect.width) + padding, entryHeight);
                if (GUIUtils.DrawButton(entryRect, GUIContent.none, currentIndex == i ? DevConsole.settings.secondaryColor : entriesColor))
                {
                    NavigateTo(i);
                    OnEntryClicked(entries[i]);
                }
                entryRect.x = padding;
                DrawEntry(entryRect, entries[i]);
            }
            largestEntry += padding;
        }
Exemplo n.º 2
0
 public void Draw(Rect rect)
 {
     if (GUIUtils.DrawButton(rect, content, filter.isActive ? GUIUtils.grayerColor : GUIUtils.darkerGrayColor, style))
     {
         filter.isActive = !filter.isActive;
     }
 }
Exemplo n.º 3
0
        void DrawTitle()
        {
            float width  = rect.width;
            float height = rect.height;

            rect.height = titleHeight;
            GUI.Label(rect, titleContent, GUIUtils.centeredTextStyle);
            rect.width = titleHeight;
            rect.x     = width - rect.width;
            if (GUIUtils.DrawButton(rect, closeButtonContent, Color.clear))
            {
                Close();
            }
            rect.x      = 0;
            rect.width  = width;
            rect.height = height;
        }