Ejemplo n.º 1
0
    void OnGUI()
    {
        if (unclipMethod == null)
        {
            guiClipType = GetTypeFromAllAssemblies("GUIClip");
            if (guiClipType == null)
            {
                ShowCouldNotLoadError("Could not find GUIClip.", null);
                initErrorLevel++;
                return;
            }
            unclipMethod = guiClipType.GetMethod("Unclip", new Type[] { typeof(Rect) });
        }

        Rect webViewRect = (Rect)unclipMethod.Invoke(null, new object[] { new Rect(0f, 0f, base.position.width, base.position.height) });

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

        // fileToOpen is not null => we need to browse to the new file!
        if (fileToOpen != null)
        {
            UpdateUrl();
        }

        if (Event.current.type == EventType.Layout)
        {
            if (setSizeAndPositionMethod == null)
            {
                setSizeAndPositionMethod = ReflWebViewType.GetMethod("SetSizeAndPosition");
                if (setSizeAndPositionMethod == null)
                {
                    ShowCouldNotLoadError("Cannot find all required methods... Found:", ReflWebViewType);
                    return;
                }
            }

            setSizeAndPositionMethod.Invoke(m_WebView, new object[] { (int)webViewRect.x, (int)webViewRect.y, (int)webViewRect.width, (int)webViewRect.height });
            this.UpdateDockStatusIfNeeded();
        }
    }
Ejemplo n.º 2
0
    private void InitWebView(Rect pos)
    {
        this.m_IsDocked = BaseDocked;

        if (this.m_WebView == null)
        {
            var thisWindowGuiView = BaseMParent;
            if (thisWindowGuiView == null)
            {
                ShowCouldNotLoadError("m_Parent property does not exit", typeof(EditorWindow));
                return;
            }

            m_WebView = ScriptableObject.CreateInstance(ReflWebViewType);
            ReflWebViewType.GetMethod("InitWebView").Invoke(m_WebView, new object[] {
                thisWindowGuiView,
                (int)pos.x,
                (int)pos.y,
                (int)pos.width,
                (int)pos.height,
                true
            });

            // Set hide flags
            ReflWebViewType.GetProperty("hideFlags").SetValue(m_WebView, HideFlags.HideAndDontSave, null);

            if (BaseHasFocus)
            {
                this.SetFocus(true);
            }

            ReflWebViewType.GetMethod("SetDelegateObject").Invoke(m_WebView, new object[] { this });

            UpdateUrl();

            this.wantsMouseMove = true;
        }
    }
Ejemplo n.º 3
0
 public void WebViewSetFocus(bool focus)
 {
     ReflWebViewType.GetMethod("SetFocus").Invoke(this.m_WebView, new object[] { focus });
 }
Ejemplo n.º 4
0
 public void WebViewShow()
 {
     ReflWebViewType.GetMethod("Show").Invoke(this.m_WebView, new object[] { });
 }
Ejemplo n.º 5
0
 public void WebViewSetHostView(object view)
 {
     ReflWebViewType.GetMethod("SetHostView").Invoke(this.m_WebView, new object[] { view });
 }
Ejemplo n.º 6
0
 private void UpdateUrl()
 {
     loadURLMethod = ReflWebViewType.GetMethod("LoadURL");
     loadURLMethod.Invoke(m_WebView, new object[] { urlText + (fileToOpen != null?"#" + fileToOpen:"") });
     fileToOpen = null;
 }
Ejemplo n.º 7
0
 public void Reload()
 {
     this.m_IsDocked = BaseDocked;
     ReflWebViewType.GetMethod("Reload").Invoke(m_WebView, new object[] {});
 }