[bt]=====太初特权修改

dev_chengFeng
wangzhenxing 2022-11-22 18:08:25 +08:00
parent 4b4ed9f63a
commit 9982bc0df8
1 changed files with 59 additions and 28 deletions

View File

@ -1,5 +1,6 @@
GiftPre = {}
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
local parent
function GiftPre:New(gameObject)
@ -99,27 +100,41 @@ function GiftPre:BindEvent()
Util.AddOnceClick(self.btnBuy, function()
if self.isCanBuy == 1 then -- 0 可购买 1购买条件不足 2已购买
if self.gmConfig then
if self.gmConfig.Unlock[1][1]==4 then
local sureFunc=function()
JumpManager.GoJump(36010)
for i = 1, #self.gmConfig.Unlock do
local can,str=CheckGMIsOpen(self.gmConfig.Unlock[i][1],self.gmConfig.Unlock[i][2])
if not can then
if self.gmConfig.Unlock[i][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)
return
elseif self.gmConfig.Unlock[i][1]==5 then
if rechargeConfig[self.gmConfig.Unlock[i][2]].Type==21 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)
return
else
PopupTipPanel.ShowTip(str)
return
end
end
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
end
else
PopupTipPanel.ShowTip(Language[11701])
end
@ -163,9 +178,11 @@ function GiftPre:BuyAction(costId, costNum, shopType, itemId)
else
local func = function(shopType, itemId)
ShopManager.RequestBuyShopItem(shopType, itemId, 1, function()
self.isCanBuy=0
self.parent:RefreshData(nil,false,false)
CheckRedPointStatus(RedPointType.DailyGift)
CheckRedPointStatus(RedPointType.GrowthPackage)
if shopType==20 and (itemId==1107 or itemId==1110 or itemId==1111 or itemId==1108 )then
PlayerPrefs.SetString(PlayerManager.uid..PlayerManager.serverInfo.server_id.."supermeMan",666)
end
@ -384,21 +401,29 @@ function GiftPre:SetIsCanBuy()
if self.data.DataType == DataType.Shop and self.data.buyType == SHOP_TYPE.VIP_GIFT then
isCanBuy = (rechargeNum >= self.data.data.shopItemData.BuyRule[2] and 0 or 1)
--LogGreen("isCanBuy:"..isCanBuy)
if isCanBuy == 0 then
self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuongse")
else
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
if #self.gmConfig.Unlock>1 then
--LogError("self.gmConfig.Unlock[2][1]=="..self.gmConfig.Unlock[2][1].." self.gmConfig.Unlock[2][2]=="..self.gmConfig.Unlock[2][2])
local isCan2=CheckGMIsOpen(self.gmConfig.Unlock[2][1],self.gmConfig.Unlock[2][2])
if isCan2 then
isCanBuy=0
else
isCanBuy=1
end
end
--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
@ -406,6 +431,11 @@ function GiftPre:SetIsCanBuy()
isCanBuy = self.data.data.state == 0 and 0 or 2
end
end
if isCanBuy == 0 then
self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuongse")
else
self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuangse")
end
return isCanBuy
end
@ -440,7 +470,7 @@ function GiftPre:SetBtn(_itemdata)
self.btnBuy:GetComponent("Button").interactable = (self.isCanBuy == 0 or self.isCanBuy == 1)
--设置icon
self:SetIcon()
Util.SetGray(self.btnBuy, self.isCanBuy ~= 0)
--设置按钮提示 -- 已经购买不显示(特权礼包需要显示时间)
self.buyInfo.text = self.isCanBuy == 2 and "" or _itemdata.data.buyInfo
if self.isCanBuy == 2 then
@ -472,7 +502,8 @@ function GiftPre:SetBtn(_itemdata)
else
self.redPoint.gameObject:SetActive(false)
end
Util.SetGray(self.btnBuy, (self.isCanBuy ~= 0))
LogError("self.isCanBuy============"..self.isCanBuy)
ForceRebuildLayout(self.btnBuy.transform)
end