public void Resize(int _Width, int _Height)
    {
        m_Width  = _Width;
        m_Height = _Height;

        if (m_Texture == null)
        {
            m_Texture = new Texture2D(m_Width, m_Height, TextureFormat.RGBA32, false);
        }
        else
        {
            m_Texture.Resize(m_Width, m_Height, TextureFormat.RGBA32, false);
            m_Texture.Apply(false, false);
        }
        //m_Texture.filterMode = FilterMode.Point;

        if (m_WebView != null)
        {
            m_WebView.Resize(m_Width, m_Height);
        }
        else
        {
            m_WebView = AwesomiumUnityWebCore.CreateWebView(m_Width, m_Height);
        }
    }
Example #2
0
 // DO NOT CALL MANUALLY.
 public static void _QueueWebViewForRemoval(AwesomiumUnityWebView _WebView)
 {
     if (!m_WebViewsQueuedForRemoval.Contains(_WebView))
     {
         m_WebViewsQueuedForRemoval.Add(_WebView);
     }
 }
 void OnDestroy()
 {
     if (m_WebView != null)
     {
         m_WebView.Destroy();
         m_WebView = null;
     }
 }
 void OnApplicationQuit()
 {
     if (m_WebView != null)
     {
         m_WebView.Destroy();
         m_WebView = null;
     }
 }
Example #5
0
    public static void TriggerFinishLoadingFrame(System.IntPtr _WebViewInstance, System.Int64 _FrameID, bool _IsMainFrame, string _URL)
    {
        AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);

        if (view != null && view.FinishLoadingFrame != null)
        {
            view.FinishLoadingFrame(view, _URL, _FrameID, _IsMainFrame);
        }
    }
Example #6
0
    public static void TriggerDocumentReady(System.IntPtr _WebViewInstance, string _URL)
    {
        AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);

        if (view != null && view.DocumentReady != null)
        {
            view.DocumentReady(view, _URL);
        }
    }
Example #7
0
    public static void TriggerChangeAddressBar(System.IntPtr _WebViewInstance, string _URL)
    {
        AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);

        if (view != null && view.ChangeAddressBar != null)
        {
            view.ChangeAddressBar(view, _URL);
        }
    }
Example #8
0
    public static void TriggerAddConsoleMessage(System.IntPtr _WebViewInstance, string _Message, int _LineNumber, string _Source)
    {
        AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);

        if (view != null && view.AddConsoleMessage != null)
        {
            view.AddConsoleMessage(view, _Message, _LineNumber, _Source);
        }
    }
    public static AwesomiumUnityWebView RegisterExistingWebView(System.IntPtr _NativePtr)
    {
        foreach (AwesomiumUnityWebView wv in m_WebViews)
            if (wv.NativePtr == _NativePtr)
                return wv;

        AwesomiumUnityWebView new_wv = new AwesomiumUnityWebView(_NativePtr);
        m_WebViews.Add(new_wv);
        return new_wv;
    }
Example #10
0
    public static void TriggerShowCreatedWebView(System.IntPtr _WebViewInstance, System.IntPtr _NewInstance, string _OpenerURL, string _TargetURL, bool _IsPopUp)
    {
        AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);

        if (view != null && view.ShowCreatedWebView != null)
        {
            AwesomiumUnityWebView new_view = AwesomiumUnityWebCore.RegisterExistingWebView(_NewInstance);
            view.ShowCreatedWebView(view, new_view, _OpenerURL, _TargetURL, _IsPopUp);
        }
    }
Example #11
0
    public static void TriggerJavaScriptResultCallbackString(System.IntPtr _WebViewInstance, string _String, int _ExecutionID)
    {
        AwesomiumUnityWebView        caller    = null;
        JavaScriptExecutionCallbacks callbacks = FindJavaScriptCallbacksForExecutionID(_WebViewInstance, _ExecutionID, out caller);

        if (callbacks != null && callbacks.StringResult != null)
        {
            callbacks.StringResult(caller, _String);
        }
    }
Example #12
0
    public static void TriggerJavaScriptResultCallbackArray(System.IntPtr _WebViewInstance, int _Length, int _ExecutionID)
    {
        AwesomiumUnityWebView        caller    = null;
        JavaScriptExecutionCallbacks callbacks = FindJavaScriptCallbacksForExecutionID(_WebViewInstance, _ExecutionID, out caller);

        if (callbacks != null && callbacks.ArrayResult != null)
        {
            callbacks.ArrayResult(caller, _Length);
        }
    }
    void Init()
    {
        original_texture = (Texture2D)GetComponent <MeshRenderer>().sharedMaterial.mainTexture;
        web_view         = web_texture.WebView;

        cam.Render();
        RenderTexture.active = rendTexture;

        original_texture.ReadPixels(new Rect(0, 0, rendTexture.width, rendTexture.height), 0, 0);
        original_texture.Apply();

        this.StartCoroutineAsync(ocr_async());
    }
Example #14
0
    public static void TriggerJavaScriptExecFinished(System.IntPtr _WebViewInstance, int _ExecutionID)
    {
        AwesomiumUnityWebView        caller    = null;
        JavaScriptExecutionCallbacks callbacks = FindJavaScriptCallbacksForExecutionID(_WebViewInstance, _ExecutionID, out caller);

        if (callbacks != null && callbacks.ExecutionFinished != null)
        {
            callbacks.ExecutionFinished(caller);

            // Now that execution has finished we can remove the callbacks from our dictionary.
            caller.m_JavaScriptCallbacks.Remove(_ExecutionID);
        }
    }
    public static AwesomiumUnityWebView CreateWebView( int _Width, int _Height )
    {
        if (!IsRunning)
        {
            Debug.LogError("You must call AwesomiumUnityWebCore.Initialize() before attempting to use the webcore");
            return null;
        }

        System.IntPtr intPtr = awe_webcore_createwebview(_Width, _Height);
        AwesomiumUnityWebView webView = new AwesomiumUnityWebView(intPtr);
        m_WebViews.Add(webView);
        return webView;
    }
Example #16
0
    public static void TriggerJavaScriptMethodCall(System.IntPtr _WebViewInstance, string _MethodName)
    {
        AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);

        if (view != null)
        {
            view.CallBoundJavaScriptCallback(_MethodName);
        }
        else
        {
            Debug.LogWarning("TriggerJavaScriptMethodCall: Could not find a matching AwesomiumUnityWebView even though there should exist one!");
        }
    }
Example #17
0
    void myShowCreatedWebView(AwesomiumUnityWebView _Caller, AwesomiumUnityWebView _NewView, string _OpenerURL, string _TargetURL, bool _IsPopUp)
    {
        Debug.Log("Created new web view from '" + _OpenerURL + "' to target '" + _TargetURL + "' (is popup: " + _IsPopUp + ").");

        if (m_Prefab != null)
        {
            GameObject go = GameObject.Instantiate (m_Prefab) as GameObject;
            AwesomiumUnityWebTexture webtexture = go.GetComponent<AwesomiumUnityWebTexture> ();
            webtexture.m_Width = 1280;
            webtexture.m_Height = 720;
            webtexture.WebView = _NewView;
            webtexture.Initialize();
        }
    }
Example #18
0
    void myShowCreatedWebView(AwesomiumUnityWebView _Caller, AwesomiumUnityWebView _NewView, string _OpenerURL, string _TargetURL, bool _IsPopUp)
    {
        Debug.Log("Created new web view from '" + _OpenerURL + "' to target '" + _TargetURL + "' (is popup: " + _IsPopUp + ").");

        if (m_Prefab != null)
        {
            GameObject go = GameObject.Instantiate(m_Prefab) as GameObject;
            AwesomiumUnityWebTexture webtexture = go.GetComponent <AwesomiumUnityWebTexture> ();
            webtexture.m_Width  = 1280;
            webtexture.m_Height = 720;
            webtexture.WebView  = _NewView;
            webtexture.Initialize();
        }
    }
Example #19
0
 void myFinishLoadingCallback(AwesomiumUnityWebView _Caller, string url, System.Int64 frameid, bool ismainframe)
 {
     Debug.Log("Finished loading URL: " + url + ", frameid: " + frameid + ", ismainframe: " + ismainframe);
 }
Example #20
0
 void Callback_PlayGame(AwesomiumUnityWebView _Caller)
 {
     Debug.Log("CLICKED PLAY GAME!");
 }
Example #21
0
 void JSStringResultCallback(AwesomiumUnityWebView _Caller, string _String)
 {
     Debug.Log ("JS Result: " + _String);
 }
Example #22
0
 void myChangeAddressBarCallback(AwesomiumUnityWebView _Caller, string url)
 {
     Debug.Log("Changed url to: " + url);
 }
Example #23
0
 void Callback_GoToOptions(AwesomiumUnityWebView _Caller)
 {
     Debug.Log("CLICKED OPTIONS!");
 }
Example #24
0
 void myFinishLoadingCallback(AwesomiumUnityWebView _Caller, string url, System.Int64 frameid, bool ismainframe)
 {
     Debug.Log ("Finished loading URL: " + url + ", frameid: " + frameid + ", ismainframe: " + ismainframe);
 }
 void OnDestroy()
 {
     if (m_WebView != null)
     {
         m_WebView.Destroy();
         m_WebView = null;
     }
 }
    public void Resize( int _Width, int _Height )
    {
        m_Width = _Width;
        m_Height = _Height;

        if (m_Texture == null)
        {
            m_Texture = new Texture2D(m_Width, m_Height, TextureFormat.RGBA32, false);
        }
        else
        {
            m_Texture.Resize(m_Width, m_Height, TextureFormat.RGBA32, false);
            m_Texture.Apply(false, false);
        }
        //m_Texture.filterMode = FilterMode.Point;

        if (m_WebView != null)
        {
            m_WebView.Resize(m_Width, m_Height);
        }
        else
        {
            m_WebView = AwesomiumUnityWebCore.CreateWebView(m_Width, m_Height);
        }
    }
Example #27
0
    private static JavaScriptExecutionCallbacks FindJavaScriptCallbacksForExecutionID(System.IntPtr _WebViewInstance, int _ExecutionID, out AwesomiumUnityWebView _Caller)
    {
        _Caller = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);
        JavaScriptExecutionCallbacks callbacks = null;

        if (_Caller != null)
        {
            _Caller.m_JavaScriptCallbacks.TryGetValue(_ExecutionID, out callbacks);
        }

        return(callbacks);
    }
 // DO NOT CALL MANUALLY.
 public static void _QueueWebViewForRemoval( AwesomiumUnityWebView _WebView )
 {
     if (!m_WebViewsQueuedForRemoval.Contains(_WebView))
         m_WebViewsQueuedForRemoval.Add(_WebView);
 }
    public static AwesomiumUnityWebView RegisterExistingWebView(System.IntPtr _NativePtr)
    {
        foreach (AwesomiumUnityWebView wv in m_WebViews)
            if (wv.NativePtr == _NativePtr)
                return wv;

        AwesomiumUnityWebView new_wv = new AwesomiumUnityWebView(_NativePtr);
        m_WebViews.Add(new_wv);
        return new_wv;
    }
Example #30
0
 void Callback_PlayGame(AwesomiumUnityWebView _Caller)
 {
     Debug.Log("CLICKED PLAY GAME!");
 }
Example #31
0
 void Callback_QuitGame(AwesomiumUnityWebView _Caller)
 {
     Debug.Log("CLICKED QUIT GAME!");
 }
 void OnApplicationQuit()
 {
     if (m_WebView != null)
     {
         m_WebView.Destroy();
         m_WebView = null;
     }
 }
Example #33
0
 void Callback_GoToOptions(AwesomiumUnityWebView _Caller)
 {
     Debug.Log("CLICKED OPTIONS!");
 }
    private static JavaScriptExecutionCallbacks FindJavaScriptCallbacksForExecutionID(System.IntPtr _WebViewInstance, int _ExecutionID, out AwesomiumUnityWebView _Caller)
    {
        _Caller = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance);
        JavaScriptExecutionCallbacks callbacks = null;
        if (_Caller != null)
            _Caller.m_JavaScriptCallbacks.TryGetValue(_ExecutionID, out callbacks);

        return callbacks;
    }
 // DO NOT CALL MANUALLY.
 public static void _QueueWebViewForRemoval( AwesomiumUnityWebView _WebView )
 {
     m_WebViewsQueuedForRemoval.Add(_WebView);
 }
Example #36
0
 void Callback_QuitGame(AwesomiumUnityWebView _Caller)
 {
     Debug.Log("CLICKED QUIT GAME!");
 }
Example #37
0
 void JSStringResultCallback(AwesomiumUnityWebView _Caller, string _String)
 {
     Debug.Log("JS Result: " + _String);
 }
    public static AwesomiumUnityWebView CreateWebView( int _Width, int _Height )
    {
        if (!IsRunning)
        {
            Debug.LogError("You must call AwesomiumUnityWebCore.Initialize() before attempting to use the webcore");
            return null;
        }

        System.IntPtr intPtr = awe_webcore_createwebview(_Width, _Height);
        AwesomiumUnityWebView webView = new AwesomiumUnityWebView(intPtr);
        m_WebViews.Add(webView);
        return webView;
    }
Example #39
0
 void myChangeAddressBarCallback(AwesomiumUnityWebView _Caller, string url)
 {
     Debug.Log ("Changed url to: " + url);
 }