private void TryUpdateSize(Rect rect, ChainLabelEntry prev) { if (!IsDirty) { return; } IsDirty = false; Vector2 size = Style.CalcSize(Content); int spaces = CountSpaces(Content.text); if (spaces > 0) { size.Set(size.x + spaces * m_SpaceSize, size.y); } if (prev != null) { Rect = new Rect(prev.Rect.x + prev.Rect.width, prev.Rect.y, size.x, size.y); } else { Rect = new Rect(rect.x, rect.y, size.x, size.y); } }
public void MarkAsDirty() { for (int x = 0; x < m_Entries.Count; x++) { ChainLabelEntry entry = m_Entries[x]; entry.IsDirty = true; } }
public void Draw(Rect rect) { ChainLabelEntry prev = null; for (int x = 0; x < m_Entries.Count; x++) { ChainLabelEntry entry = m_Entries[x]; entry.Render(rect, prev); prev = entry; } }
public void AddEntry(ChainLabelEntry entry) { m_Entries.Add(entry); }
public void Render(Rect rect, ChainLabelEntry prev) { TryUpdateSize(rect, prev); GUI.Label(Rect, Content, Style); }