Ejemplo n.º 1
0
    // llm 2018-1-16 使用指定控件进行Bounds计算
    Bounds CalculateBounds(Transform trans, bool considerInactive)
    {
        if (useUITag)
        {
            UIRepositionTag tag = trans.GetComponentInChildren <UIRepositionTag>();
            if (tag != null)
            {
                return(NGUIMath.CalculateRelativeWidgetBounds(tag.transform, tag.transform, considerInactive, false));
            }
        }

        return(NGUIMath.CalculateRelativeWidgetBounds(trans, considerInactive));
    }
Ejemplo n.º 2
0
    // llm 2018-1-16 使用指定控件进行Bounds计算
    Bounds CalculateAllBounds(Transform trans)
    {
        if (useUITag)
        {
            // llm 使用指定的 UI进行 Bounds 计算
            UIRepositionTag[] tags = trans.GetComponentsInChildren <UIRepositionTag>(true);
            Bounds            r    = new Bounds();
            r.min = Vector3.one * float.MaxValue;
            r.max = Vector3.one * float.MinValue;
            for (int i = 0, max = tags.Length; i < max; ++i)
            {
                UIRepositionTag tag = tags[i];
                Bounds          b   = NGUIMath.CalculateRelativeWidgetBounds(trans, tag.transform, false, false);
                r.Encapsulate(b);
            }

            return(r);
        }

        return(NGUIMath.CalculateRelativeWidgetBounds(trans));
    }