-- 通用ui框1 ---@class _BGFrame1Param init时传入参数 ---@field title string 标题 ---@field isHideCloseBtn boolean 是否隐藏关闭按钮 ---@field closeCallback function 关闭回调 ---@field panel CLPanelLua 所在的Panel local _cell = {} local csSelf = nil local transform = nil local mData = nil local uiobjs = {} -- 初始化,只调用一次 function _cell.init(csObj) csSelf = csObj transform = csSelf.transform ---@type UISprite uiobjs.bg = csSelf:GetComponent("UISprite") -- uiobjs.topBg = getCC(transform, "top", "UISprite") -- uiobjs.topBg.width = NumEx.getIntPart(MyUtl.getSizeAdjust() * Screen.width) uiobjs.LabelTitle = getCC(transform, "top/LabelTitle", "UILabel") uiobjs.bg.width = NumEx.getIntPart(MyUtl.getSizeAdjust() * Screen.width) uiobjs.bg.height = NumEx.getIntPart(MyUtl.getSizeAdjust() * Screen.height) uiobjs.ButtonClose = getCC(transform, "top/ButtonClose", "UISprite") end -- 显示, -- 注意,c#侧不会在调用show时,调用refresh function _cell.show(go, data) mData = data uiobjs.LabelTitle.text = mData.title SetActive(uiobjs.ButtonClose.gameObject, not (mData.isHideCloseBtn or false)) end function _cell.uiEventDelegate(go) local goName = go.name if goName == "ButtonClose" then if mData.closeCallback then Utl.doCallback(mData.closeCallback) else hideTopPanel(mData.panel) end end end -- 取得数据 function _cell.getData() return mData end -------------------------------------------- return _cell