PGRData/Script/matrix/xui/xuiactivitybase/XUiActivityLink.lua

42 lines
1.4 KiB
Lua
Raw Normal View History

local XUiGridActivityLink = require("XUi/XUiActivityBase/XUiGridActivityLink")
local XUiActivityBaseLink = XLuaUiManager.Register(XLuaUi, "UiActivityBaseLink")
function XUiActivityBaseLink:OnStart()
self:InitDynamicTable()
self:UpdateList()
--local bg = self.BtnFirst.transform:Find("RImgBg"):GetComponent("RawImage")
--bg:SetRawImage(CS.XGame.ClientConfig:GetString("ActivityLinkButtonBg"))
self.BtnFirst:SetName(CS.XGame.ClientConfig:GetString("ActivityLinkButtonName"))
2024-09-01 20:49:41 +00:00
self.BtnFirst.CallBack = function()
self:OnBtnClick()
end
end
function XUiActivityBaseLink:InitDynamicTable()
self.DynamicTable = XDynamicTableNormal.New(self.SViewLinkList)
self.DynamicTable:SetProxy(XUiGridActivityLink)
self.DynamicTable:SetDelegate(self)
end
function XUiActivityBaseLink:UpdateList()
2024-09-01 20:49:41 +00:00
self.LinkDataList = {}
local LinkDataList = XActivityConfigs.GetActivityLinkTemplate()
for i = 1, 3 do
if LinkDataList[i] then
table.insert(self.LinkDataList,LinkDataList[i])
end
end
self.DynamicTable:SetDataSource(self.LinkDataList)
self.DynamicTable:ReloadDataASync()
end
2024-09-01 20:49:41 +00:00
function XUiActivityBaseLink:OnBtnClick()
self.BtnFirst:SetButtonState(CS.UiButtonState.Select)
end
function XUiActivityBaseLink:OnDynamicTableEvent(event, index, grid)
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
grid:UpdateGrid(self.LinkDataList[index])
end
end