TCX_LongZhu
DESKTOP-MMO982B\User 2026-06-13 23:01:11 +08:00
parent 24eb4657c2
commit c9bf5cd136
1 changed files with 42 additions and 11 deletions

View File

@ -11,6 +11,8 @@ function DailyShoppingPanel:InitComponent()
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
this.btnClose = Util.GetGameObject(self.gameObject, "BG/CloseBtn")
this.localList = Util.GetGameObject(self.gameObject, "BG/ShopList")
self.endTimeBg = Util.GetGameObject(self.gameObject,"BG/DownBG/growPack")
self.endTime = Util.GetGameObject(self.endTimeBg,"Time"):GetComponent("Text")
end
-- 绑定事件(用于子类重写)
@ -26,12 +28,6 @@ function DailyShoppingPanel:BindEvent()
end)
end
function DailyShoppingPanel:RefreshData()
for i = 1, #self.actConfig.ShopData do
LogError(
"zzzzzzzzzzzzzzz" .. self.actConfig.ShopData[i][1] .. "/" .. self.actConfig.ShopData[i][2] .. "/"
.. self.actConfig.ShopData[i][3]
)
end
self.shopData = DynamicActivityManager.GetGiftDataByType(self.actConfig.ShopData)
for i = 1, 4 do
local itempre = Util.GetGameObject(self.gameObject, "BG/ShopList/shopItem (" .. i .. ")")
@ -56,11 +52,11 @@ function DailyShoppingPanel:RefreshData()
self.scrollView.elastic = false
end
]]
-- 刷新剩余时间
self:GetRemainTime()
-- 刷新商品数据
--self:RefreshGiftData()
-- self:RefreshGiftData()
end
-- 刷新礼包的数据
function DailyShoppingPanel:RefreshGiftData()
@ -191,15 +187,46 @@ function DailyShoppingPanel:OnShow()
end
-- 每种礼包的剩余时间
function DailyShoppingPanel:GetRemainTime()
if self.actConfig.ShowTime == 0 then
self.endTimeBg.gameObject:SetActive(false)
return
end
self.endTimeBg.gameObject:SetActive(true)
-- 判断是否有timer
if self.localTimer then
self.localTimer:Stop()
self.localTimer = nil
end
local la = self.actConfig.ShowTime ~= 1 and Language[10023] or Language[11355]
local freshTime = 0
if self.shopData and #self.shopData > 0 then
freshTime = self.shopData[#self.shopData].data.endTime - GetTimeStamp()
end
self.endTime.text = la .. TimeToFelaxible(freshTime)
self.localTimer = Timer.New(function ()
self.endTime.text = la .. TimeToFelaxible(freshTime)
if freshTime <= 0 then
if self.actConfig.ActiveType > 0 then
local id = ActivityGiftManager.IsActivityTypeOpen(self.actConfig.ActiveType)
if id then
self:RefreshData(nil, true, true)
end
end
self:RefreshData(nil, true, true)
end
freshTime = freshTime - 1
end, 1, -1, true)
self.localTimer:Start()
end
local orginLayer
function DailyShoppingPanel:OnSortingOrderChange()
end
-- 界面关闭时调用(用于子类重写)
function DailyShoppingPanel:OnClose()
if self.time then
self.time:Stop()
self.time = nil
if self.localTimer then
self.localTimer:Stop()
self.localTimer = nil
end
end
function DailyShoppingPanel:OnFocus()
@ -210,6 +237,10 @@ function DailyShoppingPanel:OnDestroy()
if self.scrollView then
SubUIManager.Close(self.scrollView)
end
if self.localTimer then
self.localTimer:Stop()
self.localTimer = nil
end
self.scrollView = nil
end
return DailyShoppingPanel