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); } }
// 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; } }
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); } }
public static void TriggerDocumentReady(System.IntPtr _WebViewInstance, string _URL) { AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance); if (view != null && view.DocumentReady != null) { view.DocumentReady(view, _URL); } }
public static void TriggerChangeAddressBar(System.IntPtr _WebViewInstance, string _URL) { AwesomiumUnityWebView view = AwesomiumUnityWebCore.FindWebViewByNativePtr(_WebViewInstance); if (view != null && view.ChangeAddressBar != null) { view.ChangeAddressBar(view, _URL); } }
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; }
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); } }
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); } }
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()); }
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; }
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!"); } }
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(); } }
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(); } }
void myFinishLoadingCallback(AwesomiumUnityWebView _Caller, string url, System.Int64 frameid, bool ismainframe) { Debug.Log("Finished loading URL: " + url + ", frameid: " + frameid + ", ismainframe: " + ismainframe); }
void Callback_PlayGame(AwesomiumUnityWebView _Caller) { Debug.Log("CLICKED PLAY GAME!"); }
void JSStringResultCallback(AwesomiumUnityWebView _Caller, string _String) { Debug.Log ("JS Result: " + _String); }
void myChangeAddressBarCallback(AwesomiumUnityWebView _Caller, string url) { Debug.Log("Changed url to: " + url); }
void Callback_GoToOptions(AwesomiumUnityWebView _Caller) { Debug.Log("CLICKED OPTIONS!"); }
void myFinishLoadingCallback(AwesomiumUnityWebView _Caller, string url, System.Int64 frameid, bool ismainframe) { Debug.Log ("Finished loading URL: " + url + ", frameid: " + frameid + ", ismainframe: " + ismainframe); }
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); } }
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); }
void Callback_QuitGame(AwesomiumUnityWebView _Caller) { Debug.Log("CLICKED QUIT GAME!"); }
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); }
void JSStringResultCallback(AwesomiumUnityWebView _Caller, string _String) { Debug.Log("JS Result: " + _String); }
void myChangeAddressBarCallback(AwesomiumUnityWebView _Caller, string url) { Debug.Log ("Changed url to: " + url); }