-- 单元 local uiCell = {} local csSelf = nil local transform = nil local gameObject = nil -- local Background = nil; local Label = nil local mData = nil local centerObj function uiCell.init(go) gameObject = go transform = go.transform csSelf = gameObject:GetComponent("CLCellLua") -- Background = getChild(transform, "Background"):GetComponent("UISprite"); Label = csSelf:GetComponent("UILabel") end function uiCell.setCenterObj(val) centerObj = val uiCell.refresh() end function uiCell.show(go, data) mData = data uiCell.refresh() end function uiCell.refresh(flag) Label.text = isNilOrEmpty(mData) and "请选择" or mData if centerObj and centerObj.centeredObject and centerObj.centeredObject.name == gameObject.name then Label.color = ColorEx.getColor(0xff2990dc) else Label.color = ColorEx.getColor(0xff363636) end end function uiCell.getData() return mData end return uiCell