Ejemplo n.º 1
0
    void CollectContainers()
    {
        for (int i = m_Containers.Count - 1; i >= 0; i--)
        {
            ElementContainer container = m_Containers[i];

            if (container == null || container.transform.parent != transform || container.IsDestroying() || container.IsDestroyed())
            {
                m_Containers.RemoveAt(i);
            }
        }

        HashSet <ElementContainer> containers = new HashSet <ElementContainer>(m_Containers);

        int axis;

        switch (m_Direction)
        {
        case Direction.Horizontal:
            axis = 0;
            break;

        case Direction.Vertical:
            axis = 1;
            break;

        default:
            return;
        }

        for (int i = 0; i < transform.childCount; i++)
        {
            ElementContainer container = transform.GetChild(i).GetComponent <ElementContainer>();;

            if (container == null || container.IsDestroying() || container.IsDestroyed())
            {
                continue;
            }

            container.Setup(this, axis);

            if (containers.Contains(container))
            {
                continue;
            }

            m_Containers.Add(container);
        }
    }