Example #1
0
 /// <summary>
 /// 关闭界面
 /// </summary>
 /// <param name="wins">WindowBase</param>
 /// <param name="isDestroy"></param>
 public void F_CloseUI(WindowBase wins)
 {
     T_UIConfig.UI_TYPE type = wins.F_GetUIType();
     CloseUIById(wins.F_GetId());
     ResetDepth(type);
     SetFullScreenMask();
 }
Example #2
0
 /// <summary>
 /// 通过 UItype关闭界面
 /// </summary>
 /// <param name="type"></param>
 /// <param name="isDestroy"></param>
 public void F_CloseUI(T_UIConfig.UI_TYPE type)
 {
     for (int i = m_IdPosList.Count - 1; i >= 0; i--)
     {
         int        id   = m_IdPosList[i];
         WindowBase winb = m_UIList[id];
         if (winb.F_GetUIType() == type)
         {
             CloseUIById(id);
         }
     }
     ResetDepth(type);
     SetFullScreenMask();
 }
Example #3
0
    /// <summary>
    /// 检查是否是最上层
    /// </summary>
    /// <param name="winbs"></param>
    void CheckTop(WindowBase winbs, ref WindowBase tmpTop)
    {
        T_UIConfig config = GetConfigData(winbs.F_GetEUI());

        if (config == null)
        {
            return;
        }
        if (config.TopFilter == true)
        {
            return;
        }
        if (tmpTop == null)
        {
            tmpTop = winbs;
        }
        else
        {
            if ((int)winbs.F_GetUIType() >= (int)tmpTop.F_GetUIType())
            {
                tmpTop = winbs;
            }
        }
    }
Example #4
0
    /// <summary>
    /// 重新设置UI的层级
    /// </summary>
    /// <param name="type"></param>
    void ResetDepth(T_UIConfig.UI_TYPE currentType)
    {
        int undercount = 0;
        int wincount   = 0;
        int tipcount   = 0;
        int topcount   = 0;
        int id;

        WindowBase tmpTop = null;

        for (int i = 0; i < m_IdPosList.Count; i++)
        {
            id = m_IdPosList[i];
            if (m_UIList.ContainsKey(id))
            {
                WindowBase winbs = m_UIList[id];
                if (winbs == null)
                {
                    continue;
                }
                CheckTop(winbs, ref tmpTop);
                Vector3            localPos = winbs.transform.localPosition;
                T_UIConfig.UI_TYPE type     = winbs.F_GetUIType();
                if (type != currentType)
                {
                    continue;
                }
                Canvas canvas = TransformUtil.Add <Canvas>(winbs.gameObject);
                switch (type)
                {
                case T_UIConfig.UI_TYPE.UNDER_WIN:
                    undercount++;
                    winbs.transform.SetSiblingIndex(undercount * 2);
                    localPos.z = m_StartDepth - undercount * m_depth;
                    winbs.transform.localPosition = localPos;
                    canvas.sortingOrder           = m_StartDepth * (int)type + undercount * m_depth;
                    winbs.V_SortingOrder          = canvas.sortingOrder;
                    break;

                case T_UIConfig.UI_TYPE.WIN:
                    wincount++;
                    winbs.transform.SetSiblingIndex(wincount * 2);
                    localPos.z = m_StartDepth - wincount * m_depth;
                    winbs.transform.localPosition = localPos;
                    canvas.sortingOrder           = m_StartDepth * (int)type + wincount * m_depth;
                    winbs.V_SortingOrder          = canvas.sortingOrder;
                    break;

                case T_UIConfig.UI_TYPE.TIP:
                    tipcount++;
                    winbs.transform.SetSiblingIndex(tipcount * 2);
                    localPos.z = m_StartDepth - tipcount * m_depth;
                    winbs.transform.localPosition = localPos;
                    canvas.sortingOrder           = m_StartDepth * (int)type + tipcount * m_depth;
                    winbs.V_SortingOrder          = canvas.sortingOrder;
                    break;

                case T_UIConfig.UI_TYPE.TOP:
                    topcount++;
                    winbs.transform.SetSiblingIndex(topcount * 2);
                    localPos.z = m_StartDepth - topcount * m_depth;
                    winbs.transform.localPosition = localPos;
                    canvas.sortingOrder           = m_StartDepth * (int)type + topcount * m_depth;
                    winbs.V_SortingOrder          = canvas.sortingOrder;
                    break;
                }
            }
        }

        if (currentType == T_UIConfig.UI_TYPE.WIN)
        {
            CheckHidenWin();
        }
        //设置最上层WIN
        OnTopWin(tmpTop);
    }