Пример #1
0
 protected virtual void OnEvaluateJavaScript(WWebView webView, string result)
 {
     if (status != null)
     {
         status.text = "OnEvaluateJavaScript : " + result;
     }
 }
Пример #2
0
 protected virtual void OnStartNavigation(WWebView webView, string url)
 {
     if (status != null)
     {
         status.text = "OnStartNavigation : " + url;
     }
 }
Пример #3
0
 protected virtual void OnNavigationFailed(WWebView webView, int code, string url)
 {
     if (status != null)
     {
         status.text = "OnNavigationFailed : errorcode: " + code;
     }
 }
Пример #4
0
 protected virtual void OnEvaluateJavaScript(WWebView webView, string result)
 {
     DebugLog.DebugLogInfo("00ff00", "OnEvaluateJavaScript");
     if (status != null)
     {
         status.text = "OnEvaluateJavaScript : " + result;
     }
 }
Пример #5
0
 protected virtual void OnStartNavigation(WWebView webView, string url)
 {
     DebugLog.DebugLogInfo("00ff00", "OnStartNavigation");
     if (status != null)
     {
         status.text = "OnStartNavigation : " + url;
     }
 }
Пример #6
0
 protected virtual void OnNavigationFailed(WWebView webView, int code, string url)
 {
     DebugLog.DebugLogInfo("00ff00", "OnNavigationFailed");
     if (status != null)
     {
         status.text = "OnNavigationFailed : errorcode: " + code;
     }
 }
Пример #7
0
    protected virtual void OnReceiveMessage(WWebView webView, string message)
    {
        DebugLog.DebugLogInfo("00ff00", "OnReceiveMessage");
        if (message == "wwebview://openfile/")
        {
            LoadLocalFile();
        }

        else if (message == "wwebview://loadstring/")
        {
            LoadHTML();
        }
    }
Пример #8
0
    public void InitWebView(WWebView webView)
    {
        webView.OnStartNavigation     += OnStartNavigation;
        webView.OnNavigationCompleted += OnNavigationCompleted;
        webView.OnNavigationFailed    += OnNavigationFailed;
        webView.OnReceiveMessage      += OnReceiveMessage;
        webView.OnEvaluateJavaScript  += OnEvaluateJavaScript;
        webView.OnClose += OnClose;

        webView.Initialize(new Vector4(0, 100f, 0, 0), new Vector2(x, y));
        //#if UNIWEBVIEW3_SUPPORTED
        //#else
        //webView.Initialize(new Vector4(0, margine, 0, margine), new Vector2(0, 0));
        //#endif
    }
Пример #9
0
    protected virtual void OnNavigationCompleted(WWebView webView, string data)
    {
        if (goBack != null)
        {
            goBack.interactable = webView.CanGoBack;
        }

        if (goForward != null)
        {
            goForward.interactable = webView.CanGoForward;
        }

        if (status != null)
        {
            status.text = "OnNavigationCompleted : " + data;
        }
    }
Пример #10
0
    protected virtual void OnReceiveMessage(WWebView webView, string message)
    {
        if (message == "wwebview://openfile/")
        {
            LoadLocalFile();
        }

        else if (message == "wwebview://loadstring/")
        {
            LoadHTML();
        }

        if (status != null)
        {
            status.text = "OnReceiveMessage : " + message;
        }
    }
Пример #11
0
    protected virtual bool OnClose(WWebView webView)
    {
        DebugLog.DebugLogInfo("00ff00", "OnClose");
//#if UNITY_EDITOR
        // NOTE: Keep in mind that you are just watching the DEMO now.
        // Destroy webview instance not WWebView component.
        webView.Destroy();

        // Don't destroy WWebView component for this demo.
        // In most cases, you will return true to remove the component.
        return(false);
//#else
//        // In "real" game, you will never quit your app since the webview is closed.
//        UnityEngine.Application.Quit();
//        return true;
//#endif
    }
Пример #12
0
    protected virtual bool OnClose(WWebView webView)
    {
        // NOTE: Keep in mind that you are now watching the "DEMO".
        // In most cases, you simply return true to destory the webview modules(instance & component)

        if (status != null)
        {
            status.text = "OnClose";
        }

#if UNITY_EDITOR
        // In Editor mode, only destroy the webview instance not component.
        // Don't destroy WWebView component in this demo.
        webView.Destroy();
        return(false);
#else
        // In "real" game, you will never quit your game even if the webview has been closed.
        UnityEngine.Application.Quit();
        return(true);
#endif
    }
Пример #13
0
 protected virtual void OnEvaluateJavaScript(WWebView webView, string result)
 {
     DebugLog.DebugLogInfo("00ff00", "OnEvaluateJavaScript");
 }
Пример #14
0
 protected virtual void OnStartNavigation(WWebView webView, string url)
 {
     DebugLog.DebugLogInfo("00ff00", "OnStartNavigation");
 }
Пример #15
0
 public void OnAddJavaScript(WWebView webView, string js_string)
 {
     webView.AddJavaScript(js_string);
 }
Пример #16
0
 protected virtual void OnNavigationFailed(WWebView webView, int code, string url)
 {
     DebugLog.DebugLogInfo("00ff00", "OnNavigationFailed");
 }
Пример #17
0
 protected virtual void OnNavigationCompleted(WWebView webView, string data)
 {
     DebugLog.DebugLogInfo("00ff00", "OnNavigationCompleted");
 }