up
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
-- 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 TweenAlpha
|
||||
uiobjs.tweenAlpha = csSelf:GetComponent("TweenAlpha")
|
||||
uiobjs.Label = getCC(transform, "Label", "UILabel")
|
||||
uiobjs.SpriteIcon = getCC(transform, "SpriteIcon", "UISprite")
|
||||
end
|
||||
|
||||
-- 显示,
|
||||
-- 注意,c#侧不会在调用show时,调用refresh
|
||||
function _cell.show(go, data)
|
||||
mData = data
|
||||
uiobjs.Label.text = trim(data.msg)
|
||||
local spriteName = ""
|
||||
local colorIcon
|
||||
if mData.type == CLToastRoot.Type.success then
|
||||
spriteName = "cust_suc"
|
||||
colorIcon = Color.green
|
||||
elseif mData.type == CLToastRoot.Type.warning then
|
||||
spriteName = "cust_suc"
|
||||
colorIcon = Color.yellow
|
||||
elseif mData.type == CLToastRoot.Type.error then
|
||||
spriteName = "cust_suc"
|
||||
colorIcon = Color.red
|
||||
else
|
||||
spriteName = "cust_suc"
|
||||
colorIcon = Color.white
|
||||
end
|
||||
uiobjs.SpriteIcon.color = colorIcon
|
||||
uiobjs.SpriteIcon.spriteName = spriteName
|
||||
uiobjs.tweenAlpha.delay = mData.staySec or 1
|
||||
uiobjs.tweenAlpha:ResetToBeginning()
|
||||
uiobjs.tweenAlpha:Play(true)
|
||||
end
|
||||
|
||||
-- 取得数据
|
||||
function _cell.getData()
|
||||
return mData
|
||||
end
|
||||
|
||||
--------------------------------------------
|
||||
return _cell
|
||||
Reference in New Issue
Block a user