主题活动修改

jiaoyangna 2020-10-21 23:18:39 +08:00
parent 2b6705f176
commit 97bb590c24
7 changed files with 29 additions and 10 deletions

View File

@ -105,6 +105,7 @@ end
--添加事件监听(用于子类重写)
function DynamicActivityPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn)
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:AddListener()
@ -114,6 +115,7 @@ end
--移除事件监听(用于子类重写)
function DynamicActivityPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn)
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:RemoveListener()
@ -121,6 +123,12 @@ function DynamicActivityPanel:RemoveListener()
end
end
this.RefreshActivityBtn = function()
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct) then
this:ClosePanel()
end
end
--界面打开时调用(用于子类重写)
function DynamicActivityPanel:OnOpen(chooseIndex)
-- 初始化tab数据

View File

@ -105,7 +105,6 @@ function DynamicTaskPage:SetTime()
return
end
if week_timeDown <= 0 then
parent:ClosePanel()
return
end
for k,v in pairs(singleTaskPre) do

View File

@ -66,7 +66,9 @@ function LeiJiChongZhiPage:SetTime()
self.timer = Timer.New(function()
timeDown = timeDown - 1
if timeDown < 1 then
parent:ClosePanel()
self.timer:Stop()
self.timer = nil
this.time.text = Language[10028]..TimeToDHMS(0)
return
end
this.time.text = Language[10028]..TimeToDHMS(timeDown)

View File

@ -254,7 +254,6 @@ function QianKunBox:timeCountDown()
if timeDown < 1 then
self.timer:Stop()
self.timer = nil
parent:ClosePanel()
return
end
timeDown = timeDown -1
@ -266,7 +265,7 @@ end
function QianKunBox:TimeToDHMS(second)
local day = math.floor(second / (24 * 3600))
local minute = math.floor(second / 60) % 60
local sec = second % 60
local sec = math.floor(second % 60)
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
if day <= 0 and hour <= 0 then
return string.format(Language[12231],minute, sec)

View File

@ -248,15 +248,22 @@ function TimeLimitedCall:RefreshNextLevelReward()
self.recruitTimesUpdate.text = string.format(Language[12229],reMaintimes)
info = info.endTime - PlayerManager.serverTime
info = self:TimeToDHMS(info)
self.recruitTimeUpdate.text = string.format(Language[12230]..info)
local timeDown = info.endTime - PlayerManager.serverTime
self.recruitTimeUpdate.text = string.format(Language[12230]..self:TimeToDHMS(timeDown))
Timer.New(function()
if timeDown < 1 then
self.recruitTimeUpdate.text = string.format(Language[12230]..self:TimeToDHMS(0))
else
timeDown = timeDown - 1
self.recruitTimeUpdate.text = string.format(Language[12230]..self:TimeToDHMS(timeDown))
end
end, 1, -1, true):Start()
end
--- 将一段时间转换为天时分秒
function TimeLimitedCall:TimeToDHMS(second)
local day = math.floor(second / (24 * 3600))
local minute = math.floor(second / 60) % 60
local sec = second % 60
local sec = math.floor(second % 60)
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
if day <= 0 and hour <= 0 then
return string.format(Language[12231],minute, sec)

View File

@ -76,7 +76,9 @@ function XianShiShangShi:SetTime()
self.timer = Timer.New(function()
timeDown = timeDown - 1
if timeDown < 1 then
parent:ClosePanel()
self.timer:Stop()
self.timer = nil
this.time.text = Language[12321]..TimeToDHMS(0)
end
this.time.text = Language[12321]..TimeToDHMS(timeDown)
end, 1, -1, true)

View File

@ -75,7 +75,9 @@ function ZhenQiYiBaoPage:SetTime()
self.timer = Timer.New(function()
timeDown = timeDown - 1
if timeDown < 1 then
parent:ClosePanel()
self.timer:Stop()
self.timer = nil
this.time.text = Language[12321]..TimeToDHMS(0)
end
this.time.text = Language[12321]..TimeToDHMS(timeDown)
end, 1, -1, true)