Esempio n. 1
0
 private void CollectElements()
 {
     m_elementList.Clear();
     m_staticElementList.Clear();
     m_dynamicElementList.Clear();
     for (int i = 0; i < transform.childCount; i++)
     {
         Transform child = rectTransform.GetChild(i);
         if (!child.gameObject.activeInHierarchy)
         {
             continue;
         }
         UILayoutGroupElement element = child.GetComponent <UILayoutGroupElement>();
         if (element == null)
         {
             continue;
         }
         m_elementList.Add(element);
         UILayoutGroupElementStatic staticElement = element as UILayoutGroupElementStatic;
         if (staticElement != null)
         {
             m_staticElementList.Add(staticElement);
         }
         UILayoutGroupElementDynamic dynamicElement = element as UILayoutGroupElementDynamic;
         if (dynamicElement != null)
         {
             m_dynamicElementList.Add(dynamicElement);
         }
     }
 }
Esempio n. 2
0
 public bool ContainsStaticIndex(int index)
 {
     for (int i = 0; i < m_elementList.Count; ++i)
     {
         UILayoutGroupElementStatic staticElement = m_elementList[i] as UILayoutGroupElementStatic;
         if (staticElement != null && staticElement.index == index)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 3
0
 private void RefreshCustomStaticElements()
 {
     for (int i = 0; i < m_staticElementList.Count; ++i)
     {
         UILayoutGroupElementStatic staticElement = m_staticElementList[i];
         if (staticElement.indexType == UILayoutGroupElementStatic.EIndexType.Custom)
         {
             int index = staticElement.index;
             RecordIndex(index);
         }
     }
 }
    public override void OnInspectorGUI()
    {
        UILayoutGroupElementStatic staticElement = target as UILayoutGroupElementStatic;

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_indexType"));
        if (staticElement.indexType == UILayoutGroupElementStatic.EIndexType.Custom)
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_index"));
        }
        if (EditorGUI.EndChangeCheck())
        {
            serializedObject.ApplyModifiedProperties();
            staticElement.SetDirty();
        }
    }
Esempio n. 5
0
    private void RefreshHeadStaticElements(out int indexCursor)
    {
        indexCursor = 0;
        for (int i = 0; i < m_staticElementList.Count; ++i)
        {
            UILayoutGroupElementStatic staticElement = m_staticElementList[i];
            if (staticElement.indexType == UILayoutGroupElementStatic.EIndexType.Head)
            {
                indexCursor = GetUnUsedIndex(indexCursor);
                int index = indexCursor;
                indexCursor++;

                staticElement.index = index;
                RecordIndex(index);
            }
        }
    }
Esempio n. 6
0
    private void RefreshTailStaticElements()
    {
        int indexCursor = m_maxIndex + 1;

        for (int i = 0; i < m_staticElementList.Count; ++i)
        {
            UILayoutGroupElementStatic staticElement = m_staticElementList[i];
            if (staticElement.indexType == UILayoutGroupElementStatic.EIndexType.Tail)
            {
                indexCursor = GetUnUsedIndex(indexCursor);
                int index = indexCursor;
                indexCursor++;

                staticElement.index = indexCursor;
                RecordIndex(index);
            }
        }
    }