コード例 #1
0
ファイル: UIManager.cs プロジェクト: LynnPi/SS
 private void ClearAllPanel(UIDisplayControl ctrl)
 {
     if (ctrl == null)
     {
         return;
     }
     if (!ctrl.ClearOpened)
     {
         return;
     }
     for (int i = 0; i < OpenedUIList.Count; i++)
     {
         GameObject panel = OpenedUIList[i];
         // 不存在的跳过
         if (!panel)
         {
             continue;
         }
         UIPanelBehaviour script = panel.GetComponent <UIPanelBehaviour>();
         // 已关闭的跳过
         if (!script.GetActiveSelf())
         {
             continue;
         }
         // 关闭该界面
         StartCoroutine(ClosePanel(script, false));
     }
     OpenedUIList.Clear();
     ClosedUIList.Clear();
 }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: LynnPi/SS
    private void CloseAllPanel(params string[] dontCloseUIName)
    {
        List <GameObject> list = new List <GameObject>();

        for (int i = 0; i < OpenedUIList.Count; i++)
        {
            GameObject panel = OpenedUIList[i];
            // 不存在的跳过
            if (!panel)
            {
                continue;
            }
            UIPanelBehaviour script = panel.GetComponent <UIPanelBehaviour>();
            // 已关闭的跳过
            if (!script.GetActiveSelf())
            {
                continue;
            }
            // 过滤
            bool b = false;
            for (int k = 0; k < dontCloseUIName.Length; k++)
            {
                if (panel.name == dontCloseUIName[k])
                {
                    b = true;
                    break;
                }
            }
            if (b)
            {
                continue;
            }
            // 关闭该界面
            StartCoroutine(ClosePanel(script, false));
            // 加入到关闭表内
            list.Add(OpenedUIList[i]);
        }
        // 把该阶段的界面加入关闭表
        if (list.Count > 0)
        {
            ClosedUIList.Add(list);
        }
        // 把关闭的UI从打开表内清除
        for (int i = 0; i < list.Count; i++)
        {
            if (OpenedUIList.Contains(list[i]))
            {
                OpenedUIList.Remove(list[i]);
            }
        }
    }
コード例 #3
0
ファイル: UIManager.cs プロジェクト: LynnPi/SS
    private IEnumerator OnClosePanel(UIPanelBehaviour script, bool bPlaySound)
    {
        bool bActive = script.GetActiveSelf();

        if (!bActive)
        {
            yield break;
        }
        yield return(StartCoroutine(ClosePanel(script, bPlaySound)));

        OpenedUIList.RemoveAt(OpenedUIList.Count - 1);
        string           uiName = script.name;
        UIDisplayControl ctrl   = GlobalConfig.GetUIDisplayControl(uiName);

        if (ctrl != null)
        {
            if (ctrl.JustCloseSelfWhenClosing)
            {
                yield break;
            }
        }
        if (ClosedUIList.Count <= 0)
        {
            yield break;
        }
        List <GameObject> lastClosedUIList = ClosedUIList[ClosedUIList.Count - 1];

        for (int i = 0; i < lastClosedUIList.Count; i++)
        {
            GameObject panel = lastClosedUIList[i];
            if (!panel)
            {
                continue;
            }
            UIPanelBehaviour panelScript = panel.GetComponent <UIPanelBehaviour>();
            StartCoroutine(panelScript.ReShow());
            OpenedUIList.Add(panel);
        }
        ClosedUIList.RemoveAt(ClosedUIList.Count - 1);
        ShowUIListContent();
    }