c1_lua/lua/app/common/cell_manager.lua
2023-04-03 10:59:13 +08:00

21 lines
526 B
Lua

local PrefabObject = require "app/bf/unity/uiprefab_object"
local CellManager = {}
function CellManager:loadCellAsync(path, cellComp, parent, callback)
UIPrefabManager:loadUIWidgetAsync(path, parent, function(prefab)
local cell = self:addCellComp(prefab, cellComp)
if callback then
callback(cell)
end
end)
end
function CellManager:addCellComp(prefab, type)
prefab:initPrefabHelper()
prefab:genAllChildren()
return prefab:addLuaComponent(type)
end
return CellManager