2020-07-04 14:41:25 +08:00
|
|
|
|
-- xx界面
|
|
|
|
|
|
local CLLPWebView = {}
|
|
|
|
|
|
|
|
|
|
|
|
---@type Coolape.CLPanelLua
|
|
|
|
|
|
local csSelf = nil
|
|
|
|
|
|
---@type UnityEngine.Transform
|
|
|
|
|
|
local transform = nil
|
|
|
|
|
|
local uiobjs = {}
|
|
|
|
|
|
local url
|
|
|
|
|
|
local webView
|
|
|
|
|
|
|
|
|
|
|
|
-- 初始化,只会调用一次
|
|
|
|
|
|
function CLLPWebView.init(csObj)
|
|
|
|
|
|
csSelf = csObj
|
|
|
|
|
|
transform = csObj.transform
|
|
|
|
|
|
webView = csSelf:GetComponent("UWebView")
|
|
|
|
|
|
webView:init(
|
|
|
|
|
|
CLLPWebView.onCallFromJS,
|
|
|
|
|
|
CLLPWebView.onCallOnError,
|
|
|
|
|
|
CLLPWebView.onCallOnStarted,
|
|
|
|
|
|
CLLPWebView.onCallOnLoaded
|
|
|
|
|
|
)
|
2020-07-11 20:53:21 +08:00
|
|
|
|
webView:setMargins(0, NumEx.getIntPart(134 / MyUtl.getSizeAdjust()), 0, 0)
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 设置数据
|
|
|
|
|
|
function CLLPWebView.setData(paras)
|
|
|
|
|
|
url = paras and paras.url or ""
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2020-07-11 20:53:21 +08:00
|
|
|
|
---public 当有通用背板显示时的回调
|
|
|
|
|
|
---@param cs Coolape.CLPanelLua
|
|
|
|
|
|
function CLLPWebView.onShowFrame(cs)
|
|
|
|
|
|
if cs.frameObj then
|
|
|
|
|
|
---@type _BGFrame1Param
|
|
|
|
|
|
local d = {}
|
|
|
|
|
|
-- d.title = LGet(cs.titleKeyName)
|
|
|
|
|
|
d.title = cs.titleKeyName
|
|
|
|
|
|
d.panel = csSelf
|
|
|
|
|
|
cs.frameObj:init(d)
|
|
|
|
|
|
end
|
2020-07-04 14:41:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function CLLPWebView.onCallFromJS(msg)
|
|
|
|
|
|
end
|
|
|
|
|
|
function CLLPWebView.onCallOnError(msg)
|
|
|
|
|
|
end
|
|
|
|
|
|
function CLLPWebView.onCallOnStarted(msg)
|
|
|
|
|
|
hideHotWheel()
|
|
|
|
|
|
end
|
|
|
|
|
|
function CLLPWebView.onCallOnLoaded(msg)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 显示,在c#中。show为调用refresh,show和refresh的区别在于,当页面已经显示了的情况,当页面再次出现在最上层时,只会调用refresh
|
|
|
|
|
|
function CLLPWebView.show()
|
|
|
|
|
|
webView:setVisibility(true)
|
|
|
|
|
|
showHotWheel()
|
|
|
|
|
|
webView:loadUrl(url)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 刷新
|
|
|
|
|
|
function CLLPWebView.refresh()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 关闭页面
|
|
|
|
|
|
function CLLPWebView.hide()
|
|
|
|
|
|
webView:setVisibility(false)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 网络请求的回调;cmd:指命,succ:成功失败,msg:消息;paras:服务器下行数据
|
|
|
|
|
|
function CLLPWebView.procNetwork(cmd, succ, msg, paras)
|
|
|
|
|
|
--[[
|
|
|
|
|
|
if(succ == NetSuccess) then
|
|
|
|
|
|
if(cmd == "xxx") then
|
|
|
|
|
|
-- TODO:
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
--]]
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 处理ui上的事件,例如点击等
|
|
|
|
|
|
function CLLPWebView.uiEventDelegate(go)
|
|
|
|
|
|
local goName = go.name
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 当顶层页面发生变化时回调
|
|
|
|
|
|
function CLLPWebView.onTopPanelChange(topPanel)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- 当按了返回键时,关闭自己(返值为true时关闭)
|
|
|
|
|
|
function CLLPWebView.hideSelfOnKeyBack()
|
|
|
|
|
|
return true
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------
|
|
|
|
|
|
return CLLPWebView
|