---@class _ParamCellImage ---@field path string ---@field onDelete function -- xx单元 local _cell = {} ---@type Coolape.CLCellLua local csSelf = nil local transform = nil ---@type _ParamCellImage local mData = nil local uiobjs = {} -- 初始化,只调用一次 function _cell.init(csObj) csSelf = csObj transform = csSelf.transform ---@type UITexture uiobjs.texture = csSelf:GetComponent("UITexture") end -- 显示, -- 注意,c#侧不会在调用show时,调用refresh function _cell.show(go, data) mData = data local url if startswith(mData.path, "/") then url = joinStr("file://", mData.path) else url = mData.path end print(url) if uiobjs.texture.mainTexture and uiobjs.texture.mainTexture.name == mData.path then else _cell.release() DBTextures.getByUrl(url, _cell.onGetTextue, mData.path) end end function _cell.onGetTextue(content, orgs) if mData.path ~= orgs then GameObject.DestroyImmediate(content) content = nil return end _cell.release() content.name = orgs uiobjs.texture.mainTexture = content end function _cell.release() if uiobjs.texture.mainTexture ~= nil then uiobjs.texture.mainTexture = nil end end -- 取得数据 function _cell.getData() return mData end function _cell.uiEventDelegate(go) if go.name == "ButtonDel" then Utl.doCallback(mData.onDelete, mData) end end -------------------------------------------- return _cell