This commit is contained in:
2020-07-11 22:04:22 +08:00
parent ac03de0387
commit dcd1c82477
33 changed files with 827 additions and 738 deletions

13
Assets/3rd/unity-webview/Scripts/UWebView.cs Executable file → Normal file
View File

@@ -22,6 +22,7 @@ using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using Coolape;
using System;
public class UWebView : MonoBehaviour
{
@@ -149,7 +150,7 @@ public class UWebView : MonoBehaviour
#if !UNITY_WEBPLAYER && !UNITY_WEBGL
if (Url.StartsWith("http") || Url.StartsWith("file:"))
{
webViewObject.LoadURL(Url.Replace(" ", "%20"));
webViewObject.LoadURL(Uri.EscapeUriString(Url));
}
else
{
@@ -181,17 +182,17 @@ public class UWebView : MonoBehaviour
//System.IO.File.WriteAllBytes(dst, result);
if (ext == ".html")
{
Debug.Log("file://" + dst.Replace(" ", "%20"));
webViewObject.LoadURL("file://" + dst.Replace(" ", "%20"));
Debug.Log("file://" + Uri.EscapeUriString(dst));
webViewObject.LoadURL("file://" + Uri.EscapeUriString(dst));
break;
}
}
}
#else
if (Url.StartsWith("http") || Url.StartsWith("file:")) {
webViewObject.LoadURL(Url.Replace(" ", "%20"));
webViewObject.LoadURL(Uri.EscapeUriString(Url));
} else {
webViewObject.LoadURL("StreamingAssets/" + Url.Replace(" ", "%20"));
webViewObject.LoadURL("StreamingAssets/" + Uri.EscapeUriString(Url));
}
webViewObject.EvaluateJS(
"parent.$(function() {" +
@@ -202,7 +203,7 @@ public class UWebView : MonoBehaviour
" };" +
"});");
#endif
}
}
public void goBack()
{