Ejemplo n.º 1
0
    /// <summary>
    ///  팝업 하이어라키 부분의 최상위를 삭제해준다
    /// </summary>
    /// <returns> 팝업을 지우면 true </returns>
    public bool RemoveTopPopup()
    {
        int count = _popupList.Count;

        if (count > 0)
        {
            UIPopupBase popup = _popupList[count - 1];

            _popupList.Remove(popup);

            Destroy(popup.gameObject);

            // 팝업이 있으면 다음 팝업을 업데이트 시킨다
            if (_popupList.Count > 0)
            {
                popup = _popupList[_popupList.Count - 1];

                var data = _datamanager.GetData(popup.GetType());

                popup.ResetUIUpdate(data);
            }
            else
            {
                // 스택팝업까지만 reUpdate를 진행하자 페이지는 잠시 보류
                if (CurrentPageBase == null)
                {
                    return(false);
                }

                List <UIPopupBase> stackList = _pagePopupList[CurrentPageBase];

                if (stackList.Count > 0)
                {
                    popup = stackList[stackList.Count - 1];
                    var data = _datamanager.GetData(popup.GetType());
                    popup.ResetUIUpdate(data);
                }
                else
                {
                    var data = _datamanager.GetData(popup.GetType());
                    CurrentPageBase.ResetUIUpdate(data);
                }
            }

            return(true);
        }

        return(false);
    }