Example #1
0
    /// <summary>
    /// 현재 페이지에서 원하는 스택 팝업만 지우는 함수
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public void RemoveStackPopup <T>(bool bShowPrevPopup = false) where T : UIPopupBase
    {
        UIPopupBase popup = _pagePopupList[CurrentPageBase].Find((pop) => pop is T);

        if (popup)
        {
            _pagePopupList[CurrentPageBase].Remove(popup);
            removeAndReleasePopup(popup);

            if (bShowPrevPopup)
            {   // 이전 팝업을 업데이트해준다.
                if (_pagePopupList[CurrentPageBase].Count > 0)
                {
                    var pagePop = _pagePopupList[CurrentPageBase][_pagePopupList[CurrentPageBase].Count - 1];
                    var uidata  = _datamanager.GetData(pagePop.GetType());
                    pagePop.ResetUIUpdate(uidata);
                }
                else
                {
                    var uidata = _datamanager.GetData(CurrentPageBase.GetType());
                    CurrentPageBase.ResetUIUpdate(uidata);
                }
            }
        }
    }
Example #2
0
    private void addStackPopup(UIPopupBase popup, bool hidePrev)
    {
        int lastCount = _pagePopupList[CurrentPageBase].Count;


        if (lastCount > 0)
        {
            _pagePopupList[CurrentPageBase][lastCount - 1].BelowStateDoSomething();
        }
        else
        {
            CurrentPageBase.BelowStateDoSomething();
        }


        if (hidePrev)
        {
            if (lastCount > 0)
            {
                _pagePopupList[CurrentPageBase][lastCount - 1].HideBaseUI();
            }
            else
            {
                CurrentPageBase.HideBaseUI();
            }
        }

        _pagePopupList[CurrentPageBase].Add(popup);
    }
Example #3
0
    /// <summary>
    ///  최상위 스택을 지우면서 바로 이전의 스택 팝업을 리셋시킨다
    /// </summary>
    /// <returns>지우면 true</returns>
    public bool RemoveCurrentTopStackPopup()
    {
        if (CurrentPageBase == null)
        {
            return(false);
        }

        List <UIPopupBase> stacklist = _pagePopupList[CurrentPageBase];

        if (stacklist.Count < 1)
        {
            return(false);
        }

        UIPopupBase popup = stacklist[stacklist.Count - 1];

        stacklist.Remove(popup);
        removeAndReleasePopup(popup);

        if (stacklist.Count > 0)
        {
            var stackPop = stacklist[stacklist.Count - 1];

            var uidata = _datamanager.GetData(stackPop.GetType());

            stackPop.ResetUIUpdate(uidata);
        }
        else
        {
            var uidata = _datamanager.GetData(CurrentPageBase.GetType());
            CurrentPageBase.ResetUIUpdate(uidata);
        }

        return(true);
    }
Example #4
0
    public void CloseForegroundPopup()
    {
        //  关闭顶部的窗口
        if (openStack.Count > 0)
        {
            UIPopupBase p =  openStack[openStack.Count - 1];
            openStack.Remove(p);
            p.Close();
        }

        //  所有窗口已关闭,隐藏遮挡层
        if (openStack.Count <= 0)
        {
            BackGroundPlate.color = offColor;
            instance.BackGroundPlate.gameObject.SetActive(false);
            return;
        }

        //  仍有窗口未关闭,重新调整遮挡层的层级
        List<GameObject> tmp = new List<GameObject>(openStack.Where(v => true).Select(v => v.gameObject).ToArray());
        tmp.Insert(tmp.Count - 1, BackGroundPlate.gameObject);
        int sibling = 0;
        foreach (var g in tmp)
        {
            g.transform.SetSiblingIndex(sibling++);
        }
    }
Example #5
0
    static public Sprite GetAtlasSprite(this UIPopupBase uiBase, string spriteName)
    {
        Sprite temp = null;

        UISpriteRepository.i.GetSprite(uiBase.GetType().ToString(), spriteName);

        return(temp);
    }
Example #6
0
    /// <summary>
    ///  인자로 들어온 팝업을 리소스 해제와 함께 단순 삭제만 하는 함수
    /// </summary>
    /// <param name="basepop"></param>
    private void removeAndReleasePopup(UIPopupBase basepop)
    {
        if (basepop == null)
        {
            Debug.Log("Error");
        }

        Destroy(basepop.gameObject);
    }
Example #7
0
    private void addPagePopup(UIPopupBase popup, bool delPrev)
    {
        if (delPrev)
        {
            RemoveCurrentPageUI();
        }
        else
        {
            hidePrevBasePopup();
        }

        CurrentPageBase = popup;
        _pagePopupList.Add(popup, new List <UIPopupBase>());
    }
Example #8
0
    /// <summary>
    /// 팝업 Id 특정된것만 지운다
    /// </summary>
    /// <param name="popup"></param>
    public void RemovePopup(UIPopupBase popup)
    {
        UIPopupBase find = _popupList.Find((pop) => pop.Id == popup.Id);

        if (popup == null)
        {
            print("Pop is Null" + popup.Id);
            return;
        }

        _popupList.Remove(popup);

        Destroy(popup.gameObject);
    }
Example #9
0
    /// <summary>
    ///  현재  BaseUI 를 삭제하고 currentBase에 이전 마지막Stack BaseUI를 세팅한다
    /// </summary>
    public void RemoveCurrentPageUI()
    {
        RemoveCurrentStackList();

        if (CurrentPageBase == null)
        {
            return;
        }

        _pagePopupList.Remove(CurrentPageBase);

        // 로비 씬일때만 풀 시스템사용
        if (CrimeSceneManager.i.CurrentState.Equals(SCENENAME.LobbyScene))
        {
            AddPagePool(CurrentPageBase);
        }
        else
        {
            Destroy(CurrentPageBase.gameObject);
            CurrentPageBase = null;
        }

        //removeAndReleasePopup(CurrentPageBase);

        int lastIndex = _pagePopupList.Count - 1;

        if (_pagePopupList.Count < 1)
        {
            // 상황마다 다름 기본 페이지가 있냐 없냐에 따라
            //CurrentPageBase = CreatePagePopUp<LobbyPopup>(false);
            CurrentPageBase = null;
            return;
        }

        Dictionary <UIPopupBase, List <UIPopupBase> > .Enumerator keyIter = _pagePopupList.GetEnumerator();

        int i = 0;

        while (keyIter.MoveNext())
        {
            if (i == lastIndex)
            {
                CurrentPageBase = keyIter.Current.Key;
            }

            i++;
        }

        showPrePagePopup();
    }
Example #10
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);
    }
Example #11
0
    // 풀리스트에 저장
    public void AddPagePool(UIPopupBase popup)
    {
        if (_poolList.Contains(popup) == false)
        {
            popup.gameObject.SetActive(false);
            popup.transform.SetParent(Pool, false);

            _poolList.Add(popup);
        }

        if (_poolList.Count > 5)
        {
            var remo = _poolList[0].gameObject;
            _poolList.RemoveAt(0);
            Destroy(remo);
        }
    }
Example #12
0
    // 기본 베이스 UI를 전부 지운다 : 당연히 그위에 쌓여있던 스택도 모두 지워진다
    public void RemoveAllPagePopup()
    {
        int count = _pagePopupList.Count;

        if (count < 1)
        {
            return;
        }

        Dictionary <UIPopupBase, List <UIPopupBase> > .Enumerator iterator = _pagePopupList.GetEnumerator();

        _tempList.Clear();

        while (iterator.MoveNext())
        {
            List <UIPopupBase> stackList = iterator.Current.Value;

            if (stackList != null)
            {
                int stackCount = stackList.Count;

                for (int i = 0; i < stackCount; ++i)
                {
                    UIPopupBase pop = stackList[i];
                    removeAndReleasePopup(pop);
                }

                stackList.Clear();
                stackList = null;

                _tempList.Add(iterator.Current.Key);
            }
        }

        int pageCount = _tempList.Count;

        for (int i = 0; i < pageCount; ++i)
        {
            UIPopupBase pop = _tempList[i];
            removeAndReleasePopup(pop);
        }

        _tempList.Clear();
        _pagePopupList.Clear();
        CurrentPageBase = null;
    }
Example #13
0
    private void selectParentBelongtoUI(UIPopupBase popup, UIPopupBase.PopupType type, bool option)
    {
        switch (type)
        {
        case UIPopupBase.PopupType.SUB_STACK:
            popup.transform.SetParent(StackPopUI, false);
            addStackPopup(popup, option);
            break;

        case UIPopupBase.PopupType.PAGE:
            popup.transform.SetParent(BottomUI, false);
            addPagePopup(popup, option);
            break;

        case UIPopupBase.PopupType.POP_UP:
            popup.transform.SetParent(PopUpUI, false);
            _popupList.Add(popup);
            break;

        case UIPopupBase.PopupType.FADE:
            popup.PopType = UIPopupBase.PopupType.FADE;
            popup.transform.SetParent(FrontUI, false);
            _popupList.Add(popup);
            break;

        case UIPopupBase.PopupType.FRONT:
            popup.transform.SetParent(FrontUI, false);
            _frontPopup = popup;
            _accFrontUI++;
            break;

        case UIPopupBase.PopupType.TOP_BAR:
            popup.transform.SetParent(TopBarUI, false);
            _topBarUI = popup as LobbyTopBar;
            break;
        }

        popup.transform.SetAsLastSibling();
    }
Example #14
0
    /// <summary>
    ///  현재 베이스 위에있는 모든 스택팝업을 지운다 - 베이스는 존재하게 둠
    /// </summary>
    /// <returns></returns>
    public void RemoveCurrentStackList()
    {
        if (CurrentPageBase == null)
        {
            return;
        }

        List <UIPopupBase> poplist = _pagePopupList[CurrentPageBase];

        if (poplist.Count > 0)
        {
            int popcount = poplist.Count;

            for (int i = 0; i < popcount; i++)
            {
                UIPopupBase pop = poplist[0];

                poplist.Remove(pop);

                Destroy(pop.gameObject);
            }
        }
    }
Example #15
0
 private void OnPopupHided(UIPopupBase pArg)
 {
     gameObject.SetActive(true);
 }
Example #16
0
 private void OnPopupDisplayed(UIPopupBase pArg)
 {
     gameObject.SetActive(false);
 }