【寻宝迷踪】寻宝返回后默认返回显示活动第一个页签

dev_chengFeng
jiaoyangna 2021-09-16 14:06:37 +08:00
parent f035b30e59
commit 415eb7a947
1 changed files with 7 additions and 4 deletions

View File

@ -49,14 +49,14 @@ end
--添加事件监听(用于子类重写)
function ActivityMainPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, function()
this:OnOpen(this.activityType,_CurPageIndex)
this:OnOpen(this.activityType,_CurPageIndex,true)
end)
end
--移除事件监听(用于子类重写)
function ActivityMainPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, function()
this:OnOpen(this.activityType,_CurPageIndex)
this:OnOpen(this.activityType,_CurPageIndex,true)
end)
end
@ -109,18 +109,21 @@ function ActivityMainPanel:CheckActOpen(_index)
end
--界面打开时调用(用于子类重写)
function ActivityMainPanel:OnOpen(_activityType,_index)
function ActivityMainPanel:OnOpen(_activityType,_index,change)
SoundManager.PlaySound(SoundConfig.UI_Hddakai)
this.activityType = _activityType
DynamicActivityManager.curActivityType = this.activityType
tabs = DynamicActivityManager.GetActivityTableDataByPageInde(this.activityType)
_CurPageIndex = 0
if change then
_index = tabs[_index].Sort
end
if _index and _index > 0 then
self:CheckActOpen(_index)
end
for index = 1, #tabs do
if _CurPageIndex < 1 then
self:CheckActOpen(index)
self:CheckActOpen(tabs[index].Sort)
else
break
end