diff --git a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/XianShiShangShi.lua b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/XianShiShangShi.lua index fed89d9e1d..485d0ec88a 100644 --- a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/XianShiShangShi.lua +++ b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/XianShiShangShi.lua @@ -28,12 +28,10 @@ end --添加事件监听(用于子类重写) function XianShiShangShi:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end --移除事件监听(用于子类重写) function XianShiShangShi:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end local sortingOrder = 0 --界面打开时调用(用于子类重写) @@ -150,15 +148,9 @@ function this.SingleDataShow(pre,value) PopupTipPanel.ShowTip(Language[10540]) else --直购商品 - if AppConst.isSDKLogin then - PayManager.Pay({ Id = value.Id }) - else - NetManager.RequestBuyGiftGoods(value.Id, function(msg) - FirstRechargeManager.RefreshAccumRechargeValue(value.Id) - -- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) -- 改成后端推了 - this.OnShowData() - end) - end + PayManager.Pay(value.Id, function(id) + this.RechargeSuccessFunc(id) + end) end end) end @@ -170,7 +162,6 @@ end function this.RechargeSuccessFunc(id) FirstRechargeManager.RefreshAccumRechargeValue(id) - --OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.GiftBuy, id) this.OnShowData() end diff --git a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/ZhenQiYiBaoPage.lua b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/ZhenQiYiBaoPage.lua index 9aadf68279..f305e7854e 100644 --- a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/ZhenQiYiBaoPage.lua +++ b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/ZhenQiYiBaoPage.lua @@ -28,12 +28,10 @@ end --添加事件监听(用于子类重写) function ZhenQiYiBaoPage:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end --移除事件监听(用于子类重写) function ZhenQiYiBaoPage:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end local sortingOrder = 0 --界面打开时调用(用于子类重写) @@ -153,16 +151,9 @@ function this.SingleDataShow(pre,value) PopupTipPanel.ShowTip(Language[10540]) else --直购商品 - if AppConst.isSDKLogin then - PayManager.Pay({ Id = value.Id }) - else - NetManager.RequestBuyGiftGoods(value.Id, function(msg) - FirstRechargeManager.RefreshAccumRechargeValue(value.Id) - -- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) -- 改成后端推了 - LogGreen("刷新?") - this.OnShowData() - end) - end + PayManager.Pay(value.Id, function(id) + this.RechargeSuccessFunc(id) + end) end end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Expert/DiffMonsterBuy.lua b/Assets/ManagedResources/~Lua/Modules/Expert/DiffMonsterBuy.lua index 5958c82343..a906f0fac3 100644 --- a/Assets/ManagedResources/~Lua/Modules/Expert/DiffMonsterBuy.lua +++ b/Assets/ManagedResources/~Lua/Modules/Expert/DiffMonsterBuy.lua @@ -118,16 +118,11 @@ function DiffMonsterBuy:DiffMonsterBuy() end Util.AddOnceClick(this.diffMonsterBuyBtn, function() if shopItemData.buyTimes <= 0 then - if AppConst.isSDKLogin then - PayManager.Pay({ Id = rechargeCommodityConfig.Id }) - else - Log(Language[10527]..rechargeCommodityConfig.Id) - NetManager.RequestBuyGiftGoods(rechargeCommodityConfig.Id, function() - FirstRechargeManager.RefreshAccumRechargeValue(rechargeCommodityConfig.Id) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, rechargeCommodityConfig.Id) - this:DiffMonsterBuy() - end) - end + PayManager.Pay(rechargeCommodityConfig.Id, function(id) + FirstRechargeManager.RefreshAccumRechargeValue(rechargeCommodityConfig.Id) + OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, rechargeCommodityConfig.Id) + this:DiffMonsterBuy() + end) end end) Util.AddOnceClick(this.diffMonsteNameBtn, function() diff --git a/Assets/ManagedResources/~Lua/Modules/Expert/GiftBuy.lua b/Assets/ManagedResources/~Lua/Modules/Expert/GiftBuy.lua index fc45d3d9e4..439a1f0f35 100644 --- a/Assets/ManagedResources/~Lua/Modules/Expert/GiftBuy.lua +++ b/Assets/ManagedResources/~Lua/Modules/Expert/GiftBuy.lua @@ -32,12 +32,10 @@ end --添加事件监听(用于子类重写) function GiftBuy:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end --移除事件监听(用于子类重写) function GiftBuy:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end local sortingOrder = 0 --界面打开时调用(用于子类重写) @@ -134,15 +132,9 @@ function this.SingleDataShow(go, data) PopupTipPanel.ShowTip(Language[10540]) else --直购商品 - if AppConst.isSDKLogin then - PayManager.Pay({ Id = data.Id }) - else - NetManager.RequestBuyGiftGoods(data.Id, function(msg) - FirstRechargeManager.RefreshAccumRechargeValue(data.Id) - -- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) -- 改成后端推了 - this.OnShowData() - end) - end + PayManager.Pay(data.Id, function(id) + this:RechargeSuccessFunc(id) + end) end end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Expert/HeroStarFeedPage.lua b/Assets/ManagedResources/~Lua/Modules/Expert/HeroStarFeedPage.lua index 6b40818f9f..01228ce457 100644 --- a/Assets/ManagedResources/~Lua/Modules/Expert/HeroStarFeedPage.lua +++ b/Assets/ManagedResources/~Lua/Modules/Expert/HeroStarFeedPage.lua @@ -49,46 +49,10 @@ function HeroStarFeedPage:BindEvent() end) Util.AddClick(self.btnBuy,function() - if AppConst.isSDKLogin then - PayManager.Pay({ Id = curGiftId }) - else - NetManager.RequestBuyGiftGoods(curGiftId, function() - FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) - CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 - curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1 - --判断可购买次数是否为零,是剔除礼包信息 - -- for i = 1, #curGiftList do - if curGiftList[curIndex].dynamicBuyTimes == 0 then - OperatingManager.SetHadBuyGoodsId({curGiftId}) - OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId) - if curGiftList[curIndex-1] then - curIndex = curIndex -1 - -- LogBlue("QWEQWEQWEWQ") - -- elseif curGiftList[curIndex+1] then - -- curIndex = curIndex +1 - -- LogRed("ZXCZXCZX") - end - end - -- end - --判断是否有礼包 - self:GetInfoList() - if #curGiftList == 0 then - self:OnClose() - else - if curIndex then - self:FreshRewardShow(curIndex) - -- LogGreen("没换界面") - else - if curGiftList[curIndex-1] then - self:FreshRewardShow(curIndex - 1) - elseif curGiftList[curIndex+1] then - self:FreshRewardShow(curIndex + 1) - -- LogRed("界面-1") - end - end - end - end) - end + --直购商品 + PayManager.Pay(curGiftId, function(id) + this:RechargeSuccessFunc(id) + end) end) Util.AddClick(self.arrowsLeft,function() @@ -103,9 +67,40 @@ end -- 充值成功回调 function HeroStarFeedPage:RechargeSuccessFunc(id) - FirstRechargeManager.RefreshAccumRechargeValue(id) - -- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id)--后端推了 - self:FreshRewardShow() + FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) + CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 + curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1 + --判断可购买次数是否为零,是剔除礼包信息 + -- for i = 1, #curGiftList do + if curGiftList[curIndex].dynamicBuyTimes == 0 then + OperatingManager.SetHadBuyGoodsId({curGiftId}) + OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId) + if curGiftList[curIndex-1] then + curIndex = curIndex -1 + -- LogBlue("QWEQWEQWEWQ") + -- elseif curGiftList[curIndex+1] then + -- curIndex = curIndex +1 + -- LogRed("ZXCZXCZX") + end + end + -- end + --判断是否有礼包 + self:GetInfoList() + if #curGiftList == 0 then + self:OnClose() + else + if curIndex then + self:FreshRewardShow(curIndex) + -- LogGreen("没换界面") + else + if curGiftList[curIndex-1] then + self:FreshRewardShow(curIndex - 1) + elseif curGiftList[curIndex+1] then + self:FreshRewardShow(curIndex + 1) + -- LogRed("界面-1") + end + end + end end diff --git a/Assets/ManagedResources/~Lua/Modules/Expert/WeekCard.lua b/Assets/ManagedResources/~Lua/Modules/Expert/WeekCard.lua index dbd90b76d6..c7d58380e7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Expert/WeekCard.lua +++ b/Assets/ManagedResources/~Lua/Modules/Expert/WeekCard.lua @@ -27,16 +27,13 @@ end function WeekCard:BindEvent() Util.AddClick(self.weekCardBuyBtn, function() - if AppConst.isSDKLogin then - PayManager.Pay({ Id = 12 }) - else - NetManager.RequestBuyGiftGoods(12, function() - PopupTipPanel.ShowTip(Language[10553]) - FirstRechargeManager.RefreshAccumRechargeValue(12) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.WeekCard, 12) - this:WeekCardShow() - end) - end + --直购商品 + PayManager.Pay(12, function(id) + PopupTipPanel.ShowTip(Language[10553]) + FirstRechargeManager.RefreshAccumRechargeValue(12) + OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.WeekCard, 12) + this:WeekCardShow() + end) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftFiveView.lua b/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftFiveView.lua index 5277b775d2..ddad9754f3 100644 --- a/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftFiveView.lua +++ b/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftFiveView.lua @@ -31,11 +31,9 @@ function this:BindEvent() end function this:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end function this:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end function this:OnShow(_sortingOrder) @@ -88,15 +86,10 @@ function this.SetShow(root,data) stateBtnText.text=Language[10638] end Util.AddOnceClick(stateBtn,function() - if AppConst.isSDKLogin then - PayManager.Pay({ Id = data.native.Id }) - else - NetManager.RequestBuyGiftGoods(data.native.Id, function() - FirstRechargeManager.RefreshAccumRechargeValue(data.native.Id) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.native.Id) - this.OnShowPanelData() - end) - end + --直购商品 + PayManager.Pay(data.native.Id, function(id) + this.RechargeSuccessFunc(id) + end) end) if data.native.Limit-data.server.buyTimes==0 then diff --git a/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftOneView.lua b/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftOneView.lua index a2836c4519..6e825e0f3b 100644 --- a/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftOneView.lua +++ b/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftOneView.lua @@ -27,11 +27,9 @@ function this:BindEvent() end function this:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end function this:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end function this:OnShow(_sortingOrder) @@ -76,17 +74,9 @@ function this.OnShowPanelData() itemRewardGrid[i]:OnOpen(false,conFigData.BaseReward[i],1.1,false,false,false,sortingOrder) end Util.AddOnceClick(this.buyBtn, function() - if shopItemData.buyTimes <= 0 then - if AppConst.isSDKLogin then - PayManager.Pay({ Id = conFigData.Id }) - else - NetManager.RequestBuyGiftGoods(conFigData.Id, function() - FirstRechargeManager.RefreshAccumRechargeValue(conFigData.Id) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, conFigData.Id) - this.OnShowPanelData() - end) - end - end + PayManager.Pay(conFigData.Id, function(id) + this.RechargeSuccessFunc(id) + end) end) this.RemainTimeDown(this.timeGo,this.time,shopItemData.endTime - GetTimeStamp()) end diff --git a/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftTwoView.lua b/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftTwoView.lua index 077661ca50..122bb6189c 100644 --- a/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftTwoView.lua +++ b/Assets/ManagedResources/~Lua/Modules/FindFairy/View/FindFairy_GiftTwoView.lua @@ -25,11 +25,9 @@ function this:BindEvent() end function this:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end function this:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) end function this:OnShow(_sortingOrder) @@ -90,15 +88,9 @@ function this.OnShowPanelData(i) Util.AddOnceClick(buyBtn, function() if shopItemData.buyTimes <= 0 then - if AppConst.isSDKLogin then - PayManager.Pay({ Id = conFigData.Id }) - else - NetManager.RequestBuyGiftGoods(conFigData.Id, function() - FirstRechargeManager.RefreshAccumRechargeValue(conFigData.Id) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, conFigData.Id) - this.OnShowPanel() - end) - end + PayManager.Pay(conFigData.Id, function(id) + this.RechargeSuccessFunc(id) + end) end end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Guild/RedPacketView/RedPacket_SendView.lua b/Assets/ManagedResources/~Lua/Modules/Guild/RedPacketView/RedPacket_SendView.lua index 6dc5267fcd..110718731e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Guild/RedPacketView/RedPacket_SendView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Guild/RedPacketView/RedPacket_SendView.lua @@ -108,12 +108,10 @@ function this:BindEvent() end function this:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.InitView) end function this:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc) Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.InitView) end @@ -178,17 +176,9 @@ function this.SetInfo(id) Util.AddOnceClick(this.sendBtn,function() if surplusNum<1 then return end local recharge=ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,index[id]) - if AppConst.isSDKLogin then - PayManager.Pay({ Id = recharge.Id}) - else - NetManager.RequestBuyGiftGoods(recharge.Id, function() - FirstRechargeManager.RefreshAccumRechargeValue(recharge.Id) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.GuildRedPacket, recharge.Id) - this.SetInfo(curIndex) - PopupTipPanel.ShowTip(string.format( Language[11078],redpack.Name)) - ChatManager.RequestSendRedPacket(curIndex) - end) - end + PayManager.Pay(recharge.Id, function(id) + this.RechargeSuccessFunc(id) + end) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/GiftPackPage.lua b/Assets/ManagedResources/~Lua/Modules/Operating/GiftPackPage.lua index c4855423b3..a12c6eba19 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/GiftPackPage.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/GiftPackPage.lua @@ -487,16 +487,12 @@ function GiftPackPage:RefreshShowData(item, data, type, DataTypeIndex) self:BuyAction(costId, finalNum, SHOP_TYPE.FINDTREASURE_GIFT, data.id, type) else --直购商品 - if AppConst.isSDKLogin then - PayManager.Pay({ Id = data.goodsId }) - else - NetManager.RequestBuyGiftGoods(data.goodsId, function() - FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) - OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) - self:RefreshGiftData(type) - CheckRedPointStatus(RedPointType.DailyGift) - end) - end + PayManager.Pay(data.goodsId, function(id) + FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) + OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) + self:RefreshGiftData(type) + CheckRedPointStatus(RedPointType.DailyGift) + end) end end end) diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/GrowthGiftPage.lua b/Assets/ManagedResources/~Lua/Modules/Operating/GrowthGiftPage.lua index 2c551db03b..d13be76492 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/GrowthGiftPage.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/GrowthGiftPage.lua @@ -251,16 +251,9 @@ function GrowthGiftPage:OnBtnInvestClicked() end function GrowthGiftPage:RequestBuy() local giftGoodsInfo = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.GrowthReward, curGiftsId) - if AppConst.isSDKLogin then - PayManager.Pay({Id = giftGoodsInfo.goodsId}) - else - NetManager.RequestBuyGiftGoods(giftGoodsInfo.goodsId,function(respond) - -- PopupTipPanel.ShowTip("奖励已发送到邮件,请前往领取") - -- FirstRechargeManager.RefreshAccumRechargeValue( giftGoodsInfo.goodsId) - lastGiftId = curGiftsId - self:RefreshStatus() - end) - end + PayManager.Pay(giftGoodsInfo.goodsId, function(id) + self:RefreshStatus() + end) end function GrowthGiftPage:RefreshStatus() diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/UppperMonthCard.lua b/Assets/ManagedResources/~Lua/Modules/Operating/UppperMonthCard.lua index 18455c18e8..c0a90fa562 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/UppperMonthCard.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/UppperMonthCard.lua @@ -89,29 +89,18 @@ function UpperMonthCard:BindEvent() JumpManager.GoJump(36004) end, Language[10719], Language[10023],nil, false) else - if AppConst.isSDKLogin then - PayManager.Pay({ Id = self.baseType }) - else - Log(Language[11489] .. self.baseType) - NetManager.RequestBuyGiftGoods(self.baseType, function() - self:RechargeSuccessFunc(self.baseType) - Log(Language[10545]) - - - end) - end - + PayManager.Pay(self.baseType, function(id) + self:RechargeSuccessFunc(id) + end) end end) end function UpperMonthCard:AddEvent() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self) end function UpperMonthCard:RemoveEvent() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self) end function UpperMonthCard:OnShow(parentSorting, arg, pageIndex) diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua b/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua index 9740aeff30..7548aa78fb 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/WeekMonthGiftPackPage.lua @@ -165,15 +165,11 @@ function WeekMonthGiftPackPage:RefreshShowData(item, data) PopupTipPanel.ShowTip(Language[10540]) else --直购商品 - if AppConst.isSDKLogin then - PayManager.Pay({ Id = data.goodsId }) - else - NetManager.RequestBuyGiftGoods(data.goodsId, function() - FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) - self:RefreshGiftData() - CheckRedPointStatus(RedPointType.DailyGift) - end) - end + PayManager.Pay(data.goodsId, function(id) + FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) + self:RefreshGiftData() + CheckRedPointStatus(RedPointType.DailyGift) + end) end end) diff --git a/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua b/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua index 5163ab301a..959f58b1a8 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua @@ -10,7 +10,7 @@ local this = PayManager --初始化 function this.Initialize() - + Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.onSdkPayResult) end ----- 请求支付 ----- @param context @@ -18,7 +18,38 @@ end ---- Id, -- required, 商品ID ---- BuyNum, -- optional, 购买个数(默认1) ---- } -function this.Pay(context) +---- +---- + +this.EventTrigger = {} +function this.onSdkPayResult(id) + if this.EventTrigger[id] then + this.EventTrigger[id](id) + this.EventTrigger[id] = nil + end +end + +function this.Pay(id, func) + if not func then + func = function()end + end + if this.EventTrigger[id] then + PopupTipPanel.ShowTip("您有一个相同的订单正在处理,请稍后再试") + return + end + this.EventTrigger[id] = func + --直购商品 + if AppConst.isSDKLogin then + PayManager.SdkPay({ Id = id }) + else + NetManager.RequestBuyGiftGoods(id, function(msg) + this.onSdkPayResult(id) + end) + end +end + + +function this.SdkPay(context) local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, context.Id) local payData = table.clone(context) payData.Name = rechargeConfig.Name diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_HeavenUnlockExtraRewardPanel.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_HeavenUnlockExtraRewardPanel.lua index bb9d13979e..143d3596aa 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_HeavenUnlockExtraRewardPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_HeavenUnlockExtraRewardPanel.lua @@ -33,13 +33,9 @@ function this:BindEvent() parent:ClosePanel() end) Util.AddOnceClick(this.dealBtn,function() - if AppConst.isSDKLogin then - PayManager.Pay({Id = type[curType].id}) - else - NetManager.RequestBuyGiftGoods(type[curType].id,function() - this.RechargeSuccessFunc() - end) - end + PayManager.Pay(type[curType].id, function(id) + this.RechargeSuccessFunc() + end) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua b/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua index 747058d9ba..41147ce92f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua @@ -70,18 +70,14 @@ end function GiftView:BindEvent() Util.AddClick(self.buyAllBtn,function () - if AppConst.isSDKLogin then - PayManager.Pay({ Id = 1004 }) - else - NetManager.RequestBuyGiftGoods(1004, function() - FirstRechargeManager.RefreshAccumRechargeValue(1004) - PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) - CheckRedPointStatus(RedPointType.DailyGift) - CheckRedPointStatus(RedPointType.GrowthPackage) - timerList={} - self:RefreshGiftData() - end) - end + PayManager.Pay(1004, function(id) + FirstRechargeManager.RefreshAccumRechargeValue(1004) + PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) + CheckRedPointStatus(RedPointType.DailyGift) + CheckRedPointStatus(RedPointType.GrowthPackage) + timerList={} + self:RefreshGiftData() + end) end) end @@ -544,18 +540,14 @@ function GiftView:RefreshShowData(item, data, buyType, DataTypeIndex) CheckRedPointStatus(RedPointType.GrowthPackage) else --直购商品 - if AppConst.isSDKLogin then - PayManager.Pay({ Id = data.goodsId }) - else - NetManager.RequestBuyGiftGoods(data.goodsId, function() - FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) - PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) - CheckRedPointStatus(RedPointType.DailyGift) - CheckRedPointStatus(RedPointType.GrowthPackage) - timerList={} - self:RefreshGiftData() - end) - end + PayManager.Pay( data.goodsId, function(id) + FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) + PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) + CheckRedPointStatus(RedPointType.DailyGift) + CheckRedPointStatus(RedPointType.GrowthPackage) + timerList={} + self:RefreshGiftData() + end) end end end) diff --git a/Assets/ManagedResources/~Lua/Modules/TreasureOfHeaven/HeavenUnlockExtraRewardPanel.lua b/Assets/ManagedResources/~Lua/Modules/TreasureOfHeaven/HeavenUnlockExtraRewardPanel.lua index d567214412..43450f0109 100644 --- a/Assets/ManagedResources/~Lua/Modules/TreasureOfHeaven/HeavenUnlockExtraRewardPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/TreasureOfHeaven/HeavenUnlockExtraRewardPanel.lua @@ -32,13 +32,9 @@ function HeavenUnlockExtraRewardPanel:BindEvent() this:ClosePanel() end) Util.AddOnceClick(this.dealBtn,function() - if AppConst.isSDKLogin then - PayManager.Pay({Id = type[curType].id}) - else - NetManager.RequestBuyGiftGoods(type[curType].id,function() - this.RechargeSuccessFunc() - end) - end + PayManager.Pay(type[curType].id, function(id) + this.RechargeSuccessFunc() + end) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/TreasureOfSomebody/UnlockExtraRewardPanel.lua b/Assets/ManagedResources/~Lua/Modules/TreasureOfSomebody/UnlockExtraRewardPanel.lua index fc55b0d039..87569a7a00 100644 --- a/Assets/ManagedResources/~Lua/Modules/TreasureOfSomebody/UnlockExtraRewardPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/TreasureOfSomebody/UnlockExtraRewardPanel.lua @@ -24,7 +24,6 @@ end function UnlockExtraRewardPanel:BindEvent() Util.AddClick(self.closeBtn, function() - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self) self:ClosePanel() end) Util.AddClick(self.dealBtn, function() @@ -42,7 +41,6 @@ function UnlockExtraRewardPanel:OnOpen(goodsId,context) end function UnlockExtraRewardPanel:OnShow() - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self) self:SetCostValues() end @@ -66,13 +64,9 @@ function UnlockExtraRewardPanel:OnDealBtnClicked() -- self:ClosePanel() -- end) -- end) - if AppConst.isSDKLogin then - PayManager.Pay({ Id = self.goodsId }) - else - NetManager.RequestBuyGiftGoods(self.goodsId, function() - self:RechargeSuccessFunc(self.goodsId) - end) - end + PayManager.Pay(self.goodsId, function(id) + self:RechargeSuccessFunc(id) + end) end --充值成功的回调 diff --git a/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua b/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua index 19ef6a21c4..5b22325730 100644 --- a/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua @@ -40,24 +40,19 @@ function this:BindEvent() end) Util.AddClick(this.btnBuy,function() - if AppConst.isSDKLogin then - PayManager.Pay({ Id = curGiftId }) - else - LogBlue("curGiftId:"..curGiftId) - NetManager.RequestBuyGiftGoods(curGiftId, function() - FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) - CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 - rechargeData.dynamicBuyTimes = rechargeData.dynamicBuyTimes - 1 - --判断可购买次数是否为零,是剔除礼包信息 - -- for i = 1, #curGiftList do - if rechargeData.dynamicBuyTimes < 1 then - OperatingManager.SetHadBuyGoodsId({curGiftId}) - OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId) - end - -- end - this:Refresh() - end) + PayManager.Pay(curGiftId, function(id) + FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) + CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 + rechargeData.dynamicBuyTimes = rechargeData.dynamicBuyTimes - 1 + --判断可购买次数是否为零,是剔除礼包信息 + -- for i = 1, #curGiftList do + if rechargeData.dynamicBuyTimes < 1 then + OperatingManager.SetHadBuyGoodsId({curGiftId}) + OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId) end + -- end + this:Refresh() + end) end) Util.AddClick(this.arrowsLeft,function() diff --git a/Assets/ManagedResources/~Lua/View/ShopView.lua b/Assets/ManagedResources/~Lua/View/ShopView.lua index 9ffa7b58b9..4f4177ee27 100644 --- a/Assets/ManagedResources/~Lua/View/ShopView.lua +++ b/Assets/ManagedResources/~Lua/View/ShopView.lua @@ -118,12 +118,10 @@ end --添加事件监听(用于子类重写) function this:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self) - Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self) end --移除事件监听(用于子类重写) function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self) - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self) end --界面打开时调用(用于子类重写) function this:OnOpen(...) @@ -545,15 +543,9 @@ function this:RechargeShopItemAdapter(shopItem, itemData) -- 购买事件 Util.AddOnceClick(shopItem, function() - if AppConst.isSDKLogin then - PayManager.Pay({ Id = itemData.goodsId }) - else - NetManager.RequestBuyGiftGoods(itemData.goodsId, function() - self:RechargeSuccessFunc(itemData.goodsId) - PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) - CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包红点检测 - end) - end + PayManager.Pay(itemData.goodsId, function(id) + self:RechargeSuccessFunc(itemData.goodsId) + end) end) end @@ -563,6 +555,8 @@ function this:RechargeSuccessFunc(id) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id) self:RefreshShopInfo(false, false) --PopupTipPanel.ShowTip("购买成功,请到邮箱中领取!") + PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) + CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包红点检测 end ---=====================================对外接口=============================----