Ejemplo n.º 1
0
 void Start()
 {
     // Create a 0.6 x 0.3 instance of the prefab.
     _webViewPrefab = WebViewPrefab.Instantiate(0.6f, 0.3f);
     _webViewPrefab.transform.parent           = transform;
     _webViewPrefab.InitialResolution          = 1300f;
     _webViewPrefab.transform.localPosition    = new Vector3(0, 0.2f, 1);
     _webViewPrefab.transform.localEulerAngles = new Vector3(0, 180, 0);
     _webViewPrefab.Initialized += (sender, e) => {
         _webViewPrefab.WebView.LoadUrl("https://congility.com");
     };
 }
Ejemplo n.º 2
0
    void Update()
    {
        if (spawnedObject != null)
        {
            return;
        }

        if (Input.touchCount > 0)
        {
            Touch touch = Input.GetTouch(0);

            if (m_RaycastManager.Raycast(touch.position, s_Hits, TrackableType.PlaneWithinPolygon))
            {
                Pose hitPose = s_Hits[0].pose;

                // Create a 0.6 x 0.3 instance of the prefab.
                var webViewPrefab = WebViewPrefab.Instantiate(0.6f, 0.3f);
                spawnedObject = webViewPrefab.gameObject;
                webViewPrefab.transform.position = new Vector3(
                    hitPose.position.x,
                    hitPose.position.y + 0.7f,
                    hitPose.position.z
                    );
                webViewPrefab.transform.rotation = hitPose.rotation;
                webViewPrefab.transform.Rotate(0, 180, 0); // Face the webview toward the camera
                webViewPrefab.Initialized += (sender, e) => {
                    webViewPrefab.WebView.LoadUrl("https://www.google.com");
                };

                // Add the keyboard under the main webview.
                var keyboard = Keyboard.Instantiate();
                keyboard.transform.parent           = webViewPrefab.transform;
                keyboard.transform.localPosition    = new Vector3(0, -0.31f, 0);
                keyboard.transform.localEulerAngles = new Vector3(0, 0, 0);
                // Hook up the keyboard so that characters are routed to the main webview.
                keyboard.InputReceived += (sender, e) => webViewPrefab.WebView.HandleKeyboardInput(e.Value);

                if (onPlacedObject != null)
                {
                    onPlacedObject();
                }
            }
        }
    }
    void Start()
    {
        // Create a 0.6 x 0.4 instance of the prefab.
        _webViewPrefab = WebViewPrefab.Instantiate(0.6f, 0.4f);
        _webViewPrefab.transform.parent        = transform;
        _webViewPrefab.transform.localPosition = new Vector3(0, 0f, 0.6f);
        _webViewPrefab.transform.LookAt(transform);
        _webViewPrefab.Initialized += (sender, e) => {
            _webViewPrefab.WebView.LoadUrl("https://www.google.com");
        };

        // Add the keyboard under the main webview.
        _keyboard = Keyboard.Instantiate();
        _keyboard.transform.parent           = _webViewPrefab.transform;
        _keyboard.transform.localPosition    = new Vector3(0, -0.41f, 0);
        _keyboard.transform.localEulerAngles = new Vector3(0, 0, 0);
        // Hook up the keyboard so that characters are routed to the main webview.
        _keyboard.InputReceived += (sender, e) => _webViewPrefab.WebView.HandleKeyboardInput(e.Value);
    }
    void Start()
    {
        // Create a 0.6 x 0.3 instance of the prefab.
        _webViewPrefab = WebViewPrefab.Instantiate(0.6f, 0.3f);
        _webViewPrefab.transform.parent           = transform;
        _webViewPrefab.transform.localPosition    = new Vector3(0, 0.2f, 1);
        _webViewPrefab.transform.localEulerAngles = new Vector3(0, 180, 0);
        _webViewPrefab.Initialized += (sender, e) => {
            _webViewPrefab.WebView.LoadUrl("https://www.google.com");
        };

        // Add an on-screen keyboard under the main webview.
        var keyboard = Keyboard.Instantiate();

        keyboard.transform.parent           = _webViewPrefab.transform;
        keyboard.transform.localPosition    = new Vector3(0, -0.31f, 0);
        keyboard.transform.localEulerAngles = new Vector3(0, 0, 0);
        keyboard.InputReceived += (sender, e) => {
            _webViewPrefab.WebView.HandleKeyboardInput(e.Value);
        };
    }