예제 #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);
        }