44 lines
1.1 KiB
Lua
44 lines
1.1 KiB
Lua
-- xx单元
|
||
local _cell = {}
|
||
---@type Coolape.CLCellLua
|
||
local csSelf = nil
|
||
local transform = nil
|
||
local mData = nil
|
||
local uiobjs = {}
|
||
|
||
-- 初始化,只调用一次
|
||
function _cell.init(csObj)
|
||
csSelf = csObj
|
||
transform = csSelf.transform
|
||
uiobjs.SpriteIcon = getCC(transform, "SpriteIcon", "UISprite")
|
||
uiobjs.Label = getCC(transform, "Label", "UILabel")
|
||
uiobjs.Label2 = getCC(transform, "Label2", "UILabel")
|
||
end
|
||
|
||
-- 显示,
|
||
-- 注意,c#侧不会在调用show时,调用refresh
|
||
function _cell.refresh(data, index)
|
||
mData = data
|
||
if mData then
|
||
SetActive(uiobjs.SpriteIcon.gameObject, true)
|
||
CLUIUtl.setSpriteFit(uiobjs.SpriteIcon, joinStr("guid_", mData.index))
|
||
uiobjs.Label.text = mData.label
|
||
uiobjs.Label2.text = mData.label2
|
||
else
|
||
SetActive(uiobjs.SpriteIcon.gameObject, false)
|
||
uiobjs.Label.text = ""
|
||
uiobjs.Label2.text = ""
|
||
end
|
||
end
|
||
|
||
function _cell.refreshCurrent(index, data)
|
||
end
|
||
|
||
-- 取得数据
|
||
function _cell.getData()
|
||
return mData
|
||
end
|
||
|
||
--------------------------------------------
|
||
return _cell
|