Пример #1
0
    // Token: 0x06004A59 RID: 19033 RVA: 0x0011EF0C File Offset: 0x0011D10C
    public static global::AABBox CalculateAbsoluteWidgetBounds(Transform trans)
    {
        global::AABBox result;

        using (global::NGUIMath.WidgetList widgetsInChildren = global::NGUIMath.GetWidgetsInChildren(trans))
        {
            if (widgetsInChildren.empty)
            {
                result = default(global::AABBox);
            }
            else
            {
                global::AABBox aabbox = default(global::AABBox);
                bool           flag   = true;
                foreach (global::UIWidget uiwidget in widgetsInChildren)
                {
                    Vector2 vector;
                    Vector2 vector2;
                    uiwidget.GetPivotOffsetAndRelativeSize(out vector, out vector2);
                    Vector3 vector3;
                    vector3.x = (vector.x + 0.5f) * vector2.x;
                    vector3.y = (vector.y - 0.5f) * vector2.y;
                    Vector3 vector4;
                    vector4.x  = vector3.x + vector2.x * 0.5f;
                    vector4.y  = vector3.y + vector2.y * 0.5f;
                    vector3.x -= vector2.x * 0.5f;
                    vector3.y -= vector2.y * 0.5f;
                    vector3.z  = 0f;
                    vector4.z  = 0f;
                    global::AABBox aabbox2            = new global::AABBox(ref vector3, ref vector4);
                    Matrix4x4      localToWorldMatrix = uiwidget.cachedTransform.localToWorldMatrix;
                    global::AABBox aabbox3;
                    aabbox2.TransformedAABB3x4(ref localToWorldMatrix, out aabbox3);
                    if (flag)
                    {
                        aabbox = aabbox3;
                        flag   = false;
                    }
                    else
                    {
                        aabbox.Encapsulate(ref aabbox3);
                    }
                }
                if (flag)
                {
                    result = new global::AABBox(trans.position);
                }
                else
                {
                    result = aabbox;
                }
            }
        }
        return(result);
    }