From f697f7893b332f1d6d5574fb59334521dc964b60 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Thu, 3 Nov 2022 17:39:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=B9=E6=9D=83=E5=95=86=E5=BA=97=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Common/functions.lua | 2 + .../~Lua/Modules/Recharge/View/GiftPre.lua | 45 ++++++++++++++++--- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Common/functions.lua b/Assets/ManagedResources/~Lua/Common/functions.lua index db4406e773..352e6dc2f6 100644 --- a/Assets/ManagedResources/~Lua/Common/functions.lua +++ b/Assets/ManagedResources/~Lua/Common/functions.lua @@ -2769,6 +2769,8 @@ function CheckGMIsOpen(type,value) return true elseif type==4 then return VipManager.GetChargedNum()>=value + elseif type==5 then + return OperatingManager.IsBuyGift(value) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftPre.lua b/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftPre.lua index 97b7fc394d..9f04021bac 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftPre.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftPre.lua @@ -1,6 +1,7 @@ GiftPre = {} local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local parent + function GiftPre:New(gameObject) local b = {} b.gameObject = gameObject @@ -47,6 +48,7 @@ function GiftPre:InitComponent() self.type1Text3 = Util.GetGameObject(self.type1, "text3"):GetComponent("Text") self.numGrid = Util.GetGameObject(self.type1, "NumTextPre") self.numList = {} + self.gmConfig=nil for i = 1, self.numGrid.transform.childCount do table.insert(self.numList,self.numGrid.transform:GetChild(i-1):GetComponent("Text")) end @@ -96,7 +98,31 @@ end function GiftPre:BindEvent() Util.AddOnceClick(self.btnBuy, function() if self.isCanBuy == 1 then -- 0 可购买 1购买条件不足 2已购买 - PopupTipPanel.ShowTip(Language[11701]) + if self.gmConfig then + if self.gmConfig.Unlock[1][1]==4 then + local sureFunc=function() + JumpManager.GoJump(36010) + end + local args={} + args[1]="累充金额不满足条件,是否前往充值" + args[2]="我要升级" + args[3]="取消" + args[4]=sureFunc + UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args) + elseif self.gmConfig.Unlock[1][1]==5 then + local sureFunc=function() + UIManager.OpenPanel(UIName.GMShuaChongTeQuan) + end + local args={} + args[1]="GM等级不满足条件,是否前往提升GM等级" + args[2]="我要升级" + args[3]="取消" + args[4]=sureFunc + UIManager.OpenPanel(UIName.GMCommonConfirmPanel,args) + end + else + PopupTipPanel.ShowTip(Language[11701]) + end elseif self.isCanBuy == 2 then PopupTipPanel.ShowTip(Language[10515]) else @@ -364,6 +390,15 @@ function GiftPre:SetIsCanBuy() self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuangse") end end + if self.data.data.shopItemData.ShowType==17 then + self.gmConfig=ConfigManager.GetConfigDataByKey(ConfigName.GMMaster,"PackID",self.data.data.shopData.goodsId) + local isCan=CheckGMIsOpen(self.gmConfig.Unlock[1][1],self.gmConfig.Unlock[1][2]) + if isCan then + isCanBuy=0 + else + isCanBuy=1 + end + end if isCanBuy == 0 then --LogError("self.data.data.limitNum=="..self.data.data.limitNum.." self.data.data.boughtNum=="..self.data.data.boughtNum) isCanBuy = (self.data.data.limitNum - self.data.data.boughtNum > 0) and 0 or 2 @@ -388,10 +423,10 @@ function GiftPre:SetIcon() self.icon.gameObject:SetActive(true) self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[self.data.data.shopItemData.Cost[1][1]].ResourceID)) elseif self.data.data.shopItemData.ShowType==17 then - local gmConfig=ConfigManager.GetConfigDataByKey(ConfigName.GMMaster,"PackID",self.data.data.shopData.goodsId) + --gmConfig=ConfigManager.GetConfigDataByKey(ConfigName.GMMaster,"PackID",self.data.data.shopData.goodsId) self.icon.gameObject:SetActive(true) - self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[gmConfig.Price[1][1]].ResourceID)) - self.price.text = gmConfig.Price[1][2] + self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[self.gmConfig.Price[1][1]].ResourceID)) + self.price.text = self.gmConfig.Price[1][2] else self.icon.gameObject:SetActive(false) end @@ -437,7 +472,7 @@ function GiftPre:SetBtn(_itemdata) else self.redPoint.gameObject:SetActive(false) end - Util.SetGray(self.btnBuy, (self.isCanBuy == 2)) + Util.SetGray(self.btnBuy, (self.isCanBuy ~= 0)) ForceRebuildLayout(self.btnBuy.transform) end