private void OnEnable()
        {
            if (!webView)
            {
                webView                 = CreateInstance <WebViewHook>();
                webView.LoadError       = OnFailedToLoadWebpage;
                webView.LocationChanged = OnLoadedWebpage;
            }

            viewInBrowserRect        = sideBarRect;
            viewInBrowserRect.y      = sideBarItemHeight * Urls.Length + 10f;
            viewInBrowserRect.x      = sideBarWidth * 0.5f - 130f;
            viewInBrowserRect.width  = 120f;
            viewInBrowserRect.height = 20f;

            autoUpdateRect    = viewInBrowserRect;
            autoUpdateRect.x += viewInBrowserRect.width + 20f;

            separator1        = Rect.zero;
            separator1.width  = 1f;
            separator1.height = height;

            separator2   = separator1;
            separator2.x = sideBarWidth - 1f;
        }
Пример #2
0
 void OnEnable()
 {
     if (!webView)
     {
         webView = CreateInstance <WebViewHook>();
     }
 }
Пример #3
0
 private void OnEnable()
 {
     if (!_webView)
     {
         // create webView
         _webView = CreateInstance<WebViewHook>();
     }
 }
Пример #4
0
    public WebSocketHook(int port, WebViewHook webView)
    {
        // add WebSocketHook to webView too
        this.port    = port;
        this.webView = webView;

        webView.LocationChanged += UpdateDefinitions;

        UpdateDefinitions("");

        server = new WebSocketServer("ws://127.0.0.1:" + port + "");
        server.AddWebSocketService <WSS>("/ws", (e) => { e.hook = this; });
        server.Start();
    }
Пример #5
0
    void OnEnable()
    {
        if (!webView)
        {
            // Create webView
            webView = CreateInstance <WebViewHook>();
        }

        // Make the server.
        // The server is not serializable so there's
        // no need to check if this exist or not.
        socket = new WebSocketHook(9369, webView);

        // Hook window.data to javascript
        hook = socket.Add("data", () => data, (x) =>
        {
            data = x;
            EditorApplication.delayCall += () => Repaint();
        });
    }