public void Initialize()
    {
        m_HasBeenInitialized = true;

        AwesomiumUnityWebCore.EnsureInitialized();

        // Call resize which will create a texture and a webview for us if they do not exist yet at this point.
        Resize(m_Width, m_Height);

        if (guiTexture)
        {
            guiTexture.texture = m_Texture;
        }
        else if (renderer && renderer.material)
        {
            renderer.material.mainTexture      = m_Texture;
            renderer.material.mainTextureScale = new Vector2(Mathf.Abs(renderer.material.mainTextureScale.x) * (m_FlipX ? -1.0f : 1.0f),
                                                             Mathf.Abs(renderer.material.mainTextureScale.y) * (m_FlipY ? -1.0f : 1.0f));
        }
        else
        {
            Debug.LogWarning("There is no Renderer or guiTexture attached to this GameObject! AwesomiumUnityWebTexture will render to a texture but it will not be visible.");
        }

        m_WebView.SetTransparent(m_Transparent);
    }
    public void Destroy()
    {
        awe_webview_destroy(m_Instance);
        m_Instance = System.IntPtr.Zero;

        AwesomiumUnityWebCore._QueueWebViewForRemoval(this);
    }
    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);
        }
    }
 void DoShutdown()
 {
     if (AwesomiumUnityWebCore.IsRunning)
     {
         AwesomiumUnityWebCore.Shutdown();
     }
 }
示例#5
0
    public void Initialize()
    {
        m_HasBeenInitialized = true;

        if (!m_Is_KeyCodeList_Initialized)
        {
            InitializeKeyLists();
            m_Is_KeyCodeList_Initialized = true;
        }

        AwesomiumUnityWebCore.EnsureInitialized();

        // Call resize which will create a texture and a webview for us if they do not exist yet at this point.
        Resize(m_Width, m_Height);

        m_RawImage = GetComponent <RawImage>();
        if (m_RawImage)
        {
            m_RawImage.texture = m_Texture;
        }
        else
        {
            Debug.LogWarning("There is no RawImage attached to this GameObject! AwesomiumUnityWebTextureUGUI will add RawImage component in order to render to a VISIBLE texture.");
            m_RawImage         = gameObject.AddComponent <RawImage>();
            m_RawImage.texture = m_Texture;
        }

        m_WebView.SetTransparent(m_Transparent);
    }
示例#6
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);
        }
    }
示例#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);
        }
    }
示例#8
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);
        }
    }
示例#9
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);
        }
    }
示例#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);
        }
    }
示例#11
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);
    }
    /*void OnEnable()
     * {
     #if UNITY_EDITOR
     *      EditorApplication.playmodeStateChanged += StateChange;
     #endif
     * }
     *
     #if UNITY_EDITOR
     * void StateChange()
     * {
     *      if (EditorApplication.isPlayingOrWillChangePlaymode && EditorApplication.isPlaying) {
     *
     *                      }
     *
     * }
     #endif
     *
     *
     * void OnDisable()
     * {
     #if UNITY_EDITOR
     *      EditorApplication.playmodeStateChanged -= StateChange;
     #endif
     * }*/

    void Awake()
    {
        if (m_Instance != null)
        {
            Debug.LogError("An instance of AwesomiumUnityWebCoreHelper already exists!");
            DestroyImmediate(this);
        }

        m_Instance = this;
        AwesomiumUnityWebCore.EnsureInitialized();
        DontDestroyOnLoad(this.gameObject);
    }
示例#13
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!");
        }
    }
    // Use this for initialization
    void Awake()
    {
        //example0 = GetComponent<Example0>();
        handControll = refObect.GetComponent <HandControllerStreetView>();

        if (!AwesomiumUnityWebCore.IsRunning)
        {
            AwesomiumUnityWebCore.Initialize();
        }
        AwesomiumUnityWebCore.CreateWebCoreHelper();

        // Call resize which will create a texture and a webview for us since both do not exist yet at this point.
        Resize(m_Width, m_Height);

        if (GetComponent <GUITexture>())
        {
            GetComponent <GUITexture>().texture = m_Texture;
        }
        else if (GetComponent <Renderer>() && GetComponent <Renderer>().material)
        {
            GetComponent <Renderer>().material.mainTexture      = m_Texture;
            GetComponent <Renderer>().material.mainTextureScale = new Vector2(Mathf.Abs(GetComponent <Renderer>().material.mainTextureScale.x) * (m_FlipX ? -1.0f : 1.0f),
                                                                              Mathf.Abs(GetComponent <Renderer>().material.mainTextureScale.y) * (m_FlipY ? -1.0f : 1.0f));
        }
        else
        {
            Debug.LogWarning("There is no Renderer or guiTexture attached to this GameObject! AwesomiumUnityWebTexture will render to a texture but it will not be visible.");
        }

        // Now load the URL.
        // IMPORTANT: For some reason, a WebView MUST have loaded something atleast ONCE before calling ANY other function on it (think input injection).
        // Therefore, there is no option available to delay the loading of the URL and it is forced in this constructor. (Note how we wait until the loading
        // is complete before we exit the constructor).
        LoadURL(m_URL);

        while (m_WebView.IsLoading)
        {
            AwesomiumUnityWebCore.Update();
        }

        m_WebView.SetTransparent(m_Transparent);
    }
示例#15
0
 public void Destroy()
 {
     AwesomiumUnityWebCore._QueueWebViewForRemoval(this);
 }
 void Update()
 {
     AwesomiumUnityWebCore.Update();
 }