| | |
| | | if (PlayerDatas.Instance.baseData.LV >= s_storeModelDict[type][i].LV)
|
| | | {
|
| | | StoreConfig storeConfig = s_storeModelDict[type][i];
|
| | | //等于1隐藏
|
| | | if (storeConfig.TheOnlyShop == 1)
|
| | | {
|
| | | bool isSellOut = false;
|
| | |
| | | List<StoreConfig> storelist = s_TheOnlyShopDict[storeConfig.ItemID];
|
| | | for (int j = 0; j < storelist.Count; j++)
|
| | | {
|
| | | BuyShopItemLimit shopItemLimit = ModelCenter.Instance.GetModel<StoreModel>().GetBuyShopLimit((uint)storelist[j].ID);
|
| | | if (shopItemLimit != null && shopItemLimit.BuyCnt >= storelist[j].PurchaseNumber[0])
|
| | | int remainCnt = 0;
|
| | | if (CheckShopIsSellOut(storelist[j], out remainCnt))
|
| | | {
|
| | | isSellOut = true;
|
| | | break;
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (storeConfig.RefreshType != 0)
|
| | | if (storeConfig.IsHideSellOut != 1)
|
| | | {
|
| | | modellist.Add(storeConfig);
|
| | | switch (storeConfig.ShopType)
|
| | | {
|
| | | case 12:
|
| | | if (CheckRuneStoreIsCanBuy(storeConfig))
|
| | | {
|
| | | modellist.Add(storeConfig);
|
| | | }
|
| | | break;
|
| | | default:
|
| | | modellist.Add(storeConfig);
|
| | | break;
|
| | | }
|
| | |
|
| | | }
|
| | | else
|
| | | {
|
| | | int canBuyCnt = 0;
|
| | | int addBuyCnt = 0;
|
| | | bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
|
| | | BuyShopItemLimit shopItemLimit = ModelCenter.Instance.GetModel<StoreModel>().GetBuyShopLimit((uint)storeConfig.ID);
|
| | | if (isLimitBuy && !_keepOld)
|
| | | int remainCnt = 0;
|
| | | switch (storeConfig.ShopType)
|
| | | {
|
| | | int remainNum = canBuyCnt;
|
| | | if (shopItemLimit != null)
|
| | | {
|
| | | remainNum = canBuyCnt - shopItemLimit.BuyCnt;
|
| | | }
|
| | |
|
| | | if (remainNum > 0)
|
| | | {
|
| | | modellist.Add(storeConfig);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | modellist.Add(storeConfig);
|
| | | case 12:
|
| | | if (CheckRuneStoreIsCanBuy(storeConfig) && !CheckShopIsSellOut(storeConfig, out remainCnt))
|
| | | {
|
| | | modellist.Add(storeConfig);
|
| | | }
|
| | | break;
|
| | | default:
|
| | | if (!CheckShopIsSellOut(storeConfig, out remainCnt))
|
| | | {
|
| | | modellist.Add(storeConfig);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return sortlist;
|
| | | }
|
| | |
|
| | | public static bool CheckShopIsSellOut(StoreConfig storeConfig,out int remainCnt)
|
| | | {
|
| | | int canBuyCnt = 0;
|
| | | int addBuyCnt = 0;
|
| | | remainCnt = 0;
|
| | | bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
|
| | | BuyShopItemLimit shopItemLimit = ModelCenter.Instance.GetModel<StoreModel>().GetBuyShopLimit((uint)storeConfig.ID);
|
| | | if (!isLimitBuy) return false;
|
| | |
|
| | | if(shopItemLimit != null)
|
| | | {
|
| | | remainCnt = canBuyCnt - shopItemLimit.BuyCnt;
|
| | | if (canBuyCnt <= shopItemLimit.BuyCnt)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | public static bool CheckRuneStoreIsCanBuy(StoreConfig storeConfig)
|
| | | {
|
| | | Dictionary<int, List<int>> unlockRunelist = ModelCenter.Instance.GetModel<RuneModel>().GetAllUnlockRuneIdlist();
|
| | | if(unlockRunelist != null)
|
| | | {
|
| | | foreach (var tower in unlockRunelist.Keys)
|
| | | {
|
| | | if(unlockRunelist[tower].Contains(storeConfig.ItemID))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | | |
| | | public static int CompareByShopSort(StoreConfig start, StoreConfig end)
|
| | | {
|
| | | int sort1 = start.ShopSort;
|