[灵兽宝阁]=====添加妖晶召唤上限

dev_chengFeng
wangzhenxing 2022-08-04 16:40:37 +08:00
parent 614239f7ce
commit 5741d68dd3
3 changed files with 49 additions and 24 deletions

View File

@ -185,13 +185,17 @@ function LingShouBaoGe:SetData()
end end
end end
local maxMoneyId
function LingShouBaoGe:refreshBtnShow() function LingShouBaoGe:refreshBtnShow()
--下方的数量显示 --下方的数量显示
local maxtimesId=lotterySetting[self.singleRecruit.Id].MaxTimes local maxtimesId=lotterySetting[self.singleRecruit.Id].MoneyTimes
local curTimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId) maxMoneyId=lotterySetting[self.singleRecruit.Id].MoneyTimes
self.upper.text = Language[10483]..curTimes.."/"..privilegeConfig[maxtimesId].Condition[1][2]--召唤上限 -- local curTimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
local curTimes=PrivilegeManager.GetPrivilegeRemainValue(maxtimesId)
self.upper.text ="今日妖晶召唤上限"..curTimes.."/"..privilegeConfig[maxtimesId].Condition[1][2]--召唤上限
--if curTimes==0 then
maxtimesId=lotterySetting[self.singleRecruit.Id].MaxTimes
--end
--是否是免费抽 --是否是免费抽
local freeTimesId=lotterySetting[self.singleRecruit.Id].FreeTimes local freeTimesId=lotterySetting[self.singleRecruit.Id].FreeTimes
@ -218,8 +222,10 @@ function LingShouBaoGe:refreshBtnShow()
local type = 0 local type = 0
type = n == bType.Btn1 and self.singleRecruit.Id or self.tenRecruit.Id type = n == bType.Btn1 and self.singleRecruit.Id or self.tenRecruit.Id
local d = RecruitManager.GetExpendData(type) local str=n == bType.Btn1 and self.singleRecruit.CostItem or self.tenRecruit.CostItem
--local d = RecruitManager.GetExpendData(type)
local d = RecruitManager.GetExpendDataByCostItem(str,n,curTimes)
local payId=0
if isFree then if isFree then
info.text=" "..Language[10493] info.text=" "..Language[10493]
else else
@ -228,18 +234,22 @@ function LingShouBaoGe:refreshBtnShow()
icon.sprite = self.spLoader:LoadSprite(artResourcesConfig[itemConfig[itemId].ResourceID].Name) icon.sprite = self.spLoader:LoadSprite(artResourcesConfig[itemConfig[itemId].ResourceID].Name)
info.text = m.isInfo info.text = m.isInfo
num.text = itemNum num.text = itemNum
if itemId==16 then
payId=maxMoneyId
else
payId=maxtimesId
end
end end
Util.AddOnceClick(btn,function() Util.AddOnceClick(btn,function()
local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.BaoGeTen) local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.BaoGeTen)
if n == bType.Btn1 then if n == bType.Btn1 then
if isFree then if isFree then
self:Recruit(type,maxtimesId,0,0,state,freeTimesId,{RecruitType.BaoGeSingle,RecruitType.BaoGeTen}) self:Recruit(type,payId,0,0,state,freeTimesId,{RecruitType.BaoGeSingle,RecruitType.BaoGeTen})
else else
self:Recruit(type,maxtimesId,itemId,itemNum,state,freeTimesId,{RecruitType.BaoGeSingle,RecruitType.BaoGeTen}) self:Recruit(type,payId,itemId,itemNum,state,freeTimesId,{RecruitType.BaoGeSingle,RecruitType.BaoGeTen})
end end
elseif n==bType.Btn10 then elseif n==bType.Btn10 then
self:Recruit(type,maxtimesId,itemId,itemNum,state,freeTimesId,{RecruitType.BaoGeTen,RecruitType.BaoGeTen}) self:Recruit(type,payId,itemId,itemNum,state,freeTimesId,{RecruitType.BaoGeTen,RecruitType.BaoGeTen})
end end
end) end)
end end
@ -247,11 +257,11 @@ end
function LingShouBaoGe:Recruit(id,RecruitMaxtimesId,itemId,itemNum,state,freeTimesId,recruitType) function LingShouBaoGe:Recruit(id,RecruitMaxtimesId,itemId,itemNum,state,freeTimesId,recruitType)
local num = id%2 == 0 and 1 or 10 local num = id%2 == 0 and 1 or 10
--是否超过每日最大上限 -- --是否超过每日最大上限
if PrivilegeManager.GetPrivilegeRemainValue(RecruitMaxtimesId) < num then -- if PrivilegeManager.GetPrivilegeRemainValue(RecruitMaxtimesId) < num then
PopupTipPanel.ShowTip(Language[10485]) -- PopupTipPanel.ShowTip(Language[10485])
return -- return
end -- end
if itemId ~= 0 then if itemId ~= 0 then
if BagManager.GetItemCountById(itemId) < itemNum then if BagManager.GetItemCountById(itemId) < itemNum then
PopupTipPanel.ShowTip(GetLanguageStrById(itemConfig[itemId].Name)..Language[10486]) PopupTipPanel.ShowTip(GetLanguageStrById(itemConfig[itemId].Name)..Language[10486])
@ -262,7 +272,7 @@ function LingShouBaoGe:Recruit(id,RecruitMaxtimesId,itemId,itemNum,state,freeTim
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,id, UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,id,
function() function()
RecruitManager.RecruitRequest(id,function(msg) RecruitManager.RecruitRequest(id,function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(RecruitMaxtimesId,num) PrivilegeManager.RefreshPrivilegeUsedTimes(maxMoneyId,num)
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,id,msg.drop,self.activityId,recruitType,function () UIManager.OpenPanel(UIName.PokemonSingleResultPanel,id,msg.drop,self.activityId,recruitType,function ()
self:Refresh() self:Refresh()
end) end)

View File

@ -108,6 +108,7 @@ function LingShouBaoGeOneResultPanel:OnOpen(...)
local currLottery= ConfigManager.GetConfigData(ConfigName.LotterySetting,singleRecruit.Id) local currLottery= ConfigManager.GetConfigData(ConfigName.LotterySetting,singleRecruit.Id)
freeTimesId=currLottery.FreeTimes freeTimesId=currLottery.FreeTimes
RecruitMaxtimesId = currLottery.MaxTimes RecruitMaxtimesId = currLottery.MaxTimes
local curTimes=PrivilegeManager.GetPrivilegeRemainValue(currLottery.MoneyTimes)
local freeTime=0 local freeTime=0
if freeTimesId>0 then if freeTimesId>0 then
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId) freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
@ -124,10 +125,12 @@ function LingShouBaoGeOneResultPanel:OnOpen(...)
this.itemIcon3.gameObject:SetActive(true) this.itemIcon3.gameObject:SetActive(true)
this.itemInfo3.text=Language[10490] this.itemInfo3.text=Language[10490]
itemId=0 itemId=0
local d = RecruitManager.GetExpendData(this.recruitType) local d = RecruitManager.GetExpendDataByCostItem(currLottery.CostItem,1,curTimes)
itemId = d[1] itemId = d[1]
itemNum = d[2] itemNum = d[2]
if itemId==16 then
RecruitMaxtimesId =currLottery.MoneyTimes
end
this.tipText.gameObject:SetActive(false) this.tipText.gameObject:SetActive(false)
this.itemIcon3.sprite=this.spLoader:LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name) this.itemIcon3.sprite=this.spLoader:LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name)
this.itemNum3.text= "×"..itemNum this.itemNum3.text= "×"..itemNum

View File

@ -20,6 +20,7 @@ this.contentList={}
this.contentListParent={} this.contentListParent={}
this.isElementDrawPanel=false this.isElementDrawPanel=false
local orginLayer local orginLayer
local lotteryConfig
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function LingShouBaoGeTenResultPanel:InitComponent() function LingShouBaoGeTenResultPanel:InitComponent()
this.spLoader = SpriteLoader.New() this.spLoader = SpriteLoader.New()
@ -48,7 +49,7 @@ function LingShouBaoGeTenResultPanel:InitComponent()
end end
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft, panelType = PanelType.LingShouBaoGe }) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft, panelType = PanelType.LingShouBaoGe })
end end
local maxTimesId=0
--绑定事件(用于子类重写) --绑定事件(用于子类重写)
function LingShouBaoGeTenResultPanel:BindEvent() function LingShouBaoGeTenResultPanel:BindEvent()
@ -57,8 +58,10 @@ function LingShouBaoGeTenResultPanel:BindEvent()
self:ClosePanel() self:ClosePanel()
end) end)
Util.AddClick(this.openTenAgainButton, function () Util.AddClick(this.openTenAgainButton, function ()
local d=RecruitManager.GetExpendData(this.recruitType) --local d=RecruitManager.GetExpendData(this.recruitType)
local maxTimesId = lotterySetting[singleRecruit.Id].MaxTimes local curTimes=PrivilegeManager.GetPrivilegeRemainValue(lotteryConfig.MoneyTimes)
local d=RecruitManager.GetExpendDataByCostItem(lotteryConfig.CostItem,2,curTimes)
-- maxTimesId = lotterySetting[singleRecruit.Id].MaxTimes
local freeTimesId = lotterySetting[singleRecruit.Id].FreeTimes local freeTimesId = lotterySetting[singleRecruit.Id].FreeTimes
--是否超过每日最大上限 --是否超过每日最大上限
if PrivilegeManager.GetPrivilegeRemainValue(maxTimesId) < 10 then if PrivilegeManager.GetPrivilegeRemainValue(maxTimesId) < 10 then
@ -121,15 +124,24 @@ function LingShouBaoGeTenResultPanel:OnOpen(...)
this.content1:SetActive(false) this.content1:SetActive(false)
this.content2:SetActive(false) this.content2:SetActive(false)
this.content3:SetActive(true) this.content3:SetActive(true)
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId) local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
singleRecruit = array[1] singleRecruit = array[1]
tenRecruit = array[2] tenRecruit = array[2]
lotteryConfig=lotterySetting[this.recruitType]
local d local d
d = RecruitManager.GetExpendData(this.recruitType) --d = RecruitManager.GetExpendData(this.recruitType)
maxTimesId=lotteryConfig.MoneyTimes
local curTimes=PrivilegeManager.GetPrivilegeRemainValue(maxTimesId)
if curTimes==0 then
maxTimesId=lotteryConfig.MaxTimes
end
d=RecruitManager.GetExpendDataByCostItem(lotteryConfig.CostItem,2,curTimes)
itemId = d[1] itemId = d[1]
itemNum = d[2] itemNum = d[2]
if itemId~=16 then
maxTimesId=lotteryConfig.MaxTimes
end
this.itemIcon3.sprite=this.spLoader:LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name) this.itemIcon3.sprite=this.spLoader:LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name)
this.tipText.gameObject:SetActive(false) this.tipText.gameObject:SetActive(false)