皮肤到期刷新

jiaoyangna 2020-11-14 14:16:10 +08:00
parent 8f1c52c5e3
commit 069d42baca
2 changed files with 12 additions and 3 deletions

View File

@ -191,6 +191,7 @@ end
--添加事件监听(用于子类重写)
function RoleInfoPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSkin, this.UpdateSkinShow)
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:AddListener()
@ -200,6 +201,7 @@ end
--移除事件监听(用于子类重写)
function RoleInfoPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSkin,this.UpdateSkinShow)
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:RemoveListener()
@ -207,6 +209,12 @@ function RoleInfoPanel:RemoveListener()
end
end
this.UpdateSkinShow = function()
if _CurPageIndex == 4 then
this:OnPageTabChange(_CurPageIndex)
end
end
--界面打开时调用(用于子类重写)
function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen,_index)
curHeroData, heroDatas,isUpZhen = _curHeroData, _heroDatas,_isUpZhen

View File

@ -25,11 +25,11 @@ function RoleSkinPanel:BindEvent()
end
--添加事件监听(用于子类重写)
function RoleSkinPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSkin, this.UpdateShow)
end
--移除事件监听(用于子类重写)
function RoleSkinPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSkin,this.UpdateShow)
end
this.UpdateShow = this:OnShow(0,parent,curHeroData)
@ -187,6 +187,7 @@ function RoleSkinPanel:TimeToFormat(time)
local day = math.floor(time / (24 * 3600))
local minute = math.floor(time / 60) % 60
local sec = time % 60
LogGreen("sec:"..sec)
local hour = math.floor(math.floor(time - day * 24 * 3600 - sec - minute * 60) / 3600)
if day > 0 then
return string.format("%d天",day)
@ -195,7 +196,7 @@ function RoleSkinPanel:TimeToFormat(time)
elseif minute > 0 then
return string.format("%0d分",minute)
else
return string.format("",1)
return string.format("%0d",1)
end
end