Exemplo n.º 1
0
 public override void Clear()
 {
     while (m_Stack.Count > 0)
     {
         LW_Utilities.SafeDestroy(m_Stack.Pop());
     }
     base.Clear();
 }
Exemplo n.º 2
0
 protected override void OnDestroy()
 {
                 #if UNITY_EDITOR
     if (m_Styles != null)
     {
         m_Styles = LW_Utilities.SafeDestroy <LW_Styles>(m_Styles);
     }
                 #endif
     base.OnDestroy();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Removes the provided element from the collection.
 /// </summary>
 /// <param name="element"></param>
 public bool Remove(LW_Graphic item)
 {
     if (m_GraphicsList != null && m_GraphicsList.Contains(item))
     {
         item.UnregisterCallbacks(OnChildSetElementDirty);
         bool result = m_GraphicsList.Remove(item);
         LW_Utilities.SafeDestroy <LW_Graphic>(item);
         SetElementDirty();
         return(result);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 4
0
 protected override void OnDestroy()
 {
                 #if UNITY_EDITOR
     if (m_StylesList != null)
     {
         for (int i = 0; i < m_StylesList.Count; i++)
         {
             if (m_StylesList[i] != null)
             {
                 LW_Utilities.SafeDestroy(m_StylesList[i]);
             }
         }
     }
                 #endif
     base.OnDestroy();
 }
Exemplo n.º 5
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            if (element is LW_Group)
            {
                LW_Group group = element as LW_Group;

                bool groupMatches = m_GraphicsList != null && group.m_GraphicsList != null && m_GraphicsList.Count == group.m_GraphicsList.Count;
                if (groupMatches)
                {
                    for (int i = 0; i < m_GraphicsList.Count; i++)
                    {
                        if (m_GraphicsList[i].GetType() != group.m_GraphicsList[i].GetType() || m_GraphicsList[i] == group.m_GraphicsList[i])
                        {
                            groupMatches = false;
                            break;
                        }
                    }
                }
                if (groupMatches)
                {
                    for (int i = 0; i < m_GraphicsList.Count; i++)
                    {
                        m_GraphicsList[i].CopyPropertiesFrom(group.m_GraphicsList[i]);
                    }
                }
                else
                {
                    if (m_GraphicsList != null)
                    {
                        for (int i = 0; i < m_GraphicsList.Count; i++)
                        {
                            if (m_GraphicsList[i] != null)
                            {
                                LW_Utilities.SafeDestroy(m_GraphicsList[i]);
                            }
                        }
                        m_GraphicsList = null;
                    }
                    if (group.m_GraphicsList != null)
                    {
                        if (m_GraphicsList == null)
                        {
                            m_GraphicsList = new List <LW_Graphic>(group.m_GraphicsList.Count);
                        }
                        else if (m_GraphicsList.Capacity < group.m_GraphicsList.Count)
                        {
                            m_GraphicsList.Capacity = group.m_GraphicsList.Count;
                        }

                        for (int i = 0; i < group.m_GraphicsList.Count; i++)
                        {
                            if (group.m_GraphicsList[i] != null)
                            {
                                LW_Graphic copiedElement = group.m_GraphicsList[i].Copy() as LW_Graphic;
                                m_GraphicsList.Add(copiedElement);
                            }
                        }
                    }
                }
            }
            base.CopyPropertiesFrom(element);
        }
Exemplo n.º 6
0
        internal override void CopyPropertiesFrom(LW_Element element)
        {
            if (element is LW_Styles)
            {
                LW_Styles styles = element as LW_Styles;

                bool stylesMatch = m_StylesList != null && styles.m_StylesList != null && m_StylesList.Count == styles.m_StylesList.Count;
                if (stylesMatch)
                {
                    for (int i = 0; i < m_StylesList.Count; i++)
                    {
                        if (m_StylesList[i].GetType() != styles.m_StylesList[i].GetType() || m_StylesList[i] == styles.m_StylesList[i])
                        {
                            stylesMatch = false;
                            break;
                        }
                    }
                }
                if (stylesMatch)
                {
                    for (int i = 0; i < m_StylesList.Count; i++)
                    {
                        m_StylesList[i].CopyPropertiesFrom(styles.m_StylesList[i]);
                    }
                }
                else
                {
                    if (m_StylesList != null)
                    {
                        for (int i = 0; i < m_StylesList.Count; i++)
                        {
                            if (m_StylesList[i] != null)
                            {
                                LW_Utilities.SafeDestroy(m_StylesList[i]);
                            }
                        }
                        m_StylesList.Clear();
                    }
                    if (styles.m_StylesList != null)
                    {
                        if (m_StylesList == null)
                        {
                            m_StylesList = new List <LW_Style>(styles.m_StylesList.Count);
                        }
                        else if (m_StylesList.Capacity < styles.m_StylesList.Count)
                        {
                            m_StylesList.Capacity = styles.m_StylesList.Count;
                        }

                        for (int i = 0; i < styles.m_StylesList.Count; i++)
                        {
                            if (styles.m_StylesList[i] != null)
                            {
                                LW_Style copiedElement = styles.m_StylesList[i].Copy() as LW_Style;
                                m_StylesList.Add(copiedElement);
                            }
                        }
                    }
                }
            }
            base.CopyPropertiesFrom(element);
        }