private void SetFocus(bool value)
        {
            if (!this.syncingFocus)
            {
                this.syncingFocus = true;
                if (this.webview != null)
                {
                    if (value)
                    {
                        this.webview.SetHostView(Webview.GetView(this));
                        this.webview.Show();
                        this.repeatedShow = 5;
                    }

                    this.webview.SetFocus(value);
                }
                this.syncingFocus = false;
            }
        }
        public void InitWebView(Rect webviewRect)
        {
            if (webview == null)
            {
                this.webview           = ScriptableObject.CreateInstance <Webview>();
                this.webview.hideFlags = HideFlags.HideAndDontSave;
            }

            this.webview.InitWebView(Webview.GetView(this), webviewRect, false);
            var path = PathManager.GetIndexHTMLPath();

#if uCE_DEV
            this.webview.AllowRightClickMenu(true);
#endif
            EditorCoroutine.StartCoroutine(() => {
                InitWebviewComService();
                this.webview.LoadURL(path);
                SetFocus(true);
            });
        }
        void OnGUI()
        {
            Rect webViewRect = GUIClip.Unclip(new Rect(0f, 0, base.position.width, base.position.height));

            if (this.webview == null)
            {
                this.InitWebView(webViewRect);
            }

            RebindWebViewIfNeeded();

            if (this.repeatedShow-- > 0)
            {
                this.Refresh();
            }

            if (Event.current.type == EventType.Repaint && webview != null)
            {
                this.webview.SetHostView(Webview.GetView(this));
                this.webview.SetSizeAndPosition(webViewRect);
            }
        }
Beispiel #4
0
 public void Send(string message)
 {
     Webview.Callback(this.callback, message);
 }