コード例 #1
0
ファイル: WebSocketHook.cs プロジェクト: studentutu/UniScript
    public void Dispose()
    {
        server.Stop();
        const string template = "window.socket{0}.close(); window.socket{0} = undefined";

        if (webView)
        {
            webView.LocationChanged -= UpdateDefinitions;
            webView.ExecuteJavascript(string.Format(template, port));
        }
    }
コード例 #2
0
ファイル: WebData.cs プロジェクト: yuqianma/WebViewHook
    void OnGUI()
    {
        // hook to this window
        if (webView.Hook(this))
        {
            // do the first thing to do
            webView.LoadHTML(Compose());
        }

        var half = new Rect(0, 0, position.width / 2, position.height);

        // html text field
        EditorGUI.BeginChangeCheck();
        data = EditorGUI.TextArea(half, data);
        if (EditorGUI.EndChangeCheck())
        {
            // push changes to webView and notify our input
            hook.Update();
            webView.ExecuteJavascript("update()");
        }

        half.x += half.width;

        if (Event.current.type == EventType.Repaint)
        {
            // keep the browser aware with resize
            webView.OnGUI(half);
        }
        else if (half.Contains(Event.current.mousePosition))
        {
            GUIUtility.keyboardControl = 0;
        }
    }