Пример #1
0
    public void Layout()
    {
        Vector3 b      = FlowLayout.GetDirectionVector(this.m_direction) * this.m_gap;
        Vector3 vector = Vector3.zero;

        if (this.m_direction == FlowLayout.Direction.CenterHorizontal)
        {
            int num = 0;
            foreach (GameObject x in this.m_order)
            {
                if (x.activeSelf)
                {
                    num++;
                }
            }
            vector.x = (float)(-(float)(num - 1)) * this.m_gap / 2f;
        }
        else if (this.m_direction == FlowLayout.Direction.CenterVertical)
        {
            int num2 = 0;
            foreach (GameObject x in this.m_order)
            {
                if (x.activeSelf)
                {
                    num2++;
                }
            }
            vector.y = (float)(num2 - 1) * this.m_gap / 2f;
        }
        foreach (GameObject gameObject in this.m_order)
        {
            if (gameObject.activeSelf)
            {
                gameObject.transform.localPosition = vector;
                vector += b;
            }
        }
    }