-- xx界面 local CLLPSendSms = {} ---@type Coolape.CLPanelLua local csSelf = nil ---@type UnityEngine.Transform local transform = nil local uiobjs = {} ---@type _DBCust local mdata -- 初始化,只会调用一次 function CLLPSendSms.init(csObj) csSelf = csObj transform = csObj.transform ---@type CLUIFormRoot uiobjs.offset = getCC(transform, "Bottom/offset", "CLUIFormRoot") uiobjs.InputContentCell = getCC(uiobjs.offset.transform, "InputContent", "CLCellLua") local attr = {} attr.attrName = "短信内容" attr.id = "body" attr.attrType = DBCust.FieldType.multext attr.ifMust = 1 attr.donotJoinKey = true ---@type _ParamCellExtendFiled local param = {} param.attr = attr uiobjs.InputContentCell:init(param, nil) end -- 设置数据 function CLLPSendSms.setData(paras) mdata = paras end --当有通用背板显示时的回调 function CLLPSendSms.onShowFrame() end -- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh function CLLPSendSms.show() uiobjs.offset:setValue({}) end -- 刷新 function CLLPSendSms.refresh() end -- 关闭页面 function CLLPSendSms.hide() end -- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据 function CLLPSendSms.procNetwork(cmd, succ, msg, paras) --[[ if(succ == NetSuccess) then if(cmd == "xxx") then -- TODO: end end --]] end -- 处理ui上的事件,例如点击等 function CLLPSendSms.uiEventDelegate(go) local goName = go.name if goName == "ButtonClose" then hideTopPanel(csSelf) elseif goName == "ButtonYunSend" then local err = uiobjs.offset:checkValid() if not isNilOrEmpty(err) then MyUtl.toastW(err) return end local data = uiobjs.offset:getValue(true) MyUtl.toastW("//TODO:云发短信的接口") elseif goName == "ButtonNativeSend" then local err = uiobjs.offset:checkValid() if not isNilOrEmpty(err) then MyUtl.toastW(err) return end local data = uiobjs.offset:getValue(true) Application.OpenURL(joinStr("sms:", mdata.phoneNo, "?body=", data.body)) end end -- 当顶层页面发生变化时回调 function CLLPSendSms.onTopPanelChange(topPanel) end -- 当按了返回键时,关闭自己(返值为true时关闭) function CLLPSendSms.hideSelfOnKeyBack() if NetProto and csSelf then NetProto.removePanelListener(csSelf) end return true end -------------------------------------------- return CLLPSendSms