【灵兽宝阁】抽卡逻辑完善了

dev_chengFeng
ZhangBiao 2020-11-11 16:53:04 +08:00
parent d493246f2f
commit 1ba753044f
9 changed files with 1975 additions and 1302 deletions

View File

@ -1074,6 +1074,8 @@ ActivityTypeDef = {
EightDayGift = 56,--八日登陆
SignInfo = 57,--三日七日签到
Celebration = 60,--主题活动 社稷大典
ShenYiTianJiang = 71, --神衣天降
LingShouBaoGe = 100,--灵兽宝阁
--主题活动
FindFairy=43,--限时招募
@ -1086,7 +1088,6 @@ ActivityTypeDef = {
TreasureStore = 6000,--百宝商会
YiJingBaoKu = 8000,--易经宝库
ShenYiTianJiang = 71, --神衣天降
}
--活动结束需要处理面板关闭类型

View File

@ -355,6 +355,8 @@ UIName = {
PokemonSingleResultPanel=354,--灵兽
GeneralRewardPopup = 355,--通用奖励领取弹窗
GeneralBigPopup = 357,--通用大弹窗界面
LingShouBaoGeOneResultPanel = 358,--灵兽宝阁单抽
LingShouBaoGeTenResultPanel = 359,--灵兽宝阁十抽
}
SubUIConfig = {

View File

@ -3,17 +3,25 @@ local this = LingShouBaoGe
local ActivityDetail = require("Modules/DynamicActivity/ActivityDetail")--活动详情
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local activityId = 0
local singleRecruit = nil
local tenRecruit = nil
local sortingOrder = 0
local parent
local freeTime= 0 --免费抽取次数
local ActData=nil
--按钮类型
local bType={
Btn1=1,
Btn10=2
}
--type与lotterySetting表中的id对应
local btns={ [bType.Btn1]={name="Btn1",isInfo="1次"}, [bType.Btn10]={name="Btn10",isInfo="10次"}}
function LingShouBaoGe:ctor(mainPanel, gameObject)
this.mainPanel = mainPanel
@ -26,13 +34,18 @@ function LingShouBaoGe:InitComponent(gameObject)
this.helpBtn = Util.GetGameObject(this.gameObject,"help")
this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition
this.priview = Util.GetGameObject(this.gameObject,"priview")
this.detailBtn = Util.GetGameObject(this.gameObject,"detailBtn")
this.preview = Util.GetGameObject(this.gameObject,"rightUp/preview")
this.change = Util.GetGameObject(this.gameObject,"rightUp/change")
this.detailBtn = Util.GetGameObject(this.gameObject,"rightUp/detailBtn")
this.upper=Util.GetGameObject(this.gameObject,"times"):GetComponent("Text") ---召唤上限
this.upper=Util.GetGameObject(this.gameObject,"bottom/times"):GetComponent("Text") ---召唤上限
this.tip1=Util.GetGameObject(this.gameObject,"bottom/Tip1"):GetComponent("Text") ---刷新时间
this.tip2=Util.GetGameObject(this.gameObject,"bottom/Tip2"):GetComponent("Text") ---必出
this.btnGroup=Util.GetGameObject(this.gameObject,"bottom/btngroup")
this.detail= Util.GetGameObject(this.gameObject, "detail")
this.detail.gameObject:SetActive(false)
end
function LingShouBaoGe:BindEvent()
@ -41,20 +54,25 @@ function LingShouBaoGe:BindEvent()
LogYellow("帮助按钮")
-- UIManager.OpenPanel(UIName.HelpPopup,activityType[activityId].helptype,this.helpPosition.x,this.helpPosition.y)
end)
-- Util.AddClick(this.detailBtn, function()
-- ActivityDetail.new(this.detail,3)
-- end)
Util.AddClick(this.detailBtn, function()
LogYellow("查看详情")
-- ActivityDetail.new(this.detail,3)
end)
Util.AddClick(this.change, function()
LogYellow("更改灵兽")
end)
-- Util.AddClick(this.preview, function()
-- local fb = ConfigManager.GetConfigData(ConfigName.FakeBattle, 1001)
-- local testFightData = {
-- fightData = loadstring("return "..fb.FightData)(),
-- fightSeed = fb.TimeSeed,
-- fightType = 0,
-- maxRound = 20
-- }
-- UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test)
-- end)
Util.AddClick(this.preview, function()
-- local fb = ConfigManager.GetConfigData(ConfigName.FakeBattle, 1001)
-- local testFightData = {
-- fightData = loadstring("return "..fb.FightData)(),
-- fightSeed = fb.TimeSeed,
-- fightType = 0,
-- maxRound = 20
-- }
-- UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test)
LogYellow("假战斗")
end)
end
function LingShouBaoGe:OnShow(_sortingOrder,_parent)
@ -62,116 +80,120 @@ function LingShouBaoGe:OnShow(_sortingOrder,_parent)
sortingOrder = _sortingOrder
this.gameObject:SetActive(true)
activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.QianKunBox)
this:Refresh()
end
function LingShouBaoGe:Refresh()
ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.LingShouBaoGe)
activityId = ActData.activityId
LogYellow("activityId:"..activityId)
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
singleRecruit = array[1]
tenRecruit = array[2]
this:refreshBtnShow()--刷新按钮显示
this:timeCountDown()--时间
this:TimeCountDown()--时间
end
function LingShouBaoGe:RefreshNextLevelReward()
local curLvstate = 0
local info= ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FindFairy)
local curTimes = 0
local data1 = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",activityId) --通过活动id获取阶段任务
local rewarditem
for n,m in ipairs(data1) do
curTimes,curLvstate = this:GetMissionStateById(m.Id,activityId)
if(curTimes>=m.Values[1][1]) then
if curLvstate==0 then
curLvstate=0
curLv=m.Id
rewarditem=m
break
end
else
curLvstate=2
curLv=m.Id
rewarditem=m
break
end
end
--所有任务都已完成
if not rewarditem then
curLvstate = -1
rewarditem = data1[#data1]
curLv=data1[#data1].Id
end
OperatingManager.TimeLimitedTimes = curTimes
if not itemView then
itemView= SubUIManager.Open(SubUIConfig.ItemView,this.nextReward.transform)
end
itemView:OnOpen(false, {rewarditem.Reward[1][1],rewarditem.Reward[1][2]}, 0.73, false)
itemView.gameObject:SetActive(true)
Util.GetGameObject(itemView.gameObject,"item/frame"):GetComponent("Button").enabled=false
if (curLvstate==0) then
-- this.slider.gameObject:SetActive(false)\
local temp = curTimes <= rewarditem.Values[1][1] and curTimes or rewarditem.Values[1][1]
Util.GetGameObject(this.slider.gameObject,"Text"):GetComponent("Text").text=temp.."/"..rewarditem.Values[1][1]
this.slider.value=temp /rewarditem.Values[1][1]
local vec=this.sliderText.transform:GetComponent("RectTransform").anchoredPosition3D
vec.y=22.4
this.sliderText.transform:GetComponent("RectTransform").anchoredPosition3D=vec
this.sliderText.text=Language[12183]
this.sliderText.fontSize=26
Util.AddOnceClick(this.getBtn,function()
NetManager.GetActivityRewardRequest(curLv, activityId,
function(respond)
UIManager.OpenPanel(UIName.RewardItemPopup, respond, 1)
this:RefreshNextLevelReward()
this:RefreshGetHeroTimes()
end)
end)
this.effect.gameObject:SetActive(true)
elseif (curLvstate==-1) then
this.slider.value=1
Util.GetGameObject(this.slider.gameObject,"Text"):GetComponent("Text").text="300/300"
this.sliderText.text=Language[12322]
Util.AddOnceClick(this.getBtn,function()
RewardPreview.new(this.reward)
end)
else
this.slider.gameObject:SetActive(true)
Util.GetGameObject(this.slider.gameObject,"Text"):GetComponent("Text").text=curTimes.."/"..rewarditem.Values[1][1]
local vec=this.sliderText.transform:GetComponent("RectTransform").anchoredPosition3D
vec.y=22.4
this.sliderText.transform:GetComponent("RectTransform").anchoredPosition3D = vec
this.sliderText.text=Language[12184]..curTimes.."/"..rewarditem.Values[1][1]
this.sliderText.fontSize=26
this.slider.value=curTimes/rewarditem.Values[1][1]
this.effect.gameObject:SetActive(false)
Util.AddOnceClick(this.getBtn,function()
RewardPreview.new(this.reward)
end)
end
function LingShouBaoGe:refreshBtnShow()
--下方的数量显示
local maxtimesId=lotterySetting[singleRecruit.Id].MaxTimes
local curTimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
this.upper.text = Language[12225]..curTimes.."/"..privilegeConfig[maxtimesId].Condition[1][2]--召唤上限
-- LogYellow("singleRecruit.Id:"..singleRecruit.Id)
-- LogYellow("lotterySetting[singleRecruit.Id].DiamondBoxContain[2]"..(lotterySetting[singleRecruit.Id].DiamondBoxContain[1][2]).." ActData.value"..ActData.value)
local leftTime = lotterySetting[singleRecruit.Id].DiamondBoxContain[1][2] - ActData.value
this.tip2.text = Language[11480].."<color=green>"..leftTime.."</color>次必出"
--是否是免费抽
local freeTimesId=lotterySetting[singleRecruit.Id].FreeTimes
if freeTimesId > 0 then
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId] = freeTime
end
LogYellow("freeTimesId:"..freeTimesId.." freeTime:"..freeTime.." curTimes:"..curTimes.." 上限:"..privilegeConfig[maxtimesId].Condition[1][2])
local reMaintimes = info.value
--LogBlue("reMaintimes:"..reMaintimes)
--LogGreen("singleRecruit.MergePool:"..singleRecruit.MergePool)
local totalTimes = ConfigManager.GetConfigDataByKey(ConfigName.LotterySpecialConfig,"Type",singleRecruit.MergePool).Count
reMaintimes = totalTimes - reMaintimes
if reMaintimes == 0 then
reMaintimes = totalTimes
end
--按钮赋值
for n, m in ipairs(btns) do
local btn = Util.GetGameObject(this.btnGroup,m.name)
local redPot = Util.GetGameObject(btn.gameObject,"RedPoint")
local info = Util.GetGameObject(btn.gameObject,"Content/Info"):GetComponent("Text")
local icon = Util.GetGameObject(btn.gameObject,"Content/Icon"):GetComponent("Image")
local num = Util.GetGameObject(btn.gameObject,"Content/Num"):GetComponent("Text")
--存在免费次数 并且 免费>=1 并且是1按钮
local isFree = freeTime and freeTime >= 1 and n == bType.Btn1
redPot.gameObject:SetActive(isFree)
icon.gameObject:SetActive(not isFree)
num.gameObject:SetActive(not isFree)
this.recruitTimesUpdate.text = string.format(Language[12229],reMaintimes)
local itemId=0
local itemNum=0
local type = 0
local timeDown = info.endTime - PlayerManager.serverTime
this.recruitTimeUpdate.text = string.format(Language[12230]..this:TimeToDHMS(timeDown))
Timer.New(function()
if timeDown < 1 then
this.recruitTimeUpdate.text = string.format(Language[12230]..this:TimeToDHMS(0))
type = n == bType.Btn1 and singleRecruit.Id or tenRecruit.Id
local d = RecruitManager.GetExpendData(type)
if isFree then
info.text=" "..Language[11759]
else
timeDown = timeDown - 1
this.recruitTimeUpdate.text = string.format(Language[12230]..this:TimeToDHMS(timeDown))
itemId = d[1]
itemNum = d[2]
icon.sprite = Util.LoadSprite(artResourcesConfig[itemConfig[itemId].ResourceID].Name)
info.text = m.isInfo
num.text = "x"..itemNum
end
end, 1, -1, true):Start()
Util.AddOnceClick(btn,function()
local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.LingShowTen)
LogYellow("type:"..type.." n:"..n.." state:"..state)
if n == bType.Btn1 then
if isFree then
self:Recruit(type,maxtimesId,0,0,state,freeTimesId)
else
self:Recruit(type,maxtimesId,itemId,itemNum,state,freeTimesId)
end
elseif n==bType.Btn10 then
self:Recruit(type,maxtimesId,itemId,itemNum,state,freeTimesId)
end
end)
end
end
function LingShouBaoGe:Recruit(id,RecruitMaxtimesId,itemId,itemNum,state,freeTimesId)
local generalType = id%2 == 0 and RecruitType.LingShowSingle or RecruitType.LingShowTen
local num = id%2 == 0 and 1 or 10
--是否超过每日最大上限
if PrivilegeManager.GetPrivilegeRemainValue(RecruitMaxtimesId) < num then
PopupTipPanel.ShowTip(Language[11760])
return
end
if itemId ~= 0 then
if BagManager.GetItemCountById(itemId) < itemNum then
PopupTipPanel.ShowTip(itemConfig[itemId].Name..Language[10492])
return
end
end
if itemId == 16 and state == 0 then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,generalType,
function()
RecruitManager.RecruitRequest(id,
function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(RecruitMaxtimesId,num)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,id,msg.drop,activityId)
this:Refresh()
end,freeTimesId,itemId,itemNum)
end,itemNum)
else
RecruitManager.RecruitRequest(id, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(RecruitMaxtimesId,num)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,id,msg.drop,activityId)
this:Refresh()
end,freeTimesId,itemId,itemNum)
end
end
--- 将一段时间转换为天时分秒
function LingShouBaoGe:TimeToDHMS(second)
local day = math.floor(second / (24 * 3600))
@ -185,115 +207,14 @@ function LingShouBaoGe:TimeToDHMS(second)
end
end
function LingShouBaoGe:GetMissionStateById(num,activityId)
local mission= ActivityGiftManager.GetActivityInfo(activityId,num) --从后端获取到的阶段数据
return mission.progress,mission.state
end
--刷新剩余次数
function LingShouBaoGe:RefreshGetHeroTimes()
local freeTimesId=lotterySetting[singleRecruit.Id].FreeTimes
local maxtimesId=lotterySetting[singleRecruit.Id].MaxTimes --lotterySetting表中的MaxTimes对应privilegeConfig表中的id
local curTimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
this.upper.text= Language[12225]..curTimes.."/"..privilegeConfig[maxtimesId].Condition[1][2]--特权上限
this.timeupdate.gameObject:SetActive(true)
local freeTime= 0
if freeTimesId>0 then
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
end
--按钮赋值
for n, m in ipairs(btns) do
local btn=Util.GetGameObject(this.gameObject,m.name)
local redPot=Util.GetGameObject(btn.gameObject,"redPoint")
local info=Util.GetGameObject(btn.gameObject,"layout/Text"):GetComponent("Text")
local icon=Util.GetGameObject(btn.gameObject,"layout/icon"):GetComponent("Image")
local num=Util.GetGameObject(btn.gameObject,"layout/num"):GetComponent("Text")
--存在免费次数 并且 免费>=1 并且是1按钮
local isFree=freeTime and freeTime >= 1 and n==bType.Btn1
redPot.gameObject:SetActive(isFree)
icon.gameObject:SetActive(not isFree)
num.gameObject:SetActive(not isFree)
if n==bType.Btn1 and isFree then
this.timeupdate.gameObject:SetActive(false)
end
local itemId=0
local itemNum=0
local type = 0
if n==bType.Btn1 then
type = singleRecruit.Id
else
type = tenRecruit.Id
end
local d=RecruitManager.GetExpendData(type)
if(isFree) then
info.text=Language[11759]
else
itemId=d[1]
itemNum=d[2]
icon.sprite=Util.LoadSprite(artResourcesConfig[itemConfig[itemId].ResourceID].Name)
info.text=m.isInfo
num.text= tostring(itemNum)
end
Util.AddOnceClick(btn,function()
if not isFree then
if BagManager.GetItemCountById(itemId)<d[2] then
PopupTipPanel.ShowTip(itemConfig[itemId].Name..Language[10492])
return
end
end
local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.TimeLimitTen)
if n==bType.Btn1 then
if PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)+1>privilegeConfig[maxtimesId].Condition[1][2] then
PopupTipPanel.ShowTip(Language[11760])
return
end
local recruitOne = function()
RecruitManager.RecruitRequest(singleRecruit.Id, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,1)--记录抽卡次数
UIManager.OpenPanel(UIName.SingleRecruitPanel, msg.drop.Hero[1],singleRecruit.Id,bType.Btn1)
CheckRedPointStatus(RedPointType.TimeLimited)
end,freeTimesId)
end
if state==0 and d[1] == 16 and not isFree then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,singleRecruit.Id,recruitOne)
else
recruitOne()
end
elseif n==bType.Btn10 then
if PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)+10>privilegeConfig[maxtimesId].Condition[1][2] then
PopupTipPanel.ShowTip(Language[11760])
return
end
local recruitTen = function()
RecruitManager.RecruitRequest(tenRecruit.Id, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,10)--记录抽卡次数
UIManager.OpenPanel(UIName.SingleRecruitPanel, msg.drop.Hero, tenRecruit.Id,bType.Btn10)
CheckRedPointStatus(RedPointType.TimeLimited)
end,freeTimesId)
end
if state==0 and d[1] ==16 and not isFree then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,tenRecruit.Id,recruitTen)
else
recruitTen()
end
end
end)
end
end
--刷新时间
function LingShouBaoGe:TimeCountDown()
if this.timer then
this.timer:Stop()
this.timer = nil
end
local timeDown=CalculateSecondsNowTo_N_OClock(5)--ActivityGiftManager.GetTaskRemainTime(ActivityTypeDef.FindFairy)
this.timeupdate.text = TimeToHMS(timeDown)..Language[12200]
local timeDown=CalculateSecondsNowTo_N_OClock(5)
this.tip1.text = TimeToHMS(timeDown)..Language[12200]
this.timer = Timer.New(function()
if timeDown < 1 then
this.timer:Stop()
@ -302,7 +223,7 @@ function LingShouBaoGe:TimeCountDown()
return
end
timeDown = timeDown - 1
this.timeupdate.text = TimeToHMS(timeDown)..Language[12200]
this.tip1.text = TimeToHMS(timeDown)..Language[12200]
end, 1, -1, true)
this.timer:Start()
end
@ -310,7 +231,6 @@ end
function LingShouBaoGe:OnHide()
this.gameObject:SetActive(false)
this.detail.gameObject:SetActive(false)
this.reward.gameObject:SetActive(false)
if this.timer then
this.timer:Stop()
this.timer = nil
@ -318,12 +238,11 @@ function LingShouBaoGe:OnHide()
end
function LingShouBaoGe:OnDestroy()
ActivityDetail.OnDestroy()
RewardPreview.OnDestroy()
if itemView then
SubUIManager.Close(itemView)
itemView=nil
end
-- ActivityDetail.OnDestroy()
-- if itemView then
-- SubUIManager.Close(itemView)
-- itemView=nil
-- end
end
--添加事件监听(用于子类重写)

View File

@ -0,0 +1,153 @@
require("Base/BasePanel")
LingShouBaoGeOneResultPanel = Inherit(BasePanel)
local this=LingShouBaoGeOneResultPanel
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting)
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local itemNum=0 --抽卡小号道具数量
local isFree=false
local itemId = 0
local RecruitMaxtimesId = 0
local freeTimesId = 0
local activityId = nil
local singleRecruit = nil
local tenRecruit = nil
--活动抽卡类型(动态的数据)
local drawtType={
FindFairySingle=0,
}
local orginLayer
local itemViewList = {}
--初始化组件(用于子类重写)
function LingShouBaoGeOneResultPanel:InitComponent()
orginLayer = 10
self.bg = Util.GetGameObject(self.gameObject, "effect")
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft, panelType = PanelType.ElementDrawCard })
screenAdapte(self.bg)
this.btnBack=Util.GetGameObject(self.gameObject, "bottom/backButton")
this.openOneAgainButton=Util.GetGameObject(self.gameObject, "bottom/openOneAgainButton")
this.content3=Util.GetGameObject(self.gameObject,"bottom/openOneAgainButton/Content3")
this.itemIcon3=Util.GetGameObject(this.content3, "icon"):GetComponent("Image")
this.itemNum3=Util.GetGameObject(this.content3, "num"):GetComponent("Text")
this.itemInfo3=Util.GetGameObject(this.content3, "info"):GetComponent("Text")
this.tipText=Util.GetGameObject(this.openOneAgainButton, "Text"):GetComponent("Text")
this.content=Util.GetGameObject(self.gameObject, "content")
this.detailImage=Util.GetGameObject(self.gameObject, "Tip")
end
--绑定事件(用于子类重写)
function LingShouBaoGeOneResultPanel:BindEvent()
Util.AddClick(this.btnBack, function ()
self:ClosePanel()
end)
Util.AddClick(this.openOneAgainButton, function ()
--是否超过每日最大上限
if PrivilegeManager.GetPrivilegeRemainValue(RecruitMaxtimesId) < 1 then
PopupTipPanel.ShowTip(Language[11760])
return
end
if not isFree then
if BagManager.GetItemCountById(itemId) < itemNum then
PopupTipPanel.ShowTip(ItemConfig[itemId].Name..Language[10492])
return
end
end
RecruitManager.RecruitRequest(this.recruitType, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(RecruitMaxtimesId,1)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,this.recruitType,msg.drop,activityId)
end,freeTimesId,itemId,itemNum)
end)
end
--添加事件监听(用于子类重写)
function LingShouBaoGeOneResultPanel:AddListener()
end
--移除事件监听(用于子类重写)
function LingShouBaoGeOneResultPanel:RemoveListener()
end
function LingShouBaoGeOneResultPanel:OnSortingOrderChange()
Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer)
orginLayer = self.sortingOrder
if this.view then
this.view:OnOpen(true,this.itemDataList[1],1.4,true,false,false,self.sortingOrder)
end
end
--界面打开时调用(用于子类重写)
function LingShouBaoGeOneResultPanel:OnOpen(...)
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.LingShou})
local args = { ... }
this.drop=args[1]
this.recruitType = args[2]
activityId = args[3]
this.detailImage:SetActive(false)
this.content3:SetActive(true)
--获取免费次数
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
singleRecruit = array[1]
tenRecruit = array[2]
local currLottery= ConfigManager.GetConfigData(ConfigName.LotterySetting,singleRecruit.Id)
freeTimesId=currLottery.FreeTimes
RecruitMaxtimesId = currLottery.MaxTimes
local freeTime=0
if freeTimesId>0 then
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId] = freeTime
end
isFree=freeTime and freeTime >= 1
if isFree then
this.itemNum3.gameObject:SetActive(false)
this.itemIcon3.gameObject:SetActive(false)
this.itemInfo3.text="免费召唤"
this.tipText.gameObject:SetActive(false)
else
this.itemNum3.gameObject:SetActive(true)
this.itemIcon3.gameObject:SetActive(true)
this.itemInfo3.text="再来1次"
itemId=0
local d = RecruitManager.GetExpendData(this.recruitType)
itemId = d[1]
itemNum = d[2]
this.tipText.gameObject:SetActive(false)
this.itemIcon3.sprite=Util.LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name)
this.itemNum3.text= "×"..itemNum
end
this.itemDataList = {}
this.itemDataList = BagManager.GetTableByBackDropData(this.drop)
if not itemViewList then
itemViewList = {}
end
for k,v in pairs(itemViewList) do
v.gameObject:SetActive(false)
end
for i = 1, #this.itemDataList do
if not itemViewList[i] then
Util.GetTransform(this.content, "itemContent"..i).gameObject:SetActive(true)
itemViewList[i] = SubUIManager.Open(SubUIConfig.ItemView,Util.GetTransform(this.content, "itemContent"..i))
end
itemViewList[i].gameObject:SetActive(true)
itemViewList[i]:OnOpen(true,this.itemDataList[i],1.4,true,false,false,self.sortingOrder)
end
end
--界面关闭时调用(用于子类重写)
function LingShouBaoGeOneResultPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function LingShouBaoGeOneResultPanel:OnDestroy()
SubUIManager.Close(this.UpView)
this.view = nil
itemViewList = {}
end
return LingShouBaoGeOneResultPanel

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b4fc91ffec61dd64d86b466384623326
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,165 @@
require("Base/BasePanel")
require("Base/Stack")
LingShouBaoGeTenResultPanel = Inherit(BasePanel)
local this=LingShouBaoGeTenResultPanel
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local gameSetting=ConfigManager.GetConfig(ConfigName.GameSetting)
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
local itemId=0
local itemNum=0 --抽卡小号道具数量
local activityId = nil
local singleRecruit = nil
local tenRecruit = nil
local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting)
this.contentList={}
this.contentListParent={}
this.isElementDrawPanel=false
local orginLayer
--初始化组件(用于子类重写)
function LingShouBaoGeTenResultPanel:InitComponent()
orginLayer = 0
self.bg = Util.GetGameObject(self.gameObject, "effect")
screenAdapte(self.bg)
this.btnBack=Util.GetGameObject(self.gameObject, "bottom/backButton")
this.openTenAgainButton=Util.GetGameObject(self.gameObject, "bottom/openTenAgainButton")
this.costImage=Util.GetGameObject(self.gameObject, "bottom/openTenAgainButton/Image")
this.detailImage=Util.GetGameObject(self.gameObject, "Tip")
this.content1=Util.GetGameObject(self.gameObject,"bottom/openTenAgainButton/Content1")
this.itemIcon1=Util.GetGameObject(this.content1,"Icon"):GetComponent("Image")
this.detailImage1=Util.GetGameObject(this.content1,"Tip")
this.detailText1 = Util.GetGameObject(this.detailImage1, "contentDetailText"):GetComponent("Text")
this.content3=Util.GetGameObject(self.gameObject,"bottom/openTenAgainButton/Content3")
this.infoTxt=Util.GetGameObject(this.content3,"info"):GetComponent("Text")
this.itemIcon3=Util.GetGameObject(this.content3, "icon"):GetComponent("Image")
this.itemNum3=Util.GetGameObject(this.content3, "num"):GetComponent("Text")
this.content2=Util.GetGameObject(self.gameObject,"bottom/openTenAgainButton/Content2")
this.itemIcon2=Util.GetGameObject(this.content2,"Icon"):GetComponent("Image")
this.itemNum2=Util.GetGameObject(this.content2,"Num"):GetComponent("Text")
this.tipText=Util.GetGameObject(this.openTenAgainButton, "Text"):GetComponent("Text")
for i = 1, 10 do
this.contentList[i]=Util.GetGameObject(self.gameObject, "content/itemAnimEffect"..i.."/image/Kuang/itemName/itemContent")
this.contentListParent[i]=Util.GetGameObject(self.gameObject, "content/itemAnimEffect"..i)
end
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})--, panelType = PanelType.ElementDrawCard })
end
--绑定事件(用于子类重写)
function LingShouBaoGeTenResultPanel:BindEvent()
Util.AddClick(this.btnBack, function ()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
Util.AddClick(this.openTenAgainButton, function ()
local maxTimesId = lotterySetting[singleRecruit.Id].MaxTimes
local freeTimesId = lotterySetting[singleRecruit.Id].FreeTimes
--是否超过每日最大上限
if PrivilegeManager.GetPrivilegeRemainValue(maxTimesId) < 10 then
LogGreen("maxTimesId:"..maxTimesId.." times"..PrivilegeManager.GetPrivilegeRemainValue(maxTimesId))
PopupTipPanel.ShowTip(Language[11760])
return
end
if BagManager.GetItemCountById(itemId) < itemNum then
PopupTipPanel.ShowTip(ItemConfig[itemId].Name..Language[10492])
return
end
RecruitManager.RecruitRequest(this.recruitType, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(maxTimesId,10)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSingleResultPanel,this.recruitType,msg.drop,activityId)
end,freeTimesId,itemId,itemNum)
end)
end
--添加事件监听(用于子类重写)
function LingShouBaoGeTenResultPanel:AddListener()
end
--移除事件监听(用于子类重写)
function LingShouBaoGeTenResultPanel:RemoveListener()
end
function LingShouBaoGeTenResultPanel:OnSortingOrderChange()
Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer)
for i = 1, 10 do
Util.AddParticleSortLayer(this.contentListParent[i], self.sortingOrder - orginLayer)
end
orginLayer = self.sortingOrder
if this.views and this.itemDataList then
for index, view in pairs(this.views) do
view:OnOpen(true,this.itemDataList[index],1.4,true,false,false,self.sortingOrder)
end
end
end
--界面打开时调用(用于子类重写)
function LingShouBaoGeTenResultPanel:OnOpen(...)
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.LingShou})
local args = { ... }
this.drop=args[1]
this.recruitType = args[2]
activityId = args[3]
this.detailImage:SetActive(false)
this.content1:SetActive(false)
this.content2:SetActive(false)
this.content3:SetActive(true)
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
singleRecruit = array[1]
tenRecruit = array[2]
local d
d = RecruitManager.GetExpendData(this.recruitType)
itemId = d[1]
itemNum = d[2]
this.itemIcon3.sprite=Util.LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name)
this.tipText.gameObject:SetActive(false)
this.infoTxt.text="再来10次"
this.itemNum3.text= "×"..itemNum
local itemDataList={}
itemDataList=BagManager.GetTableByBackDropData(this.drop)
if not this.views then
this.views = {}
end
for k,v in pairs(this.views) do
v.gameObject:SetActive(false)
end
this.itemDataList = itemDataList
local dataNum = #itemDataList > 10 and 10 or #itemDataList
for i = dataNum, 1, -1 do
if not this.views[i] then
this.views[i] = SubUIManager.Open(SubUIConfig.ItemView,this.contentList[i].transform)
end
this.views[i].gameObject:SetActive(true)
local curItemData = itemDataList[i]
local contentGO = this.contentListParent[i]
this.views[i]:OnOpen(true,curItemData,1.4,true,false,false,self.sortingOrder)
contentGO:SetActive(true)
end
end
--界面关闭时调用(用于子类重写)
function LingShouBaoGeTenResultPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function LingShouBaoGeTenResultPanel:OnDestroy()
SubUIManager.Close(this.UpView)
this.views = nil
this.contentList={}
this.contentListParent={}
this.views = {}
end
return LingShouBaoGeTenResultPanel

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1cb9b55611616cd4bb317181735f35d7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -14,6 +14,7 @@ local timeNum2--第二个特效等待播放的时间
local timeNum3--第三个特效等待播放的时间
local type --抽卡类型
local index=0 --十连抽索引
local activityId--活动id
local orginLayer
local heroStaticData
@ -75,6 +76,7 @@ function PokemonSingleResultPanel:OnOpen(...)
local args = { ... }
type = args[1]
drop = args[2]
activityId = args[3]
_heroTable = drop.pokemon
end
@ -135,11 +137,24 @@ function PokemonSingleResultPanel:OnClose()
poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO)
end
heroStaticData, testLiveGO = nil, nil
if type == RecruitType.LingShowSingle then
UIManager.OpenPanel(UIName.PokemonSummonOneResultPanel, drop,type)
else
UIManager.OpenPanel(UIName.PokemonSummonTenResultPanel, drop,type)
if activityId then--限时活动抽卡
local singleRecruit
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",activityId)
singleRecruit = array[1]
if type == singleRecruit.Id then
UIManager.OpenPanel(UIName.LingShouBaoGeOneResultPanel, drop,type,activityId)
else
UIManager.OpenPanel(UIName.LingShouBaoGeTenResultPanel, drop,type,activityId)
end
else--灵兽山抽卡
if type == RecruitType.LingShowSingle then
UIManager.OpenPanel(UIName.PokemonSummonOneResultPanel, drop,type)
else
UIManager.OpenPanel(UIName.PokemonSummonTenResultPanel, drop,type)
end
end
_heroTable={}
drop = {}
end