public bool IsShopTypeByBoolean(params ShopTypeEnum[] ShopTypeEnumArr)
        {
            var          ShopTypeEnumList = ShopTypeEnumArr.ToList();
            ShopTypeEnum currentShopType  = GetCurrentShopType();

            if (ShopTypeEnumList.Exists(t => t == currentShopType))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// InitFirstUrl
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        protected override string InitFirstUrl(ShopEnumParameter param)
        {
            _shopType = (ShopTypeEnum)Enum.Parse(typeof(ShopTypeEnum), param.ShopType);
            _q        = param.KeyWord;
            if (!int.TryParse(param.SearchPage, out _searchPage))
            {
                throw new Exception("搜索值转换为字符串失败。");
            }
            _partUrl = GetFirstUrl(_shopType, _q);
            var html = _httpHelper.GetHtmlByGet(_partUrl);

            InitUrlQueue(html);
            _curPage = 0;
            return(_urlQueue.Count == 0 ? null : _urlQueue.Dequeue());
        }
    void OnDianQuanTabClick(TabButton value)
    {
        if (value.name == "timelimit")
        {
            CurShopType = ShopTypeEnum.TimeLimitShop;
        }
        else if (value.name == "medical")
        {
            CurShopType = ShopTypeEnum.DianQuanShop;
            m_pageList  = pageListForDianQuanShop;
            m_curShopID = DIANQUAN_SHOP_ID;

            //ShowPage(0);
        }
    }
        /// <summary>
        /// GetFirstUrl
        /// </summary>
        /// <param name="shopType"></param>
        /// <param name="q"></param>
        /// <returns></returns>
        private string GetFirstUrl(ShopTypeEnum shopType, string q)
        {
            var url       = $"https://shopsearch.taobao.com/search?app=shopsearch&q={System.Web.HttpUtility.UrlEncode(q)}";
            var isb       = string.Empty;
            var shop_type = string.Empty;
            var ratesum   = string.Empty;

            switch (shopType)
            {
            case ShopTypeEnum.TaoBao:
                isb = "0";
                break;

            case  ShopTypeEnum.TaoBaoHuang:
                isb     = "0";
                ratesum = "huang";
                break;

            case ShopTypeEnum.TaoBaoJin:
                isb     = "0";
                ratesum = "jin";
                break;

            case ShopTypeEnum.TaoBaoZhuan:
                isb     = "0";
                ratesum = "zhuan";
                break;

            case ShopTypeEnum.TaoBaoXin:
                isb     = "0";
                ratesum = "xin";
                break;

            case ShopTypeEnum.Tmall:
                isb = "1";
                break;

            case ShopTypeEnum.QuanQiuGou:
                shop_type = "2";
                break;

            case ShopTypeEnum.Buxian:
                break;
            }

            return($"{url}&isb={isb}&shop_type={shop_type}&ratesum={ratesum}");
        }
    void OnTopTabClick(TabButton value)
    {
        if (value.name == "Gold shop")
        {
            CurShopType = ShopTypeEnum.GoldMoneyShop;
            m_pageList  = pageListForGoldShop;
            m_curShopID = GOLD_SHOP_ID;

            //ShowPage(0);
        }
        else if (value.name == "Trading line")
        {
            CurShopType = ShopTypeEnum.DianQuanShop;
            m_pageList  = pageListForDianQuanShop;
            m_curShopID = DIANQUAN_SHOP_ID;

            ShowPage(0);
        }
    }
Example #6
0
 public ShoppingFavorite(ShopTypeEnum shopType, string id)
 {
     PartitionKey = shopType.ToString();
     RowKey       = id;
 }
    void InitShopPageInfo(List <GameObject> pageList, int shopID, GameObject BindObject)
    {
        Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer;

        if (null == mainPlayer)
        {
            LogModule.ErrorLog("main player is not init");
            return;
            //yield break;
        }

        pageList.Clear();

        GameObject curPage     = null;
        GameObject curPageItem = null;

        // 根据表格配置,初始化ITEM
        Tab_SystemShop curShopTable = TableManager.GetSystemShopByID(shopID, 0);
        int            curItemIndex = 0; // 除去无效物品,实际物品ID
        int            curShowPage  = 0;

        for (int i = 0, count = curShopTable.getPidCount(); i < count; i++)
        {
            //yield return null;
            Tab_CommonItem curTabItem = TableManager.GetCommonItemByID(curShopTable.GetPidbyIndex(i), 0);
            if (null != curTabItem)
            {
                if (curItemIndex % PAGEITEMCOUNT_MAX == 0)
                {
                    curPage = Utils.BindObjToParent(m_PageItem, BindObject);
                    pageList.Add(curPage);
                    curPage.name = i.ToString();
                    curPage.GetComponent <SysShopPage>().SetPageNum(curItemIndex / PAGEITEMCOUNT_MAX);
                }


                // 显示适用等级的最后一页
                if (curTabItem.MinLevelRequire <= mainPlayer.BaseAttr.Level && shopID == GOLD_SHOP_ID)
                {
                    curShowPage = pageList.Count - 1;
                }
                GameObject newCurPageBindObject = null;
                newCurPageBindObject = curPage.GetComponent <SysShopPage>().ShopItemGirdObject;
                curPageItem          = Utils.BindObjToParent(m_ShopItem, newCurPageBindObject);
                curPageItem.name     = i.ToString();
                curPage.GetComponent <SysShopPage>().AddItem(curPageItem, curItemIndex % PAGEITEMCOUNT_MAX, i, curShopTable);
                curItemIndex++;
            }
            else
            {
                LogModule.DebugLog("systemshop:can not find cur item in item table, item id:" + curShopTable.GetPidbyIndex(i));
            }
//             UIGrid[] gridArray = m_SysShowPageRoot.gameObject.GetComponentsInChildren<UIGrid>();
//             for (int j = 0; j < gridArray.Length; j++)
//             {
//                 gridArray[j].repositionNow = true;
//             }
//             m_SysShowPageRoot.repositionNow = true;
        }

        if (shopID == GOLD_SHOP_ID)
        {
            CurShopType = ShopTypeEnum.GoldMoneyShop;

            m_pageList = pageListForGoldShop;
        }
        else if (shopID == DIANQUAN_SHOP_ID)
        {
            CurShopType = ShopTypeEnum.DianQuanShop;
            m_pageList  = pageListForDianQuanShop;
        }
        ShowPage(curShowPage);
    }