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; }
public void Draw(Rect rect) { if (GUIUtils.DrawButton(rect, content, filter.isActive ? GUIUtils.grayerColor : GUIUtils.darkerGrayColor, style)) { filter.isActive = !filter.isActive; } }
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; }