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