static int GetMaxTargetDepth(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 1, typeof(UnityEngine.GameObject));
         bool arg1 = LuaDLL.luaL_checkboolean(L, 2);
         int  o    = MonoExtendUtil.GetMaxTargetDepth(arg0, arg1);
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #2
0
    /// <summary>
    /// 调整窗口层级
    /// </summary>
    /// <param name="windowBase"></param>
    private void AdjustBaseWindowDepth(UIWindowBase windowBase)
    {
        UIWindowType type = windowBase.windowData.windowType;

        if (type == UIWindowType.Custom)
        {
            return;
        }

        int needDepth = 1;
        UIWindowShowMode windowMode = windowBase.windowData.showMode;

        switch (type)
        {
        case UIWindowType.Normal:
        {
            if (windowMode == UIWindowShowMode.DestoryOtherWindow)
            {
                needDepth = NORMAL_WINDOW_DEPTH;
            }
            else
            {
                needDepth = Mathf.Clamp(MonoExtendUtil.GetMaxTargetDepth(uiNormalWindowRoot.gameObject) + 1, NORMAL_WINDOW_DEPTH, int.MaxValue);
            }

            //Debug.Log("[UIWindowType.Normal] maxDepth is " + needDepth);
        }

        break;

        case UIWindowType.Fixed:
        {
            if (windowMode == UIWindowShowMode.DestoryOtherWindow)
            {
                needDepth = FIXED_WINDOW_DEPTH;
            }
            else
            {
                needDepth = Mathf.Clamp(MonoExtendUtil.GetMaxTargetDepth(uiFixedWidowRoot.gameObject) + 1, FIXED_WINDOW_DEPTH, int.MaxValue);
            }

            //Debug.Log("[UIWindowType.Fixed] max depth is " + needDepth);
        }
        break;

        case UIWindowType.PopUp:
        {
            if (windowMode == UIWindowShowMode.DestoryOtherWindow)
            {
                needDepth = POPUP_WINDOW_DEPTH;
            }
            else
            {
                needDepth = Mathf.Clamp(MonoExtendUtil.GetMaxTargetDepth(uiPopUpWindowRoot.gameObject) + 1, POPUP_WINDOW_DEPTH, int.MaxValue);
            }

            //Debug.Log("[UIWindowType.PopUp] maxDepth is " + needDepth);
        }
        break;
        }

        if (windowBase.MinDepth != needDepth)
        {
            MonoExtendUtil.SetTargetMinPanel(windowBase.gameObject, needDepth);
        }

        windowBase.MinDepth = needDepth;
    }