Пример #1
0
        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);
            }
        }
Пример #2
0
 public void MarkAsDirty()
 {
     for (int x = 0; x < m_Entries.Count; x++)
     {
         ChainLabelEntry entry = m_Entries[x];
         entry.IsDirty = true;
     }
 }
Пример #3
0
        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;
            }
        }
Пример #4
0
 public void AddEntry(ChainLabelEntry entry)
 {
     m_Entries.Add(entry);
 }
Пример #5
0
        public void Render(Rect rect, ChainLabelEntry prev)
        {
            TryUpdateSize(rect, prev);

            GUI.Label(Rect, Content, Style);
        }