public override void Draw() { base.Draw(); // Draw text int count = 0; float y = 4; if (textRows.Count > 0 && timer < 0) { y += (textRows.First.Value.TextHeight + textSpacing) * timer / popDelay; } int maxCount = (textRows.Count > maxRows) ? maxRows : textRows.Count; IEnumerator enumerator = textRows.GetEnumerator(); while (enumerator.MoveNext()) { TextLabel label = enumerator.Current as TextLabel; if (label != null) { label.Position = new Vector2(0, y); label.Draw(); y += label.TextHeight + textSpacing; } if (++count > maxCount) { break; } } }
public override void Draw() { base.Draw(); float x = 0, y = 0; for (int i = 0; i < listItems.Count; i++) { if (i < scrollIndex || i >= scrollIndex + rowsDisplayed) { continue; } TextLabel label = listItems[i]; if (i == selectedIndex) { label.TextColor = selectedTextColor; label.ShadowPosition = selectedShadowPosition; label.ShadowColor = selectedShadowColor; } else { label.TextColor = textColor; label.ShadowPosition = shadowPosition; label.ShadowColor = shadowColor; } label.Position = new Vector2(x, y); label.HorizontalAlignment = rowAlignment; label.Draw(); y += label.Font.GlyphHeight + rowSpacing; } }
public override void Draw() { base.Draw(); // Exit if textures not set if (checkTextureSize == Vector2.zero || uncheckedTexture == null || checkedTexture == null) { return; } // Calculate rect and align checkbox or text to tallest element Rect rect = Rectangle; float checkHeight = checkTextureSize.y; float textHeight = label.Size.y; float textOffset = 0; if (checkHeight > textHeight) { textOffset = (checkHeight - textHeight) / 2; } else { rect.y += ((Size.y - checkTextureSize.y) / 2f) * LocalScale.y; } rect.width = checkTextureSize.x * LocalScale.x; rect.height = checkTextureSize.y * LocalScale.y; // Draw checkbox in current state Color guiColor = GUI.color; GUI.color = checkboxColor; if (!isChecked) { GUI.DrawTexture(rect, uncheckedTexture); } else { GUI.DrawTexture(rect, checkedTexture); } // Restore previous color GUI.color = guiColor; // Draw label label.Position = new Vector2(checkTextureSize.x + checkTextHorzOffset, textOffset + checkTextVertOffset); label.Draw(); }
public override void Draw() { base.Draw(); if (totalUnits <= displayUnits) { return; } DrawSlider(); if (indicator != null) { indicator.Draw(); } }
public override void Draw() { base.Draw(); if (verticalScrollMode == VerticalScrollModes.EntryWise) { float x = 0, y = 0; float currentLine = 0; for (int i = 0; i < listItems.Count; i++) { TextLabel label = listItems[i].textLabel; if (currentLine < scrollIndex || currentLine >= scrollIndex + rowsDisplayed) { currentLine += label.NumTextLines; continue; } currentLine += label.NumTextLines; label.StartCharacterIndex = horizontalScrollIndex; label.UpdateLabelTexture(); if (i == selectedIndex) { label.TextColor = listItems[i].selectedTextColor; label.ShadowPosition = selectedShadowPosition; label.ShadowColor = listItems[i].selectedShadowColor; } else { label.TextColor = listItems[i].textColor; label.ShadowPosition = shadowPosition; label.ShadowColor = listItems[i].shadowColor; } label.Position = new Vector2(x, y); label.HorizontalAlignment = rowAlignment; label.Draw(); y += label.TextHeight + rowSpacing; } } else if (verticalScrollMode == VerticalScrollModes.PixelWise) { int x = 0; int y = -scrollIndex; for (int i = 0; i < listItems.Count; i++) { TextLabel label = listItems[i].textLabel; if (y + label.TextHeight < 0 || y >= this.Size.y) { y += label.TextHeight + rowSpacing; continue; } if (horizontalScrollMode == HorizontalScrollModes.CharWise) { label.StartCharacterIndex = horizontalScrollIndex; } else if (horizontalScrollMode == HorizontalScrollModes.PixelWise) { x = -horizontalScrollIndex; } label.UpdateLabelTexture(); if (i == selectedIndex) { label.TextColor = listItems[i].selectedTextColor; label.ShadowPosition = selectedShadowPosition; label.ShadowColor = listItems[i].selectedShadowColor; } else { label.TextColor = listItems[i].textColor; label.ShadowPosition = shadowPosition; label.ShadowColor = listItems[i].shadowColor; } label.Position = new Vector2(x, y); label.HorizontalAlignment = rowAlignment; label.Draw(); y += label.TextHeight + rowSpacing; } } }
public override void Draw() { base.Draw(); label.Draw(); }
public override void Draw() { base.Draw(); if (verticalScrollMode == VerticalScrollModes.EntryWise) { float x = 0, y = 0; float currentLine = 0; for (int i = 0; i < listItems.Count; i++) { TextLabel label = listItems[i].textLabel; if (currentLine < scrollIndex || currentLine >= scrollIndex + rowsDisplayed) { currentLine += label.NumTextLines; continue; } currentLine += label.NumTextLines; label.StartCharacterIndex = horizontalScrollIndex; label.RefreshLayout(); DecideTextColor(label, i); label.Position = new Vector2(x, y); label.Draw(); y += label.TextHeight + rowSpacing; } } else if (verticalScrollMode == VerticalScrollModes.PixelWise) { int x = 0; int y = -scrollIndex; for (int i = 0; i < listItems.Count; i++) { TextLabel label = listItems[i].textLabel; if (y + label.TextHeight < 0 || y >= this.Size.y) { y += label.TextHeight + rowSpacing; continue; } if (horizontalScrollMode == HorizontalScrollModes.CharWise) { label.StartCharacterIndex = horizontalScrollIndex; } else if (horizontalScrollMode == HorizontalScrollModes.PixelWise) { x = -horizontalScrollIndex; } label.RefreshLayout(); DecideTextColor(label, i); label.HorzPixelScrollOffset = x; label.Position = new Vector2(x, y); label.Draw(); y += label.TextHeight + rowSpacing; } } }