【打开网页】添加打开内置浏览器和外部浏览器的配置,解决老包无法打开网页的问题

dev_chengFeng
gaoxin 2021-08-25 14:27:08 +08:00
parent c8a06d9c5d
commit f778b03879
4 changed files with 15 additions and 3 deletions

View File

@ -1991,3 +1991,14 @@ function encodeURI(s)
s = string.gsub(s, "([^%w%.%- ])", function(c) return string.format("%%%02X", string.byte(c)) end)
return string.gsub(s, " ", "+")
end
-- 通过浏览器打开网页
function OpenWeb(url)
if url then
if ServerConfigManager.IsSettingActive(ServerConfigManager.SettingConfig.INNER_WEB_CONTROL) then
SDKMgr:OpenWeb(url)
else
UnityEngine.Application.OpenURL(url)
end
end
end

View File

@ -23,6 +23,7 @@ ServerConfigManager.SettingConfig = {
USER_CHANNEL = "USER_CHANNEL", -- 获取登录信息渠道
USER_PROTO = "USER_PROTO", -- 用户协议功能是否开启
IS_NO_NOTICE = "IS_NO_NOTICE", -- 是否禁用公告
INNER_WEB_CONTROL = "INNER_WEB_CONTROL", -- 是否使用内置浏览器
}

View File

@ -68,7 +68,7 @@ function TaiChuMiJuanPanel:OnShow(...)
this.itemPres[i].bg.sprite = this.data[i].sprite
this.itemPres[i].bg:SetNativeSize()
Util.AddOnceClick(this.itemPres[i].go,function()
SDKMgr:OpenWeb(this.data[i].linkAddress)
OpenWeb(this.data[i].linkAddress)
end)
end
end

View File

@ -192,10 +192,10 @@ function this:BindEvent()
--用户隐私协议
Util.AddClick(this.instructionsBtn, function()
SDKMgr:OpenWeb(UrlList[1])
OpenWeb(UrlList[1])
end)
Util.AddClick(this.privacyBtn, function()
SDKMgr:OpenWeb(UrlList[2])
OpenWeb(UrlList[2])
end)
Util.AddClick(this.ConfirmBtn, function()
local confirm = PlayerPrefs.GetInt("IHaveConfirmProtos")