void process_BackPopupUI(UI_PopupBase popupBase)
    {
        Type popupType = popupBase.GetType();

        if (popupType == typeof(UI_Popup_Selective))
        {
            popupBase.GetComponent <UI_Popup_Selective>().ResponseButton_No();
        }
        else if (popupType == typeof(UI_Popup_Notice))
        {
            popupBase.GetComponent <UI_Popup_Notice>().ResponseButton_Yes();
        }
        else if (popupType == typeof(UI_Popup_Attendace))
        {
            popupBase.GetComponent <UI_Popup_Attendace>().ResponseButton_close();
        }
        else if (popupType == typeof(UI_Popup_Reinforce))
        {
            popupBase.GetComponent <UI_Popup_Reinforce>().ResponseButton_Close();
        }
        else if (popupType == typeof(UI_Popup_RfProcess))
        {
            popupBase.GetComponent <UI_Popup_RfProcess>().ResponseButton_ReinforceEnd();
        }
        else if (popupType == typeof(UI_Popup_StartGame))
        {
            popupBase.GetComponent <UI_Popup_StartGame>().ResponseButton_Close();
        }
        else
        {
            ClearUI(popupBase);
        }
    }
Пример #2
0
    public void ClosePopupUI()
    {
        if (_popupStack.Count == 0)
        {
            return;
        }

        UI_PopupBase popupUI = _popupStack.Pop();

        Managers.Resource.Destroy(popupUI.gameObject);
        popupUI = null;

        _order -= 1;
    }
Пример #3
0
    // 더 안전한 ClosePopupUI() 함수
    public void ClosePopupUI(UI_PopupBase popupUI)
    {
        if (_popupStack.Count == 0)
        {
            return;
        }

        if (_popupStack.Peek() != popupUI)
        {
            Debug.Log("Close PopupUI Failed!");
            return;
        }

        ClosePopupUI();
    }
    public void ClearUI(UI_PopupBase popUp)
    {
        if (UIPopupList.Count == 0)
        {
            return;
        }

        //int idx = UIPopupList.IndexOf(popUp);
        //UI_PopupBase _pop = UIPopupList[idx];
        popUp.Set_Close();
        Destroy(popUp.gameObject);
        UIPopupList.Remove(popUp);

        Open_NextPopup();                       //다음 팝업창
    }
    bool ChkGetPopup <T>(out T p, UIPOPUP _popup)
    {
        bool isExist = false;

        p = default(T);

        for (int i = 0; i < UIPopupList.Count; i++)
        {
            if (UIPopupList[i].GetType() == typeof(UI_Popup_Toast))
            {
                ClearUI(UIPopupList[i]);
                UI_PopupBase _uiPopupBase = null;
                Scene        _scene       = SceneManager.GetActiveScene();
                if (_scene.name == DefineKey.Main)
                {
                    _uiPopupBase = InstantiateUI(_popup, parentToastPopup_Tr);
                }
                else
                {
                    _uiPopupBase = InstantiateUI(_popup, CanvasTr);
                }

                p       = _uiPopupBase.GetComponent <T>();
                isExist = true;
                break;
            }
            //else if (UIPopupList[i].GetType() == typeof(UI_Popup_ChatMessage))
            //{
            //    p = UIPopupList[i].GetComponent<T>();
            //    //UI_Popup_Toast t = p as UI_Popup_Toast;
            //    //if (t.toastType == ToastPopUpType.Notice)
            //    isExist = true;
            //    //else
            //    //	isExist = false;
            //    break;
            //}
        }

        return(isExist);
    }
    }    // end of function

    public T CreatAndGetPopup <T>(UIPOPUP _popup)
    {
        T popUp = default(T);

        if (_popup == UIPOPUP.POPUPTOAST || _popup == UIPOPUP.POPUPCHATMESSAGE)
        {
            if (!ChkGetPopup(out popUp, _popup))
            {
                UI_PopupBase _uiPopupBase = null;
                Scene        _scene       = SceneManager.GetActiveScene();
                if (_scene.name == DefineKey.Main)                 // Tr을 분리하였기때문에  메인씬쪽은 따로 팝업을 생성처리한다
                {
                    _uiPopupBase = InstantiateUI(_popup, parentToastPopup_Tr);
                }
                else
                {
                    _uiPopupBase = InstantiateUI(_popup, CanvasTr);
                }
                popUp = _uiPopupBase.GetComponent <T>();
            }
        }
        else
        {
            UI_PopupBase _uiPopupBase = null;
            Scene        _scene       = SceneManager.GetActiveScene();
            if (_scene.name == DefineKey.Main)             // Tr을 분리하였기때문에  메인씬쪽은 따로 팝업을 생성처리한다
            {
                _uiPopupBase = InstantiateUI(_popup, parentPopup_Tr);
            }
            else
            {
                _uiPopupBase = InstantiateUI(_popup, CanvasTr);
            }
            popUp = _uiPopupBase.GetComponent <T>();
        }

        return(popUp);
    }
    // :: popup 삭제
    public void ClearUI(UIPOPUP _popup)
    {
        if (UIPopupList.Count == 0)
        {
            return;
        }

        Type __type = GetUIpopupType(_popup);

        UI_PopupBase _Pop = UIPopupList.Find(n => n.GetType() == __type);

        if (_Pop == null)
        {
            return;
        }
        _Pop.Set_Close();
        Destroy(_Pop.gameObject);
        UIPopupList.Remove(_Pop);



        Open_NextPopup();                       //다음 팝업창
    }
    /// <summary>
    /// popup inst
    /// </summary>
    public UI_PopupBase InstantiateUI(UIPOPUP _popup, Transform _parentTr)
    {
        GameObject NewUI;
        GameObject CloneUI;

        NewUI   = Resources.Load(string.Format("Prefebs/UI_{0}", _popup.ToString())) as GameObject;
        CloneUI = Instantiate(NewUI);
        UserEditor.Getsingleton.EditLog(string.Format("Creat Prefebs/UI_{0}", _popup.ToString()));


#if UNITY_EDITOR
        CloneUI.name = NewUI.name;
#endif
        CloneUI.transform.SetParent(_parentTr);

        RectTransform _cloneUIRectTr = CloneUI.GetComponent <RectTransform>();
        RectTransform _newUIRectTr   = NewUI.GetComponent <RectTransform>();

        _cloneUIRectTr.sizeDelta        = _newUIRectTr.sizeDelta;
        _cloneUIRectTr.anchoredPosition = _newUIRectTr.anchoredPosition;
        _cloneUIRectTr.localScale       = _newUIRectTr.localScale;

        UI_PopupBase _uiPopupBase = CloneUI.GetComponent <UI_PopupBase>();

        UIPopupList.Add(_uiPopupBase);

        //if (UIPopupList.Count == 1)
        Open_NextPopup();
        //else
        //	_uiPopupBase.gameObject.SetActive(false);

        //팝업올라 왓으니 캐릭회전 잠그자
        //User.isSelectedCharacter = true;


        return(_uiPopupBase);
    }    // end of function