Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 public void MarkAsDirty()
 {
     for (int x = 0; x < m_Entries.Count; x++)
     {
         ChainLabelEntry entry = m_Entries[x];
         entry.IsDirty = true;
     }
 }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 4
0
 public void AddEntry(ChainLabelEntry entry)
 {
     m_Entries.Add(entry);
 }
Ejemplo n.º 5
0
        public void Render(Rect rect, ChainLabelEntry prev)
        {
            TryUpdateSize(rect, prev);

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