From cfc913bbc7924e86843b81ba56df5e381aa3f2fd Mon Sep 17 00:00:00 2001 From: "PC-202302260912\\Administrator" <1545929779@qq.com> Date: Thu, 30 Nov 2023 18:57:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BC=E5=8C=85=E6=B7=BB=E5=8A=A0=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E6=98=BE=E7=A4=BA=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 7fa6820a1e24beef1645cb11a821b47455a3c49f) --- .../Modules/Operating/OperatingManager.lua | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua b/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua index ee69847255..a6d4ee5e13 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua @@ -7,7 +7,7 @@ --]] require("Modules.Operating.MonthCardManager") require("Modules.Operating.WeekCardManager") - +local rechargeOrder=ConfigManager.GetConfig(ConfigName.RechargeCommodityorder) OperatingManager = {} local this = OperatingManager --后端数据 以RechargeCommodityConfig表Type为键 @@ -52,7 +52,8 @@ function this.SetBasicValues(giftGoodsList) .."次 开始时间:"..tostring(giftGoodsInfo.startTime).." 结束时间:"..tostring(giftGoodsInfo.endTime).. " 可购:" ..tostring(giftGoodsInfo.dynamicBuyTimes).." 是否已买:"..tostring(giftGoodsInfo.isBought)) if giftGoodsInfo.endTime == 0 and giftGoodsInfo.startTime == 0 and (rechargeConfigLocal.ShowType == 25 or rechargeConfigLocal.ShowType == 26 or rechargeConfigLocal.ShowType == 8 ) then elseif rechargeConfigLocal.Package == 2 and AppConst.SdkChannel=="XQDC" then - + -- elseif this.CheckGiftFrontIsOpen(giftGoodsInfo.goodsId)==false then + -- LogError("前置条件不满足================") else if giftGoodsInfoList[rechargeConfigLocal.Type] then table.insert(giftGoodsInfoList[rechargeConfigLocal.Type], giftGoodsInfo) @@ -63,9 +64,42 @@ function this.SetBasicValues(giftGoodsList) end end end + + --屏蔽前置礼包没有达成购买限制的 + for _, v in pairs(GoodsTypeDef) do + for key, value in pairs(giftGoodsInfoList[v]) do + if this.CheckGiftFrontIsOpen(value.goodsId)==false then + table.remove(giftGoodsInfoList[v], key) + end + end + end + --this.RemoveItemInfoByType Game.GlobalEvent:DispatchEvent(GameEvent.FindFairy.RefreshBuyOpenState) end +--检测礼包前置是否开启 +function this.CheckGiftFrontIsOpen(gift) + local isOpen=true + for k, v in ConfigPairs(rechargeOrder) do + if v.BehindCommodity==gift then + if v.FrontCommodity>0 then + local time=this.GetLeftBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity) + local buyTime= this.GetGoodsBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity) + --无限次 + if time==-1 then + return true + end + + LogError("time================="..time.." v.FrontCommodityNumber==========="..v.FrontCommodityNumber.." buyTime=="..buyTime.."   giftid===="..gift) + if time>v.FrontCommodityNumber then + return false + end + end + end + end + return isOpen +end + --判断商品是否可购买(成长礼) function this.IsGrowthGiftGoodsAvailable(goodsType) for _, v in ipairs(giftGoodsInfo)do @@ -151,7 +185,7 @@ function this.GetGiftGoodsInfo(goodsType, Id) end else -- 判断是否可用 - if _IsGiftGoodsAvailable(giftGoodsInfo) then + if _IsGiftGoodsAvailable(giftGoodsInfo) then return giftGoodsInfo end end @@ -168,7 +202,7 @@ function this.GetGiftGoodsInfoList(type) local newGiftGoodsInfoList = {} for k,v in pairs(giftGoodsInfoList[type]) do --and PlayerManager.level >= rechargeConfig[v.goodsId].LevelLinit[1] and PlayerManager.level <= rechargeConfig[v.goodsId].LevelLinit[2] - if rechargeConfig[v.goodsId] then + if rechargeConfig[v.goodsId] then table.insert(newGiftGoodsInfoList,v) end end