【礼包刷新】修复礼包刷新问题

dev_chengFeng
ZhangBiao 2021-01-05 16:29:13 +08:00
parent b995971610
commit 7cb9252f45
1 changed files with 16 additions and 19 deletions

View File

@ -27,12 +27,12 @@ end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function GiftView:AddListener() function GiftView:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.GrowGift.RechargeGift, GiftView.refresh) -- Game.GlobalEvent:AddEvent(GameEvent.GrowGift.RechargeGift, GiftView.refresh)
end end
--移除事件监听(用于子类重写) --移除事件监听(用于子类重写)
function GiftView:RemoveListener() function GiftView:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.GrowGift.RechargeGift, GiftView.refresh) -- Game.GlobalEvent:RemoveEvent(GameEvent.GrowGift.RechargeGift, GiftView.refresh)
end end
@ -110,10 +110,10 @@ function GiftView:OnSortingOrderChange(cursortingOrder)
end end
end end
GiftView.refresh = function() -- GiftView.refresh = function()
LogYellow("收到了GameEvent.GrowGift.RechargeGift") -- LogYellow("收到了GameEvent.GrowGift.RechargeGift")
GiftView:RefreshData(curBuyType) -- GiftView:RefreshData(curBuyType)
end -- end
------日周月礼包------ ------日周月礼包------
-- 根据选择的页签刷新数据 -- 根据选择的页签刷新数据
@ -187,13 +187,12 @@ function GiftView:RefreshGiftData()
else else
return a.sortId > b.sortId return a.sortId > b.sortId
end end
end) end)
local callBack = function(index, item) local callBack = function(index, item)
self:RefreshShowData(item, shopData[index].data, self.buyType, shopData[index].DataType) self:RefreshShowData(item, shopData[index].data, self.buyType, shopData[index].DataType)
end end
self.scrollView2:SetData(shopData, callBack) self.scrollView2:SetData(shopData, callBack)
GiftView:TimeCountDown() self:TimeCountDown()
self.scrollView2.gameObject:SetActive(true) self.scrollView2.gameObject:SetActive(true)
elseif self.buyType == SHOP_TYPE.VIP_GIFT then--成长礼包界面 elseif self.buyType == SHOP_TYPE.VIP_GIFT then--成长礼包界面
@ -769,22 +768,20 @@ function GiftView:TimeCountDown()
if RECHARGEABLE then--(是否开启充值) if RECHARGEABLE then--(是否开启充值)
self.localTimerV2 = Timer.New(function() self.localTimerV2 = Timer.New(function()
if timerList[1] then if timerList[1] then
local t1=timerList[1].freshTime local t1=timerList[1].freshTime-GetTimeStamp()
if t1 < 0 then t1=t1-1
-- body刷新 if t1 <= 0 then
self:RefreshGiftData() self:RefreshData(curBuyType)
end end
timerList[1].pre.text=Language[10561]..self:SpecialTime(t1-GetTimeStamp())--self:SpecialTime timerList[1].pre.text=Language[10561]..self:SpecialTime(t1)--self:SpecialTime
end end
if timerList[2] then if timerList[2] then
local t2 = timerList[2].freshTime-GetTimeStamp()
local t2 = timerList[2].freshTime
t2=t2-1 t2=t2-1
if t2 < 0 then if t2 <= 0 then
-- body刷新 self:RefreshData(curBuyType)
self:RefreshGiftData()
end end
timerList[2].pre.text=Language[10561]..self:SpecialTime(t2-GetTimeStamp()) timerList[2].pre.text=Language[10561]..self:SpecialTime(t2)
end end
end,1,-1,true) end,1,-1,true)
self.localTimerV2:Start() self.localTimerV2:Start()