Exemplo n.º 1
0
    // 패널을 연다
    public UIBasePanel Open(string path, params object[] _parameters)
    {
        UIRootInit();

        UIBasePanel panel = GetPanel(path);

        if (panel == null)
        {
            GameObject oPanel = (GameObject)Instantiate(Resources.Load("UI/" + path));
            oPanel.name                    = path;
            oPanel.transform.parent        = _Default;
            oPanel.transform.localPosition = Vector3.zero;
            oPanel.transform.localScale    = Vector3.one;

            if (oPanel != null)
            {
                panel = oPanel.GetComponent <UIBasePanel>();
                panel.Init();
            }

            if (panel._ePanelType != ePanelState.None)
            {
                if (panel != null)
                {
                    if (panel._ePanelType == ePanelState.Default)
                    {
                        ListUIPanel.Insert(0, panel);
                    }
                    else
                    {
                        ListUIPanel.Add(panel);
                    }
                }
            }
        }
        else
        {
            // 리스트에서 가장 앞으로 옮긴다
            if (panel._ePanelType != ePanelState.None)
            {
                ListUIPanel.Remove(panel);
                ListUIPanel.Insert(0, panel);
            }
        }
        // 파라미터 저장
        panel.parameters = _parameters;

        if (panel._ePanelType == ePanelState.Default)
        {
            _CurUIBasePanel = panel;
        }
        panel.LateInit();

        //for (int i = 0; i < ListUIPanel.Count; ++i)
        //    Debug.Log(ListUIPanel[i].name);
        //Debug.Log("CurPanel : " + _CurUIBasePanel.name);

        return(panel);
    }
Exemplo n.º 2
0
    public void Prev()
    {
        //if (ListUIPanel.Count < 2)
        //{
        //    OnPopupToastPanel("숨겨진 패널이 없습니다");
        //    return;
        //}

        UIBasePanel hidePanel = null;
        UIBasePanel showPanel = null;

        int hideIdx = ListUIPanel.FindIndex(panel => panel._ePanelType != ePanelState.Ignore && _CurUIBasePanel.name == panel.name);

        if (hideIdx >= 0 && ListUIPanel.Count > hideIdx)
        {
            hidePanel = ListUIPanel[hideIdx];
        }

        // 뒤로 가기 막기
        if (hidePanel is InGameHUDPanel)
        {
            return;
        }

        if (hidePanel is MainPanel || hidePanel is TitlePanel)
        {
            OpenPopup(DataMgr.Instance.GetLocal(5), DataMgr.Instance.GetLocal(6), delegate()
            {
                Application.Quit();
            }, delegate() { }, DataMgr.Instance.GetLocal(3), DataMgr.Instance.GetLocal(4));
            return;
        }

        int showIdx = ListUIPanel.FindIndex(hideIdx + 1, panel => panel._ePanelType != ePanelState.Ignore);

        if (showIdx >= 0 && ListUIPanel.Count > showIdx)
        {
            showPanel = ListUIPanel[showIdx];
        }

        if (hidePanel != null)
        {
            switch (hidePanel.Prev())
            {
            case PrevType.Not:
                break;

            case PrevType.OnlyHide:
            {
                hidePanel.Hide();
            }
            break;

            case PrevType.Hide:
            {
                if (showPanel != null)
                {
                    _CurUIBasePanel = showPanel;
                    showPanel.LateInit();
                }
                hidePanel.Hide();
            }
            break;

            case PrevType.OnlyClose:
            {
                hidePanel.Close();
            }
            break;

            case PrevType.Close:
            {
                if (showPanel != null)
                {
                    _CurUIBasePanel = showPanel;
                    showPanel.LateInit();
                }
                hidePanel.Close();
            }
            break;
            }
        }
    }