Esempio n. 1
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);
    }