private void HandleControllerInput()
    {
        GameObject hand = GameObject.Find("hand_right");

        Ray        ray = new Ray(hand.transform.position, hand.transform.forward);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit) == false)
        {
            return;
        }

        var mouseScroll = Vector2.zero;

        mouseScroll += OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);
        mouseScroll += OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);

        Vector2 currentCursorPosition = new Vector2();

        currentCursorPosition.x = hit.textureCoord.x;
        currentCursorPosition.y = 1f - hit.textureCoord.y;

        if (currentCursorPosition != _prevCursorPosition)
        {
            BrowserNative.zfb_mouseMove(_browser.browserId, currentCursorPosition.x, currentCursorPosition.y);
        }

        _prevCursorPosition = currentCursorPosition;

        if (mouseScroll.sqrMagnitude != 0)
        {
            BrowserNative.zfb_mouseScroll(
                _browser.browserId,
                (int)(mouseScroll.x * _scrollSpeed), (int)(mouseScroll.y * _scrollSpeed)
                );
        }

        if (OVRInput.GetUp(OVRInput.RawButton.A))
        {
            Debug.Log("click");
            BrowserNative.zfb_mouseButton(
                _browser.browserId
                , BrowserNative.MouseButton.MBT_LEFT
                , false
                , 0
                );
        }

        if (OVRInput.GetDown(OVRInput.RawButton.A))
        {
            Debug.Log("down");
            BrowserNative.zfb_mouseButton(
                _browser.browserId
                , BrowserNative.MouseButton.MBT_LEFT
                , true
                , 1
                );
        }
    }
 public void Close()
 {
     if (webViewComponentController != null)
     {
         webViewComponentController.OnWebViewShouldClose     -= onWebViewShouldClose;
         webViewComponentController.OnLoadComplete           -= onLoadComplete;
         webViewComponentController.OnEvalJavaScriptFinished -= onEvalJavaScriptFinished;
         webViewComponentController.OnReceivedMessage        -= onReceivedMessage;
         webViewComponentController.Close();
         BrowserNative.DestroyAllBrowsers();
     }
     this.OnClosed.InvokeSafe();
     if (instantiatedPrefab != null)
     {
         UnityEngine.Object.Destroy(instantiatedPrefab);
     }
 }
Example #3
0
    void OnClick()
    {
        Debug.Log("down");
        BrowserNative.zfb_mouseButton(
            _browser.browserId
            , BrowserNative.MouseButton.MBT_LEFT
            , true
            , 1
            );

        Debug.Log("click");
        BrowserNative.zfb_mouseButton(
            _browser.browserId
            , BrowserNative.MouseButton.MBT_LEFT
            , false
            , 0
            );
    }
Example #4
0
    private IEnumerator PlayToggle()
    {
        while (_browser.IsLoaded == false || _browser.IsReady == false)
        {
            yield return(null);
        }

        BrowserNative.zfb_mouseButton(
            _browser.browserId
            , BrowserNative.MouseButton.MBT_LEFT
            , true
            , 1
            );

        BrowserNative.zfb_mouseButton(
            _browser.browserId
            , BrowserNative.MouseButton.MBT_LEFT
            , false
            , 0
            );
    }
Example #5
0
 void OnMoveOver(RaycastHit hit)
 {
     BrowserNative.zfb_mouseMove(_browser.browserId, hit.textureCoord.x, 1 - hit.textureCoord.y);
 }