PGRData/Script/matrix/xui/xuihelpcourse/XUiHelp.lua

53 lines
1.3 KiB
Lua
Raw Normal View History

local XUiHelp = XLuaUiManager.Register(XLuaUi, "UiHelp")
local XUiGridHelpCourse = require("XUi/XUiHelpCourse/XUiGridHelpCourse")
function XUiHelp:OnAwake()
end
2024-09-01 20:49:41 +00:00
function XUiHelp:OnStart(config, cb, jumpIndex, closeCb)
self.Config = config
self.Cb = cb
2024-09-01 20:49:41 +00:00
self.JumpIndex = jumpIndex
self.CloseCb = closeCb
self:RegisterClickEvent(self.BtnMask, self.OnBtnMaskClick)
self:InitDynamicTable()
end
function XUiHelp:InitDynamicTable()
self.DynamicTable = XDynamicTableCurve.New(self.PanelHelp.gameObject)
self.DynamicTable:SetProxy(XUiGridHelpCourse)
self.DynamicTable:SetDelegate(self)
end
function XUiHelp:OnEnable()
if not self.Config then
return
end
self.Icons = self.Config.ImageAsset
self.Length = #self.Icons
self.DynamicTable:SetDataSource(self.Config.ImageAsset)
2024-09-01 20:49:41 +00:00
self.DynamicTable:ReloadData(self.JumpIndex)
end
function XUiHelp:OnDisable()
end
--动态列表事件
function XUiHelp:OnDynamicTableEvent(event, index, grid)
if event == DYNAMIC_DELEGATE_EVENT.DYNAMIC_GRID_ATINDEX then
grid:Refresh(self.Icons[index + 1], index + 1, self.Length)
end
end
function XUiHelp:OnBtnMaskClick()
if self.Cb then
self.Cb()
end
self:Close()
2024-09-01 20:49:41 +00:00
if self.CloseCb then
self.CloseCb()
end
end