2020-07-04 14:41:25 +08:00
|
|
|
|
-- 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.bg = csSelf:GetComponent("UISprite")
|
|
|
|
|
|
uiobjs.SpriteIcon = getCC(transform, "SpriteIcon", "UISprite")
|
|
|
|
|
|
uiobjs.LabelName = getCC(transform, "LabelName", "UILabel")
|
|
|
|
|
|
uiobjs.LabelState = getCC(transform, "LabelState", "UILabel")
|
|
|
|
|
|
uiobjs.SpriteState = getCC(uiobjs.LabelState.transform, "SpriteState", "UISprite")
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示,
|
|
|
|
|
|
-- 注意,c#侧不会在调用show时,调用refresh
|
|
|
|
|
|
function _cell.show(go, data)
|
|
|
|
|
|
mData = data
|
|
|
|
|
|
-- uiobjs.SpriteIcon.spriteName = ""
|
|
|
|
|
|
uiobjs.LabelName.text = mData.company_name
|
|
|
|
|
|
_cell.selected(false)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function _cell.selected(val)
|
|
|
|
|
|
if val then
|
|
|
|
|
|
uiobjs.bg.color = ColorEx.getColor(0xff2990dc)
|
|
|
|
|
|
uiobjs.SpriteIcon.color = Color.white
|
|
|
|
|
|
uiobjs.LabelName.color = Color.white
|
|
|
|
|
|
-- uiobjs.LabelState.color = Color.white
|
2020-08-08 07:52:19 +08:00
|
|
|
|
uiobjs.LabelState.text = "已选择"
|
2020-07-04 14:41:25 +08:00
|
|
|
|
uiobjs.SpriteState.color = ColorEx.getColor(0xff1971b8)
|
|
|
|
|
|
else
|
|
|
|
|
|
uiobjs.bg.color = ColorEx.getColor(0xfff4f4f4)
|
|
|
|
|
|
uiobjs.SpriteIcon.color = ColorEx.getColor(0xff2990dc)
|
|
|
|
|
|
uiobjs.LabelName.color = ColorEx.getColor(0xff999999)
|
|
|
|
|
|
uiobjs.LabelState.text = "未进入"
|
|
|
|
|
|
-- uiobjs.LabelState.color = ColorEx.getColor(0xff999999)
|
|
|
|
|
|
uiobjs.SpriteState.color = ColorEx.getColor(0xffcccccc)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 取得数据
|
|
|
|
|
|
function _cell.getData()
|
|
|
|
|
|
return mData
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
return _cell
|