void Start() { InitPrefabLinks(); mainUIPanel.InitPrefabLinks(); _mainCamera = GameObject.Find("Main Camera").GetComponent <Camera>(); Browser2D.texture = _mainEngine.BrowserTexture; Browser2D.uvRect = new Rect(0f, 0f, 1f, -1f); // _mainInput = MainUrlInput.GetComponent<Input>(); mainUIPanel.KeepUIVisible = KeepUIVisible; if (!KeepUIVisible) { mainUIPanel.Hide(); } //attach dialogs and querys _mainEngine.OnJavaScriptDialog += _mainEngine_OnJavaScriptDialog; _mainEngine.OnJavaScriptQuery += _mainEngine_OnJavaScriptQuery; _mainEngine.OnPageLoaded += _mainEngine_OnPageLoaded; DialogPanel.SetActive(false); }
// Use this for initialization void Start() { InitPrefabLinks(); mainUIPanel.InitPrefabLinks(); if (MainCamera == null) { MainCamera = Camera.main; if (MainCamera == null) { Debug.LogError("Error: can't find main camera"); } } _mainMaterial = GetComponent <MeshRenderer>().material; _mainMaterial.SetTexture("_MainTex", _mainEngine.BrowserTexture); _mainMaterial.SetTextureScale("_MainTex", new Vector2(-1, 1)); mainUIPanel.MainCanvas.worldCamera = MainCamera; // _mainInput = MainUrlInput.GetComponent<Input>(); mainUIPanel.KeepUIVisible = KeepUIVisible; if (!KeepUIVisible) { mainUIPanel.Hide(); } //attach dialogs and queries _mainEngine.OnJavaScriptDialog += _mainEngine_OnJavaScriptDialog; _mainEngine.OnJavaScriptQuery += _mainEngine_OnJavaScriptQuery; _mainEngine.OnPageLoaded += _mainEngine_OnPageLoaded; DialogCanvas.worldCamera = MainCamera; DialogCanvas.gameObject.SetActive(false); }
private void Start() { _mainEngine = new BrowserEngine { dynamicRequestHandler = gameObject.GetComponent <IDynamicRequestHandler>() }; if (RandomMemoryFile) { var memid = Guid.NewGuid(); MemoryFile = memid.ToString(); } //run initialization if (JSInitializationCode.Trim() != "") { _mainEngine.RunJSOnce(JSInitializationCode); } if (UIEnabled) { InitPrefabLinks(); if (mainUIPanel != null) { mainUIPanel.InitPrefabLinks(); } } if (MainCamera == null) { MainCamera = Camera.main; if (MainCamera == null) { Debug.LogError("Error: can't find main camera"); } } if (UIEnabled && mainUIPanel != null) { mainUIPanel.MainCanvas.worldCamera = MainCamera; mainUIPanel.KeepUIVisible = KeepUIVisible; if (!KeepUIVisible) { mainUIPanel.Hide(); } } //attach dialogs and querys _mainEngine.OnJavaScriptDialog += _mainEngine_OnJavaScriptDialog; _mainEngine.OnJavaScriptQuery += _mainEngine_OnJavaScriptQuery; _mainEngine.OnPageLoaded += _mainEngine_OnPageLoaded; _mainEngine.OnTextureObjectUpdated += OnTextureObjectUpdated; _mainEngine.StreamingResourceName = StreamingResourceName; if (DialogEnabled && DialogCanvas != null) { DialogCanvas.worldCamera = MainCamera; DialogCanvas.gameObject.SetActive(false); } var initCoroutine = _mainEngine.InitPlugin(Width, Height, MemoryFile, InitialURL, EnableWebRTC, EnableGPU); StartCoroutine(initCoroutine); }
void Start() { Debug.Log("Browser2d start"); if (AutoFitParent) { var pixsource = transform as RectTransform; var rect = pixsource.rect; Width = (int)rect.width; Height = (int)rect.height; Debug.LogFormat("Browser2d resize to {0}x{1}", Width, Height); } _mainEngine = new BrowserEngine(); if (RandomMemoryFile) { Guid memid = Guid.NewGuid(); MemoryFile = memid.ToString(); } //run initialization if (JSInitializationCode.Trim() != "") { _mainEngine.RunJSOnce(JSInitializationCode); } if (UIEnabled) { InitPrefabLinks(); if (mainUIPanel != null) { mainUIPanel.InitPrefabLinks(); } } var parentcanvas = GetComponentInParent <Canvas>(); if (parentcanvas != null) { _mainCamera = parentcanvas.worldCamera; //get camera assigned to parent canvas } if (_mainCamera == null) //try to get default but this completely wrong { _mainCamera = GameObject.Find("Main Camera").GetComponent <Camera>(); } if (mainUIPanel != null) { mainUIPanel.KeepUIVisible = KeepUIVisible; if (!KeepUIVisible) { mainUIPanel.Hide(); } } //attach dialogs and querys _mainEngine.OnJavaScriptDialog += _mainEngine_OnJavaScriptDialog; _mainEngine.OnJavaScriptQuery += _mainEngine_OnJavaScriptQuery; _mainEngine.OnPageLoaded += _mainEngine_OnPageLoaded; _mainEngine.OnTextureObjectUpdated += OnTextureObjectUpdated; if (DialogPanel != null) { DialogPanel.SetActive(false); } IEnumerator initCoroutine = _mainEngine.InitPlugin(Width, Height, MemoryFile, InitialURL, EnableWebRTC, EnableGPU); StartCoroutine(initCoroutine); }
void Start() { _mainEngine = new BrowserEngine(); if (RandomMemoryFile) { Guid memid = Guid.NewGuid(); MemoryFile = memid.ToString(); } StartCoroutine(_mainEngine.InitPlugin(Width, Height, MemoryFile, InitialURL, EnableWebRTC, EnableGPU)); //run initialization if (JSInitializationCode.Trim() != "") { _mainEngine.RunJSOnce(JSInitializationCode); } // if (UIEnabled) { InitPrefabLinks(); mainUIPanel.InitPrefabLinks(); } if (MainCamera == null) { MainCamera = Camera.main; if (MainCamera == null) { Debug.LogError("Error: can't find main camera"); } } _mainMaterial = GetComponent <MeshRenderer>().material; _mainMaterial.SetTexture("_MainTex", _mainEngine.BrowserTexture); _mainMaterial.SetTextureScale("_MainTex", new Vector2(-1, 1)); if (UIEnabled) { mainUIPanel.MainCanvas.worldCamera = MainCamera; } // _mainInput = MainUrlInput.GetComponent<Input>(); if (UIEnabled) { mainUIPanel.KeepUIVisible = KeepUIVisible; if (!KeepUIVisible) { mainUIPanel.Hide(); } } //attach dialogs and querys _mainEngine.OnJavaScriptDialog += _mainEngine_OnJavaScriptDialog; _mainEngine.OnJavaScriptQuery += _mainEngine_OnJavaScriptQuery; _mainEngine.OnPageLoaded += _mainEngine_OnPageLoaded; if (DialogEnabled) { DialogCanvas.worldCamera = MainCamera; DialogCanvas.gameObject.SetActive(false); } }