fix:1、H5方案改为我们自己的sdk,跳转电商也是。2、同步部分ios的优化
This commit is contained in:
@@ -19,7 +19,7 @@ public class FreeWebViewManager : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initView();
|
||||
// initView();
|
||||
}
|
||||
|
||||
public void initView()
|
||||
@@ -60,28 +60,28 @@ public class FreeWebViewManager : MonoBehaviour
|
||||
{
|
||||
// if (_webObj != null) return;
|
||||
//
|
||||
// // 创建WebView对象
|
||||
// _webObj = new GameObject("WebViewObject1");
|
||||
// _webView = _webObj.AddComponent<WebViewObject1>();
|
||||
//
|
||||
// // 关键:开启WKWebView,规避苹果审核拒绝
|
||||
// _webView.Init(
|
||||
// enableWKWebView: true,
|
||||
// cb: OnWebMessage // JS调用Unity回调
|
||||
// );
|
||||
//
|
||||
// float top_offset = 0;//fgui中的顶部信息的高度
|
||||
// float buttom_offset = 155;
|
||||
// if (Screen.safeArea.y != 0)
|
||||
// {//刘海屏
|
||||
// top_offset += Screen.safeArea.y;
|
||||
// }
|
||||
//
|
||||
// // 铺满屏幕,适配刘海安全区
|
||||
// _webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
|
||||
// // 禁止下拉回弹(可选)
|
||||
// _webView.SetScrollBounceEnabled(false);
|
||||
//
|
||||
// 创建WebView对象
|
||||
_webObj = new GameObject("WebViewObject1");
|
||||
_webView = _webObj.AddComponent<WebViewObject1>();
|
||||
|
||||
// 关键:开启WKWebView,规避苹果审核拒绝
|
||||
_webView.Init(
|
||||
enableWKWebView: true,
|
||||
cb: OnWebMessage // JS调用Unity回调
|
||||
);
|
||||
|
||||
float top_offset = 0;//fgui中的顶部信息的高度
|
||||
float buttom_offset = 155;
|
||||
if (Screen.safeArea.y != 0)
|
||||
{//刘海屏
|
||||
top_offset += Screen.safeArea.y;
|
||||
}
|
||||
|
||||
// 铺满屏幕,适配刘海安全区
|
||||
_webView.SetMargins(0, (int)top_offset, 0, (int)buttom_offset);
|
||||
// 禁止下拉回弹(可选)
|
||||
_webView.SetScrollBounceEnabled(false);
|
||||
|
||||
// 加载网页并显示
|
||||
_webView.LoadURL(url);
|
||||
_webView.SetVisibility(true);
|
||||
@@ -105,10 +105,7 @@ public class FreeWebViewManager : MonoBehaviour
|
||||
/// </summary>
|
||||
public void CloseWeb()
|
||||
{
|
||||
if (_webObj != null)
|
||||
{
|
||||
_webView.SetVisibility(false);
|
||||
}
|
||||
OnDestroy();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
||||
Reference in New Issue
Block a user