public override void OnXGUI() { BeginHorizontal(); if (CreateSpaceButton("DeFocus")) { webView.GetType().TryInvokeMethod(webView, "SetFocus", false); } DoButton <string>("UnityScript", SetUrl, "http://docs.unity3d.com/ScriptReference/index.html"); DoButton <string>("Google", SetUrl, "www.gooogle.com"); DoButton <string>("Github", SetUrl, "github.com/wuxingogo"); DoButton <string>("Weibo", SetUrl, "weibo.com/52111314ly?source=blog"); DoButton <string>("Zhihu", SetUrl, "http://www.zhihu.com/"); EndHorizontal(); CreateLabel("URL"); urlText = CreateStringField(urlText); //Focus on web view if return is pressed in URL field if (Event.current.isKey && Event.current.keyCode == KeyCode.Return) { if (urlText != "") { SetUrl(urlText); } } if (CreateSpaceButton("Setting")) { XMethodWindow window = InitWindow <XMethodWindow>(); window.Target = webView; } }
void OnOpenEditor(string editorName) { switch (editorName) { case "Field": XFieldWindow fieldWindow = InitWindow <XFieldWindow>(); fieldWindow.Target = Target; break; case "Property": XPropertyWindow propertyWindow = InitWindow <XPropertyWindow>(); propertyWindow.Target = Target; break; case "Method": XMethodWindow methodWindow = InitWindow <XMethodWindow>(); methodWindow.Target = Target; break;; case "Member": break; } }