zhangjiannan 2024-11-21 12:22:35 +08:00
parent a62bfa6368
commit 3ba8c8086f
1 changed files with 20 additions and 21 deletions

View File

@ -36,8 +36,7 @@ local tabs = {
UpViewConfigId = 7,
ActType = ActivityTypeDef.CardActivity_Haoli
},
--[[
[5] = {
[5] = {
default = "X1_zhutihuodong_yingxiongshouji_02",
select = "X1_zhutihuodong_yingxiongshouji_01",
rpType = RedPointType.CardActivity_Collect,
@ -45,19 +44,18 @@ local tabs = {
UpViewConfigId = 8,
ActType = ActivityTypeDef.CardActivity_Collect
},
]]
}
this.contents = {
[1] = {view = require("Modules/CardActivity/DrawCardPanel"), panelName = "page_1"},
[2] = {view = require("Modules/CardActivity/TaskPanel"), panelName = "page_2"},
[3] = {view = require("Modules/CardActivity/GiftPanel"), panelName = "page_3"},
[4] = {view = require("Modules/CardActivity/WishPanel"), panelName = "page_4"},
[5] = {view = require("Modules/CardActivity/CollectPanel"), panelName = "page_5"},
[1] = { view = require("Modules/CardActivity/DrawCardPanel"), panelName = "page_1" },
[2] = { view = require("Modules/CardActivity/TaskPanel"), panelName = "page_2" },
[3] = { view = require("Modules/CardActivity/GiftPanel"), panelName = "page_3" },
[4] = { view = require("Modules/CardActivity/WishPanel"), panelName = "page_4" },
[5] = { view = require("Modules/CardActivity/CollectPanel"), panelName = "page_5" },
}
--初始化组件(用于子类重写)
function CardActivityPanel:InitComponent()
this.close = Util.GetGameObject(self.gameObject,"btnBack")
this.close = Util.GetGameObject(self.gameObject, "btnBack")
this.tabbox = Util.GetGameObject(self.gameObject, "tabbox")
this.PageTabCtrl = TabBox.New()
@ -68,7 +66,7 @@ function CardActivityPanel:InitComponent()
this.prefabs = {}
for i = 1, #this.contents do
this.prefabs[i] = Util.GetGameObject(self.gameObject,this.contents[i].panelName)
this.prefabs[i] = Util.GetGameObject(self.gameObject, this.contents[i].panelName)
this.contents[i].view:InitComponent(Util.GetGameObject(self.gameObject, this.contents[i].panelName))
end
@ -82,7 +80,8 @@ function this.PageTabAdapter(tab, index, status)
local selected = Util.GetGameObject(tab, "selected")
img.sprite = Util.LoadSprite(GetPictureFont(tabs[index].default))
Util.GetGameObject(selected, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont(tabs[index].select))
Util.GetGameObject(selected, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont(tabs[index]
.select))
selected:SetActive(status == "select")
end
@ -96,15 +95,15 @@ function this.OnPageTabChange(index)
_CurPageIndex = index
for i = 1, #this.prefabs do
this.prefabs[i].gameObject:SetActive(i == index)--切换子模块预设显隐
this.prefabs[i].gameObject:SetActive(i == index) --切换子模块预设显隐
end
this.contents[index].view:OnShow(this.sortingOrder,this)
this.contents[index].view:OnShow(this.sortingOrder, this)
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, UpViewConfigId = tabs[index].UpViewConfigId })
end
--绑定事件(用于子类重写)
function CardActivityPanel:BindEvent()
Util.AddClick(this.close,function ()
Util.AddClick(this.close, function()
self:ClosePanel()
end)
for i = 1, #this.contents do
@ -130,7 +129,7 @@ end
function CardActivityPanel:OnOpen(index)
_CurPageIndex = index and index or 1
this.PageTabCtrl:Init(this.tabbox, tabs,_CurPageIndex)
this.PageTabCtrl:Init(this.tabbox, tabs, _CurPageIndex)
for i = 1, #tabs do
local go = Util.GetGameObject(this.tabbox, "box").transform:GetChild(i - 1).gameObject