Esempio n. 1
0
    void UpdateGoodsInfo(TAB_INDEX eTabIndex)
    {
        m_TabPageInfo.Clear();
        m_CurTabIndex = eTabIndex;

        if (eTabIndex == TAB_INDEX.TAB_VIP)
        {
            if (Singleton <ObjManager> .Instance.MainPlayer != null)
            {
                int nPlayerVIPLevel = VipData.GetVipLv();
                if (nPlayerVIPLevel < 9)
                {
                    m_GoodsGrid.SetActive(false);
                    m_Pages.SetActive(false);
                    m_VIPLabel.SetActive(true);
                    return;
                }
                else
                {
                    m_GoodsGrid.SetActive(true);
                    m_Pages.SetActive(true);
                    m_VIPLabel.SetActive(false);
                }
            }
        }
        else
        {
            m_GoodsGrid.SetActive(true);
            m_Pages.SetActive(true);
            m_VIPLabel.SetActive(false);
        }

        int nTabItemCount  = 0;
        int nPageItemIndex = 0;

        for (int i = 0; i < m_ListPriority.Count; i++)
        {
            Tab_YuanBaoShop tabYuanBaoShop = TableManager.GetYuanBaoShopByID(m_ListPriority[i].GoodsId, 0);
            if (tabYuanBaoShop == null)
            {
                continue;
            }

            if (IsTabNewGoods(tabYuanBaoShop))
            {
                nTabItemCount += 1;
                if (HandleNewGoods(tabYuanBaoShop, nPageItemIndex, i, true))
                {
                    nPageItemIndex += 1;
                }
            }
        }

        UpdateGoodsActive(nPageItemIndex);

        m_TabPageInfo.PageCount = Mathf.CeilToInt((float)nTabItemCount / (float)ItemCount_PerPage);
        if (m_TabPageInfo.PageCount <= 0)
        {
            m_TabPageInfo.CurPage = 0;
        }
        else
        {
            m_TabPageInfo.CurPage = 1;
        }
        m_PageLabel.text = m_TabPageInfo.CurPage.ToString() + "/" + m_TabPageInfo.PageCount.ToString();
    }