Example #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);
    }
Example #2
0
 // Token: 0x06004A6B RID: 19051 RVA: 0x0011F750 File Offset: 0x0011D950
 public static global::NGUIMath.WidgetList Generate()
 {
     if (global::NGUIMath.WidgetList.tempWidgetListsSize == 0)
     {
         return(new global::NGUIMath.WidgetList(false));
     }
     global::NGUIMath.WidgetList widgetList = global::NGUIMath.WidgetList.tempWidgetLists.Dequeue();
     widgetList.disposed = false;
     global::NGUIMath.WidgetList.tempWidgetListsSize--;
     return(widgetList);
 }
Example #3
0
 // Token: 0x06004A5B RID: 19035 RVA: 0x0011F14C File Offset: 0x0011D34C
 private static global::NGUIMath.WidgetList GetWidgetsInChildren(Transform trans)
 {
     if (trans)
     {
         bool flag = false;
         global::NGUIMath.WidgetList result = null;
         global::NGUIMath.FillWidgetListWithChildren(trans, ref result, ref flag);
         if (flag)
         {
             return(result);
         }
     }
     return(global::NGUIMath.WidgetList.Empty);
 }
Example #4
0
    // Token: 0x06004A5A RID: 19034 RVA: 0x0011F0EC File Offset: 0x0011D2EC
    private static void FillWidgetListWithChildren(Transform trans, ref global::NGUIMath.WidgetList list, ref bool madeList)
    {
        global::UIWidget component = trans.GetComponent <global::UIWidget>();

        if (component)
        {
            if (!madeList)
            {
                list     = global::NGUIMath.WidgetList.Generate();
                madeList = true;
            }
            list.Add(component);
        }
        int childCount = trans.childCount;

        while (childCount-- > 0)
        {
            global::NGUIMath.FillWidgetListWithChildren(trans.GetChild(childCount), ref list, ref madeList);
        }
    }