2020-08-25 15:46:38 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-07-28 09:48:02 +08:00
|
|
|
|
local DynamicActivityPanel = Inherit(BasePanel)
|
|
|
|
|
local this = DynamicActivityPanel
|
|
|
|
|
-- Tab管理器
|
|
|
|
|
local TabBox = require("Modules/Common/TabBox")
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local GlobalActConfig = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
2020-10-12 16:56:05 +08:00
|
|
|
|
local _CurPageIndex =1
|
2020-08-20 18:32:14 +08:00
|
|
|
|
local orginLayer
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local tabs = {
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[1] = { --第二周 破阵诛仙
|
2020-08-22 17:36:57 +08:00
|
|
|
|
default = "p_pozhengzhuxian_anniu_02", lock = "p_pozhengzhuxian_anniu_02", select = "p_pozhengzhuxian_anniu_01",
|
2020-09-24 17:26:27 +08:00
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[2] = { --第三周 勇冠三军
|
2020-09-24 17:26:27 +08:00
|
|
|
|
default = "c_ydsj_anniu_02", lock = "c_ydsj_anniu_02", select = "c_ydsj_anniu_01",
|
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
2020-08-22 17:36:57 +08:00
|
|
|
|
},
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[3] = { --第四周 叱咤风云
|
2020-09-24 17:26:27 +08:00
|
|
|
|
default = "c_ccfy_icon2", lock = "c_ccfy_icon2", select = "c_ccfy_icon1",
|
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[4] = { --第五周 丹心碧血
|
2020-10-15 11:06:45 +08:00
|
|
|
|
default = "d_danxinbixue_icon2", lock = "d_danxinbixue_icon2", select = "d_danxinbixue_bicon1",
|
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[5] = { --第六周 势不可挡
|
2020-10-15 20:50:05 +08:00
|
|
|
|
default = "s_shibukedang_bicon1", lock = "s_shibukedang_bicon1", select = "s_shibukedang_bicon2",
|
2020-10-13 20:36:01 +08:00
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[6] = { --第七周 勇往直前
|
|
|
|
|
default = "s_yongwangzhiqian_icon2", lock = "s_yongwangzhiqian_icon2", select = "s_yongwangzhiqian_icon1",
|
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-10-28 14:10:20 +08:00
|
|
|
|
[7] = { --第八周 运筹帷幄
|
|
|
|
|
default = "y_yunchouweiwo_anniu02", lock = "y_yunchouweiwo_anniu02", select = "y_yunchouweiwo_anniu01",
|
2020-10-21 14:13:07 +08:00
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-11-06 10:49:08 +08:00
|
|
|
|
[8] = { --第九周 移山倒海
|
|
|
|
|
default = "y_yishandaohai_anniu_02", lock = "y_yishandaohai_anniu_02", select = "y_yishandaohai_anniu_01",
|
2020-10-21 14:13:07 +08:00
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
|
|
|
|
[9] = { --第十周
|
|
|
|
|
default = "s_shibukedang_bicon1", lock = "s_shibukedang_bicon1", select = "s_shibukedang_bicon2",
|
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
|
|
|
|
[10] = { --第十一周
|
|
|
|
|
default = "s_shibukedang_bicon1", lock = "s_shibukedang_bicon1", select = "s_shibukedang_bicon2",
|
|
|
|
|
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
|
|
|
|
},
|
2020-10-24 19:31:41 +08:00
|
|
|
|
[11] = { --社稷大典
|
|
|
|
|
default = "r_guanka_sheji_anniu_02", lock = "r_guanka_sheji_anniu_02", select = "r_guanka_sheji_anniu_01",
|
|
|
|
|
rpType = RedPointType.Celebration,panelType = PanelType.Celebration,ActType = ActivityTypeDef.Celebration
|
|
|
|
|
},
|
2020-11-06 15:11:19 +08:00
|
|
|
|
[12] = { --易经宝库
|
|
|
|
|
default = "y_yijingbaoku_anniu_01", lock = "y_yijingbaoku_anniu_01", select = "y_yijingbaoku_anniu",
|
|
|
|
|
rpType = RedPointType.YiJingBaoKu,panelType = PanelType.YiJingBaoKu,ActType = ActivityTypeDef.YiJingBaoKu
|
|
|
|
|
},
|
|
|
|
|
[13] = { --限时召唤
|
2020-07-28 09:48:02 +08:00
|
|
|
|
default = "x_xianshizaohuan_02", lock = "x_xianshizaohuan_02", select = "x_xianshizaohuan_01",
|
2020-09-24 17:26:27 +08:00
|
|
|
|
rpType = RedPointType.TimeLimited,panelType = PanelType.TimelimitCall,ActType = ActivityTypeDef.FindFairy
|
2020-07-28 09:48:02 +08:00
|
|
|
|
},
|
2020-11-06 15:11:19 +08:00
|
|
|
|
[14] = { --乾坤宝盒
|
2020-07-28 09:48:02 +08:00
|
|
|
|
default = "q_qiankun_baoheanniu_02", lock = "q_qiankun_baoheanniu_02", select = "q_qiankun_baoheanniu_01",
|
2020-09-24 17:26:27 +08:00
|
|
|
|
rpType = RedPointType.QianKunBox,panelType = PanelType.QianKunBox,ActType = ActivityTypeDef.QianKunBox
|
2020-08-13 15:38:20 +08:00
|
|
|
|
},
|
2020-11-06 15:11:19 +08:00
|
|
|
|
[15] = { --神医天降
|
2020-11-06 19:54:00 +08:00
|
|
|
|
default = "s_shenyitianjiang_anniu_02", lock = "s_shenyitianjiang_anniu_02", select = "s_shenyitianjiang_anniu_01",
|
|
|
|
|
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.ShenYiTianJiang
|
2020-11-06 15:11:19 +08:00
|
|
|
|
},
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[16] = { --灵兽特惠
|
|
|
|
|
default = "l_lishoutehui_xianshibiao0", lock = "l_lishoutehui_xianshibiao0", select = "l_lishoutehui_anniu",
|
|
|
|
|
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.LingShowTeHui
|
|
|
|
|
},
|
|
|
|
|
[17] = { --珍奇礼包
|
2020-08-13 15:38:20 +08:00
|
|
|
|
default = "z_zhenqibaoge_anniu_02", lock = "z_zhenqibaoge_anniu_02", select = "z_zhenqibaoge_anniu_01",
|
2020-09-24 17:26:27 +08:00
|
|
|
|
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct_Treasure
|
2020-08-20 17:36:19 +08:00
|
|
|
|
},
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[18] = { --累计充值 一天一刷
|
2020-10-24 16:18:57 +08:00
|
|
|
|
default = "r_huodong_leijichengzhianniu_01", lock = "r_huodong_leijichengzhianniu_01", select = "r_huodong_leijichengzhianniu",
|
|
|
|
|
rpType = RedPointType.DynamicActRecharge,panelType = PanelType.Main,ActType = ActivityTypeDef.AccumulativeRechargeExper
|
|
|
|
|
},
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[19] = { --累计充值 一周一刷
|
2020-11-04 03:51:04 +08:00
|
|
|
|
default = "r_huodong_leijichengzhianniu_01", lock = "r_huodong_leijichengzhianniu_01", select = "r_huodong_leijichengzhianniu",
|
|
|
|
|
rpType = RedPointType.DynamicActRecharge,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct_recharge
|
|
|
|
|
},
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[20] = { --限时商市
|
2020-08-21 11:23:46 +08:00
|
|
|
|
default = "x_xianshishangshi_anniu_02", lock = "x_xianshishangshi_anniu_02", select = "x_xianshishangshi_anniu_01",
|
2020-09-24 17:26:27 +08:00
|
|
|
|
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct_TimeLimitShop
|
|
|
|
|
},
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[21] = { --限时兑换
|
2020-09-24 17:26:27 +08:00
|
|
|
|
default = "r_xianshiduihuan_anniu_01", lock = "r_xianshiduihuan_anniu_01", select = "r_xianshiduihuan_anniu",
|
|
|
|
|
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.LimitExchange
|
2020-08-21 11:23:46 +08:00
|
|
|
|
},
|
2020-07-28 09:48:02 +08:00
|
|
|
|
}
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local _PageInfo = {--后期可以做成tableInsert,icon名字都去读表
|
|
|
|
|
[1] = 1,
|
|
|
|
|
[2] = 1,
|
|
|
|
|
[3] = 1,
|
2020-10-15 11:06:45 +08:00
|
|
|
|
[4] = 1,
|
2020-10-13 20:36:01 +08:00
|
|
|
|
[5] = 1,
|
2020-10-21 14:13:07 +08:00
|
|
|
|
[6] = 1,
|
|
|
|
|
[7] = 1,
|
|
|
|
|
[8] = 1,
|
|
|
|
|
[9] = 1,
|
|
|
|
|
[10] = 1,
|
|
|
|
|
[11] = 2,
|
2020-11-06 15:11:19 +08:00
|
|
|
|
[12] = 9,--易经宝库
|
|
|
|
|
[13] = 3,
|
|
|
|
|
[14] = 4,
|
2020-11-06 19:54:00 +08:00
|
|
|
|
[15] = 10,--神衣天降
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[16] = 11,
|
|
|
|
|
[17] = 5,
|
2020-11-06 15:11:19 +08:00
|
|
|
|
[18] = 6,
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[19] = 6,
|
|
|
|
|
[20] = 7,
|
|
|
|
|
[21] = 9,
|
2020-09-24 17:26:27 +08:00
|
|
|
|
}
|
2020-08-13 15:38:20 +08:00
|
|
|
|
|
2020-08-21 11:23:46 +08:00
|
|
|
|
local TimeLimitedCall = require("Modules/DynamicActivity/TimeLimitedCall")
|
|
|
|
|
local QianKunBox = require("Modules/DynamicActivity/QianKunBox")
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local DynamicActPage=require("Modules/DynamicActivity/DynamicTaskPage")
|
2020-08-21 11:23:46 +08:00
|
|
|
|
local ZhenQiYiBaoPage=require("Modules/DynamicActivity/ZhenQiYiBaoPage")
|
2020-08-28 16:36:08 +08:00
|
|
|
|
local LeiJiChongZhiPage=require("Modules/DynamicActivity/LeiJiChongZhiPage")
|
2020-08-21 11:23:46 +08:00
|
|
|
|
local XianShiShangShi=require("Modules/DynamicActivity/XianShiShangShi")
|
2020-10-24 19:31:41 +08:00
|
|
|
|
local SheJiDaDian=require("Modules/DynamicActivity/SheJiDaDian")
|
2020-10-15 16:00:58 +08:00
|
|
|
|
local XianShiDuiHuan=require("Modules/Expert/DynamicActivityExChange")
|
2020-11-02 18:05:24 +08:00
|
|
|
|
local YiJingBaoKu=require("Modules/DynamicActivity/YiJingBaoKu")
|
2020-11-06 19:54:00 +08:00
|
|
|
|
local ShengYiTianJiang = require("Modules/DynamicActivity/ShengYiTianJiang")
|
2020-11-12 11:31:33 +08:00
|
|
|
|
local LingShowTeHui = require("Modules/DynamicActivity/LingShowTeHui")
|
2020-07-28 09:48:02 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:InitComponent()
|
2020-08-06 15:14:47 +08:00
|
|
|
|
orginLayer = 0
|
2020-07-28 09:48:02 +08:00
|
|
|
|
this.tabbox = Util.GetGameObject(self.gameObject, "bg/tabbox")
|
|
|
|
|
this.btnBack = Util.GetGameObject(self.gameObject, "bg/btnBack")
|
|
|
|
|
this.content = Util.GetGameObject(self.gameObject, "bg/pageContent")
|
2020-11-02 18:05:24 +08:00
|
|
|
|
|
2020-07-28 09:48:02 +08:00
|
|
|
|
this.PageList = {
|
2020-09-24 17:26:27 +08:00
|
|
|
|
[1] = DynamicActPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_3")),
|
2020-10-24 19:31:41 +08:00
|
|
|
|
[2] = SheJiDaDian.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_8")),
|
|
|
|
|
[3] = TimeLimitedCall.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_1")),
|
2020-11-02 18:05:24 +08:00
|
|
|
|
[4] = QianKunBox.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_2")),
|
2020-10-24 19:31:41 +08:00
|
|
|
|
[5] = ZhenQiYiBaoPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_4")),
|
|
|
|
|
[6] = LeiJiChongZhiPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_5")),
|
|
|
|
|
[7] = XianShiShangShi.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_6")),
|
|
|
|
|
[8] = XianShiDuiHuan.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_7")),
|
2020-11-02 18:05:24 +08:00
|
|
|
|
[9] = YiJingBaoKu.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_9")),
|
2020-11-06 19:54:00 +08:00
|
|
|
|
[10] = ShengYiTianJiang.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_10")),
|
2020-11-12 11:31:33 +08:00
|
|
|
|
[11] = LingShowTeHui.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_11")),
|
2020-07-28 09:48:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- 上部货币显示
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
|
|
|
|
|
end
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:BindEvent()
|
|
|
|
|
-- 初始化Tab管理器
|
|
|
|
|
this.PageTabCtrl = TabBox.New()
|
|
|
|
|
this.PageTabCtrl:SetTabAdapter(this.PageTabAdapter)
|
|
|
|
|
this.PageTabCtrl:SetTabIsLockCheck(this.PageTabIsLockCheck)
|
|
|
|
|
this.PageTabCtrl:SetChangeTabCallBack(this.OnPageTabChange)
|
|
|
|
|
-- 关闭界面打开主城
|
|
|
|
|
Util.AddClick(this.btnBack, function()
|
|
|
|
|
this:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:AddListener()
|
2020-10-21 23:18:39 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn)
|
2020-09-22 18:13:49 +08:00
|
|
|
|
for i = 1, #this.PageList do
|
2020-09-24 17:26:27 +08:00
|
|
|
|
if this.PageList[i] then
|
2020-09-22 18:13:49 +08:00
|
|
|
|
this.PageList[i]:AddListener()
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
2020-09-24 17:26:27 +08:00
|
|
|
|
|
2020-07-28 09:48:02 +08:00
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:RemoveListener()
|
2020-10-21 23:18:39 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, this.RefreshActivityBtn)
|
2020-09-22 18:13:49 +08:00
|
|
|
|
for i = 1, #this.PageList do
|
2020-09-24 17:26:27 +08:00
|
|
|
|
if this.PageList[i] then
|
2020-09-22 18:13:49 +08:00
|
|
|
|
this.PageList[i]:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-10-21 23:18:39 +08:00
|
|
|
|
this.RefreshActivityBtn = function()
|
|
|
|
|
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct) then
|
|
|
|
|
this:ClosePanel()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2020-07-28 09:48:02 +08:00
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:OnOpen(chooseIndex)
|
2020-10-12 16:56:05 +08:00
|
|
|
|
-- 初始化tab数据
|
|
|
|
|
_CurPageIndex = chooseIndex or 1
|
2020-10-12 17:12:34 +08:00
|
|
|
|
this.PageTabCtrl:Init(this.tabbox, tabs,_CurPageIndex)
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 打开,重新打开时回调
|
|
|
|
|
function DynamicActivityPanel:OnShow()
|
2020-10-12 16:56:05 +08:00
|
|
|
|
if _CurPageIndex then
|
|
|
|
|
this.PageTabCtrl:ChangeTab(_CurPageIndex)
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
----==========================一级页签相关===========================================
|
|
|
|
|
-- tab按钮自定义显示设置
|
|
|
|
|
function this.PageTabAdapter(tab, index, status)
|
|
|
|
|
local img = Util.GetGameObject(tab, "img"):GetComponent("Image")
|
|
|
|
|
local lock = Util.GetGameObject(tab, "lock")
|
|
|
|
|
local redpot = Util.GetGameObject(tab, "redpot")
|
|
|
|
|
|
2020-09-24 17:26:27 +08:00
|
|
|
|
img.sprite = Util.LoadSprite(tabs[index][status])
|
2020-07-28 09:48:02 +08:00
|
|
|
|
img:SetNativeSize()
|
|
|
|
|
local islock = status == "lock"
|
|
|
|
|
Util.SetGray(img.gameObject, islock)
|
|
|
|
|
lock:SetActive(islock)
|
|
|
|
|
|
|
|
|
|
-- 判断是否需要检测红点
|
|
|
|
|
redpot:SetActive(false)
|
|
|
|
|
if not islock then
|
|
|
|
|
this.ClearPageRedpot(index)
|
|
|
|
|
this.BindPageRedpot(index, redpot)
|
|
|
|
|
end
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local id = ActivityGiftManager.IsActivityTypeOpen(tabs[index].ActType)
|
|
|
|
|
if id and id > 0 then
|
|
|
|
|
if GlobalActConfig[id].ShowArt and GlobalActConfig[id].ShowArt > 0 then
|
|
|
|
|
tab:SetActive(GlobalActConfig[id].ShowArt == index)
|
|
|
|
|
else
|
|
|
|
|
tab.gameObject:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--限时兑换特殊处理
|
|
|
|
|
if GlobalActConfig[id].Type == ActivityTypeDef.LimitExchange then
|
|
|
|
|
tab.gameObject:SetActive(GlobalActConfig[id].ShowArt ~= 1)
|
|
|
|
|
end
|
2020-11-04 04:34:51 +08:00
|
|
|
|
|
2020-10-24 16:18:57 +08:00
|
|
|
|
--累计充值特殊处理
|
|
|
|
|
if GlobalActConfig[id].Type == ActivityTypeDef.AccumulativeRechargeExper then
|
|
|
|
|
if GlobalActConfig[id] and GlobalActConfig[id].ShowArt ~= 1 then
|
|
|
|
|
tab.gameObject:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
tab.gameObject:SetActive(false)
|
|
|
|
|
end
|
2020-11-04 03:51:04 +08:00
|
|
|
|
elseif GlobalActConfig[id].Type == ActivityTypeDef.DynamicAct_recharge then
|
|
|
|
|
tab.gameObject:SetActive(true)
|
2020-10-24 16:18:57 +08:00
|
|
|
|
end
|
2020-09-24 17:26:27 +08:00
|
|
|
|
else
|
|
|
|
|
tab.gameObject:SetActive(false)
|
|
|
|
|
end
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- tab可用性检测
|
|
|
|
|
function this.PageTabIsLockCheck(index)
|
2020-08-27 18:35:32 +08:00
|
|
|
|
|
2020-07-28 09:48:02 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- tab改变事件
|
2020-08-20 17:36:19 +08:00
|
|
|
|
function this.OnPageTabChange(index)
|
2020-10-12 16:56:05 +08:00
|
|
|
|
_CurPageIndex = index
|
2020-07-28 09:48:02 +08:00
|
|
|
|
for i = 1, #this.PageList do
|
2020-08-13 15:38:20 +08:00
|
|
|
|
if this.PageList[i] then
|
|
|
|
|
this.PageList[i]:OnHide()
|
|
|
|
|
this.PageList[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
2020-11-04 03:51:04 +08:00
|
|
|
|
this.PageList[_PageInfo[index]]:OnShow(this.sortingOrder,this,tabs[index].ActType)
|
2020-09-24 17:26:27 +08:00
|
|
|
|
this.PageList[_PageInfo[index]].gameObject:SetActive(true)
|
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = tabs[index].panelType })
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 绑定数据
|
|
|
|
|
local _PageBindData = {}
|
|
|
|
|
local _TabBindData = {}
|
|
|
|
|
function this.BindPageRedpot(page, redpot)
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local rpType = tabs[page].rpType
|
2020-07-28 09:48:02 +08:00
|
|
|
|
if not rpType then return end
|
|
|
|
|
BindRedPointObject(rpType, redpot)
|
|
|
|
|
_PageBindData[rpType] = redpot
|
|
|
|
|
end
|
|
|
|
|
function this.ClearPageRedpot(page)
|
|
|
|
|
-- 清除红点绑定
|
|
|
|
|
if page then -- 清除某个
|
2020-09-24 17:26:27 +08:00
|
|
|
|
local rpType = tabs[page].rpType
|
2020-07-28 09:48:02 +08:00
|
|
|
|
if not rpType then return end
|
|
|
|
|
ClearRedPointObject(rpType, _PageBindData[rpType])
|
|
|
|
|
_PageBindData[rpType] = nil
|
|
|
|
|
else -- 全部清除
|
|
|
|
|
for rpt, redpot in pairs(_PageBindData) do
|
|
|
|
|
ClearRedPointObject(rpt, redpot)
|
|
|
|
|
end
|
|
|
|
|
_PageBindData = {}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:OnClose()
|
2020-10-12 16:56:05 +08:00
|
|
|
|
if _CurPageIndex then
|
|
|
|
|
this.PageList[_PageInfo[_CurPageIndex]]:OnHide()
|
|
|
|
|
this.PageList[_PageInfo[_CurPageIndex]].gameObject:SetActive(false)
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function DynamicActivityPanel:OnDestroy()
|
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
-- 清除红点
|
|
|
|
|
this.ClearPageRedpot()
|
2020-08-25 19:48:14 +08:00
|
|
|
|
-- 这里管理全部子界面的销毁,保证子界面生命周期完整
|
|
|
|
|
for _, page in pairs(this.PageList) do
|
|
|
|
|
if page.OnDestroy then
|
|
|
|
|
page:OnDestroy()
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-07-28 09:48:02 +08:00
|
|
|
|
end
|
|
|
|
|
return this
|