diff --git a/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua b/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua index 9e5972f06c..c971b30cff 100644 --- a/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Shop/ShopManager.lua @@ -25,6 +25,9 @@ function this.SetSelectIndex(shopType,storeId,b) end function this.Initialize() + -- 是否已经刷新红点标志位 + this.RecoverCountRedFlag = {} + if not this._CountDownTimer then this._CountDownTimer = Timer.New(this.TimeUpdate, 1, -1, true) this._CountDownTimer:Start() @@ -118,7 +121,7 @@ function this.UpdateShopData(msg) local shopInfo = this.GetShopInfo(newdata.id) this.CheckShopRedpot(shopInfo.StoreType) - --Log(string.format("服务器推送商店刷新,商店id = %d", newdata.id)) + -- LogYellow(string.format("服务器推送商店刷新,商店id = %s, 商店类型 = %s", newdata.id, shopInfo.StoreType)) end -- 刷新物品排序 this.SortItemList() @@ -678,9 +681,25 @@ function this.CheckShopRefreshTime() this._IsRefresh = 0 this._RefreshShopList = {} for _, v in ipairs(this.allShopData) do - local leftTime = this.CountShopRefreshLeftTime(v.id) local shopInfo = this.GetShopInfo(v.id) local shopType = shopInfo.StoreType + + -- 判断是否是自动恢复次数的商店,到达最大次数刷新红点显示 + local IsAutoRecoverCount, Count = this.IsAutoRecoverCount(shopType) + if IsAutoRecoverCount then + local MaxCount = shopInfo.IfManualRefresh[1] + if Count >= MaxCount then + if not this.RecoverCountRedFlag[shopType] then + this.RecoverCountRedFlag[shopType] = true + this.CheckShopRedpot(shopType) + end + else + this.RecoverCountRedFlag[shopType] = false + end + end + + -- 判断是否是自动刷新的商店 + local leftTime = this.CountShopRefreshLeftTime(v.id) this._RefreshShopList[shopType] = leftTime -- 判断是否需要刷新商店 if leftTime == 0 then @@ -994,7 +1013,7 @@ end --- 商店的查看时间 local _ShopCheckTime = {} --- 商店刷新按钮的点击状态 -local _RefreshBtnIsClick = {} +-- local _RefreshBtnIsClick = {} -- 检测红点数据,shopType 为空时检测所有商店 function this.ShopCheckRPIsShow(shopType) @@ -1024,9 +1043,9 @@ end -- 检测商店刷新次数是否存在 function this.ShopRefreshRPIsShow(shopType) -- 判断今天商店的刷新按钮是否被点击过 - if _RefreshBtnIsClick[shopType] then - return false - end + -- if _RefreshBtnIsClick[shopType] then + -- return false + -- end -- 没有商店数据 local shopData = this.GetShopDataByType(shopType) if not shopData then @@ -1106,7 +1125,7 @@ function this.LoadRedpotDataFromLocal() -- 检测所有商店 for _, type in pairs(SHOP_TYPE) do _ShopCheckTime[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopRedPot_"..type) - _RefreshBtnIsClick[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopBtnStatus_"..type) == 1 + -- _RefreshBtnIsClick[type] = PlayerPrefs.GetInt(PlayerManager.uid.."_ShopBtnStatus_"..type) == 1 end end @@ -1124,8 +1143,8 @@ end -- 设置商店刷新按钮是否被点击过 function this.SetShopRefreshBtnClickStatus(shopType, status) - PlayerPrefs.SetInt(PlayerManager.uid.."_ShopBtnStatus_"..shopType, status and 1 or 0) - _RefreshBtnIsClick[shopType] = status + -- PlayerPrefs.SetInt(PlayerManager.uid.."_ShopBtnStatus_"..shopType, status and 1 or 0) + -- _RefreshBtnIsClick[shopType] = status this.CheckShopRedpot(shopType) end