2020-07-09 08:50:24 +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
|
|
|
|
|
|
---@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
|
2020-07-09 09:23:09 +08:00
|
|
|
|
spriteName = "public_tips_2"
|
2020-07-09 08:50:24 +08:00
|
|
|
|
colorIcon = Color.green
|
|
|
|
|
|
elseif mData.type == CLToastRoot.Type.warning then
|
2020-07-09 09:23:09 +08:00
|
|
|
|
spriteName = "public_tips_3"
|
2020-07-09 08:50:24 +08:00
|
|
|
|
colorIcon = Color.yellow
|
|
|
|
|
|
elseif mData.type == CLToastRoot.Type.error then
|
2020-07-09 09:23:09 +08:00
|
|
|
|
spriteName = "public_tips_4"
|
2020-07-09 08:50:24 +08:00
|
|
|
|
colorIcon = Color.red
|
|
|
|
|
|
else
|
2020-07-09 09:23:09 +08:00
|
|
|
|
spriteName = "public_tips_1"
|
2020-07-09 08:50:24 +08:00
|
|
|
|
colorIcon = Color.white
|
|
|
|
|
|
end
|
|
|
|
|
|
uiobjs.SpriteIcon.color = colorIcon
|
2020-07-09 09:23:09 +08:00
|
|
|
|
CLUIUtl.setSpriteFit(uiobjs.SpriteIcon, spriteName)
|
2020-07-09 08:50:24 +08:00
|
|
|
|
uiobjs.tweenAlpha.delay = mData.staySec or 1
|
|
|
|
|
|
uiobjs.tweenAlpha:ResetToBeginning()
|
|
|
|
|
|
uiobjs.tweenAlpha:Play(true)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 取得数据
|
|
|
|
|
|
function _cell.getData()
|
|
|
|
|
|
return mData
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
return _cell
|