59 lines
1.6 KiB
Lua
59 lines
1.6 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
|
||
---@type CLUIFormRoot
|
||
uiobjs.formRoot = csSelf:GetComponent("CLUIFormRoot")
|
||
|
||
---@type UIPopupList
|
||
uiobjs.LabelServerNo = getCC(transform, "LabelServerNo", "UIPopupList")
|
||
uiobjs.SpriteHeadIcon = getCC(transform, "SpriteHeadBg/SpriteHeadIcon", "UITexture")
|
||
---@type UISprite
|
||
uiobjs.SpriteLine2 = getChild(transform, "SpriteLine2")
|
||
end
|
||
|
||
-- 显示,
|
||
-- 注意,c#侧不会在调用show时,调用refresh
|
||
function _cell.show(go, data)
|
||
mData = data
|
||
local optionInfor = DBUser.getPopList(DBUser.FilterGroup.user)
|
||
uiobjs.LabelServerNo:refreshItems(optionInfor.options, optionInfor.values)
|
||
|
||
uiobjs.formRoot:setValue(mData)
|
||
|
||
---@type _DBUser
|
||
local user = DBUser.getUserById(mData.loginNo)
|
||
if user then
|
||
DBUser.getIcon(
|
||
mData.loginNo,
|
||
function(texture)
|
||
if texture and texture.name == user.imageUrl then
|
||
uiobjs.SpriteHeadIcon.mainTexture = texture
|
||
end
|
||
end
|
||
)
|
||
end
|
||
|
||
if csSelf.name == "000000" then
|
||
SetActive(uiobjs.SpriteLine2.gameObject, false)
|
||
else
|
||
SetActive(uiobjs.SpriteLine2.gameObject, true)
|
||
end
|
||
end
|
||
|
||
-- 取得数据
|
||
function _cell.getData()
|
||
return mData
|
||
end
|
||
|
||
--------------------------------------------
|
||
return _cell
|