Ejemplo n.º 1
0
    // 返回值是最后一个窗口的深度值,ignoreInactive表示是否忽略未启用的节点
    protected int setUIChildDepth(txUIObject ui, int uiDepth, bool includeSelf = true, bool ignoreInactive = false)
    {
        // NGUI不需要重新设置所有节点的深度
        if (mIsNGUI)
        {
            return(0);
        }
        // 先设置当前窗口的深度
        if (includeSelf)
        {
            ui.setDepth(uiDepth);
        }
        // 再设置子窗口的深度
        int endDepth = ui.getDepth();

        if (ignoreInactive && !ui.isActive())
        {
            return(endDepth);
        }
        Transform transform  = ui.getTransform();
        int       childCount = transform.childCount;

        for (int i = 0; i < childCount; ++i)
        {
            txUIObject uiObj = getUIObject(transform.GetChild(i).gameObject);
            if (uiObj != null)
            {
                endDepth = setUIChildDepth(uiObj, endDepth + 1);
            }
        }
        return(endDepth);
    }
Ejemplo n.º 2
0
    // 返回值是最后一个窗口的深度值,ignoreInactive表示是否忽略未启用的节点
    protected int setUIChildDepth(txUIObject window, int uiDepth, bool includeSelf = true, bool ignoreInactive = false)
    {
        // NGUI不需要重新设置所有节点的深度
        if (mIsNGUI)
        {
            return(0);
        }
        // 先设置当前窗口的深度
        if (includeSelf)
        {
            window.setDepth(uiDepth);
        }
        // 再设置子窗口的深度
        int endDepth = window.getDepth();

        if (ignoreInactive && !window.isActive())
        {
            return(endDepth);
        }
        var children   = window.getChildList();
        int childCount = children.Count;

        for (int i = 0; i < childCount; ++i)
        {
            endDepth = setUIChildDepth(children[i], endDepth + 1, true, ignoreInactive);
        }
        return(endDepth);
    }