送10万真充修改

wangzhenxing 2022-12-27 14:18:35 +08:00
parent cc4ba83a7f
commit c70f8421d3
1 changed files with 55 additions and 34 deletions

View File

@ -8,6 +8,9 @@ local activityData
local allValue=0 local allValue=0
local rewardTime=0 local rewardTime=0
local isCanGet=false local isCanGet=false
local deleteTime=0
local currShowRed=nil
local rewardNum=0
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function GMSong10WanPanel:InitComponent() function GMSong10WanPanel:InitComponent()
this.spLoader = SpriteLoader.New() this.spLoader = SpriteLoader.New()
@ -28,7 +31,7 @@ function GMSong10WanPanel:InitComponent()
this.scrollView.moveTween.MomentumAmount = 1 this.scrollView.moveTween.MomentumAmount = 1
this.scrollView.moveTween.Strength = 2 this.scrollView.moveTween.Strength = 2
this.itemList={} this.itemList={}
this.timer = nil
end end
--绑定事件(用于子类重写) --绑定事件(用于子类重写)
@ -42,6 +45,7 @@ function GMSong10WanPanel:BindEvent()
UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1,function () UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1,function ()
isCanGet=false isCanGet=false
this.getRed:SetActive(false) this.getRed:SetActive(false)
deleteTime=0
self:OnShow() self:OnShow()
end) end)
end) end)
@ -81,6 +85,7 @@ function GMSong10WanPanel:OnShow()
local lastState=-1 local lastState=-1
local dayList={} local dayList={}
if activityData then if activityData then
local maxId=0
for i = 1,#activityData.mission do for i = 1,#activityData.mission do
local id=activityData.mission[i].missionId local id=activityData.mission[i].missionId
if zhenchongConfig[id] then if zhenchongConfig[id] then
@ -89,8 +94,6 @@ function GMSong10WanPanel:OnShow()
allValue=allValue+aaa.RewardValue allValue=allValue+aaa.RewardValue
if not dayList[aaa.day] then if not dayList[aaa.day] then
local day={} local day={}
--table.insert(missionData,day)
--table.insert(days,aaa.day)
day.reward={} day.reward={}
table.insert(day.reward,aaa.Reward) table.insert(day.reward,aaa.Reward)
dayList[aaa.day]=day dayList[aaa.day]=day
@ -101,6 +104,7 @@ function GMSong10WanPanel:OnShow()
dayList[aaa.day].reward.state=state dayList[aaa.day].reward.state=state
local progress=activityData.mission[i].progress local progress=activityData.mission[i].progress
if lastState~=0 and progress>=0 then if lastState~=0 and progress>=0 then
maxId=id
lineTime=progress lineTime=progress
if state==0 and rewardTime==0 then if state==0 and rewardTime==0 then
rewardTime=aaa.Time rewardTime=aaa.Time
@ -112,14 +116,31 @@ function GMSong10WanPanel:OnShow()
lastState=state lastState=state
end end
end end
LogError("#missionData==="..#dayList) rewardNum=0
LogError("linetime=="..lineTime) this.timeTxt.text=""
this.scrollView:SetData(dayList,function(index, rewardItem) this.scrollView:SetData(dayList,function(index, rewardItem)
this:UpdateSingleInfo(rewardItem, dayList[index],index) this:UpdateSingleInfo(rewardItem, dayList[index],index)
end,not false,not false) end,not false,not false)
this.scrollView:SetIndex(maxId/4)
if deleteTime>0 then
this.timer = Timer.New(function ()
--LogError("needTime=="..needTime)
deleteTime= deleteTime-1
if deleteTime<=0 then
isCanGet=true
this.timeTxt.text = "有可领取奖励"
this.getRed:SetActive(true)
currShowRed:SetActive(true)
this.timer:Stop()
this.timer = nil
else
this.timeTxt.text = string.format("领取倒计时:".."%s",TimeToFelaxible(deleteTime))
end end
end,1,-1,true)
this.timer:Start()
end
end
this.getRed:SetActive(isCanGet) this.getRed:SetActive(isCanGet)
this.noGetTxt.text=string.format("未领取:<color=#2DBD11>%s</color>元",allValue-activityData.value) this.noGetTxt.text=string.format("未领取:<color=#2DBD11>%s</color>元",allValue-activityData.value)
end end
@ -131,9 +152,14 @@ function this:UpdateSingleInfo(go,data,index)
if not this.itemList[go] then if not this.itemList[go] then
this.itemList[go] = {} this.itemList[go] = {}
end end
if this.timer then
this.timer:Stop()
this.timer = nil
end
for i = 1, #this.itemList[go] do for i = 1, #this.itemList[go] do
this.itemList[go][i].go.gameObject:SetActive(false) this.itemList[go][i].go.gameObject:SetActive(false)
end end
for i = 1, #data.reward do for i = 1, #data.reward do
if not this.itemList[go][i] then if not this.itemList[go][i] then
this.itemList[go][i]={} this.itemList[go][i]={}
@ -144,7 +170,6 @@ function this:UpdateSingleInfo(go,data,index)
this.itemList[go][i].out=Util.GetGameObject(this.itemList[go][i].go, "guoqi") this.itemList[go][i].out=Util.GetGameObject(this.itemList[go][i].go, "guoqi")
this.itemList[go][i].name=Util.GetGameObject(this.itemList[go][i].go, "name") this.itemList[go][i].name=Util.GetGameObject(this.itemList[go][i].go, "name")
this.itemList[go][i].itemView= SubUIManager.Open(SubUIConfig.ItemView,this.itemList[go][i].pos.transform) this.itemList[go][i].itemView= SubUIManager.Open(SubUIConfig.ItemView,this.itemList[go][i].pos.transform)
end end
this.itemList[go][i].go.gameObject:SetActive(true) this.itemList[go][i].go.gameObject:SetActive(true)
this.itemList[go][i].red:SetActive(false) this.itemList[go][i].red:SetActive(false)
@ -160,55 +185,51 @@ function this:UpdateSingleInfo(go,data,index)
--LogError("state====="..state) --LogError("state====="..state)
if state==0 then if state==0 then
if progress~=-1 then if progress~=-1 then
if this.timer then
this.timer:Stop()
this.timer = nil
end
local cha= tonumber(GetTimeStamp()-ActivityGiftManager.loginTime) local cha= tonumber(GetTimeStamp()-ActivityGiftManager.loginTime)
local needTime=config.Time- (lineTime+cha) local needTime=config.Time- (lineTime+cha)
LogError("needTime=="..needTime)
this.getRed:SetActive(false) this.getRed:SetActive(false)
if needTime>=0 then if needTime>0 and deleteTime==0 then
this.timeTxt.gameObject:SetActive(true) this.timeTxt.gameObject:SetActive(true)
this.timer = Timer.New(function () deleteTime=needTime
--LogError("needTime=="..needTime) currShowRed=this.itemList[go][i].red
needTime=needTime-1 --this.timeTxt.gameObject:SetActive(false)
if needTime<=0 then
isCanGet=true
this.timeTxt.text = "有可领取奖励"
this.getRed:SetActive(true)
this.timer:Stop()
this.timer = nil
this.itemList[go][i].red:SetActive(true)
else
this.timeTxt.text = string.format("领取倒计时:".."%s",TimeToFelaxible(needTime))
end end
if needTime<=0 then
end,1,-1,true)
this.timer:Start()
else
if rewardTime~=0 then if rewardTime~=0 then
isCanGet=true isCanGet=true
this.itemList[go][i].red:SetActive(true) this.itemList[go][i].red:SetActive(true)
end end
this.timeTxt.gameObject:SetActive(false)
end end
end end
elseif state==1 then elseif state==1 then
this.itemList[go][i].red:SetActive(true) this.itemList[go][i].red:SetActive(true)
elseif state==2 then elseif state==2 then
this.itemList[go][i].get:SetActive(true) this.itemList[go][i].get:SetActive(true)
rewardNum=rewardNum+1
elseif state==3 then elseif state==3 then
this.itemList[go][i].out:SetActive(true) this.itemList[go][i].out:SetActive(true)
end end
end end
--LogError("deleteTime==="..deleteTime)
end end
--界面关闭时调用(用于子类重写) --界面关闭时调用(用于子类重写)
function GMSong10WanPanel:OnClose() function GMSong10WanPanel:OnClose()
if this.timer then
this.timer:Stop()
this.timer = nil
end
allValue=0 allValue=0
rewardTime=0 rewardTime=0
deleteTime=0
rewardNum=0
this.getRed:SetActive(false)
if currShowRed then
currShowRed:SetActive(false)
currShowRed=nil
end
CheckRedPointStatus(RedPointType.song10Wan) CheckRedPointStatus(RedPointType.song10Wan)
end end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)