public WebViewExt RequestWebView( WebViewType type, ViewGroup container, Action onPageLoaded = null, Action <string, string, float, float, float, float> onGetSelectedText = null, Action <Hyperlink> onLoadUrl = null, Action <int, float> onWebOverScroll = null, Action <string> onScrollLoadPageCompleted = null, Action <string, string> onScrollToPage = null) { switch (type) { case WebViewType.Content: return(contentKeeper.RequestWebView( container, onPageLoaded, onGetSelectedText, onLoadUrl, onWebOverScroll, onScrollLoadPageCompleted, onScrollToPage)); case WebViewType.Index: return(indexKeeper.RequestWebView( container, onPageLoaded, onGetSelectedText, onLoadUrl, onWebOverScroll, onScrollLoadPageCompleted, onScrollToPage)); } throw new InvalidProgramException("Unknown web view type."); }
public void ClearWebViewStatus(WebViewType type) { if (type == WebViewType.Content) { contentKeeper.ClearWebViewStatus(); } else if (type == WebViewType.Index) { indexKeeper.ClearWebViewStatus(); } else if (type == WebViewType.Printing) { printingKeeper.ClearWebViewStatus(); } }
public string ApplyTemplate(WebViewType type, string body) { if (type == WebViewType.Content) { return(HtmlTemplate.Replace("#BODY#", body)); } else if (type == WebViewType.Index) { return(IndexHtmlTemplate.Replace("#BODY#", body)); } else if (type == WebViewType.Printing) { return(PrintingHtmlTemplate.Replace("#BODY#", body)); } throw new InvalidProgramException("Unknown web view type."); }
public Rect GetWebViewRect(WebViewHeightType hType, WebViewType wType) { if (null == WebWindowRects) { InitWebViewRect(); } if (WebWindowRects.ContainsKey(wType)) { if (WebWindowRects[wType].ContainsKey(hType)) { return(WebWindowRects[wType][hType]); } } return(new Rect(0, 0, 0, 0)); }
public void ReleaseWebView(WebViewType type, ViewGroup container) { switch (type) { case WebViewType.Content: contentKeeper.ReleaseWebView(container); return; case WebViewType.Index: indexKeeper.ReleaseWebView(container); return; case WebViewType.Printing: printingKeeper.ReleaseWebView(container); return; } throw new InvalidProgramException("Unknown web view type."); }
public void OpenWebWinow(WebViewType type, string strURL) { url = strURL; ClearWindow(); switch (type) { case WebViewType.DEFAULT: OpenDefaultWeb(); break; case WebViewType.NOTICE: OpenPublicNoticeWeb(); break; case WebViewType.RAIDER: OpenRauderWeb(); break; } }
static WebView() { try { WebViewType = typeof(UnityEditor.Editor).Assembly.GetType("UnityEditor.WebView", true); WebView_InitWebView = WebViewType.GetMethod("InitWebView", BindingFlags.Instance | BindingFlags.Public); WebView_LoadUrl = WebViewType.GetMethod("LoadURL", BindingFlags.Instance | BindingFlags.Public); WebView_LoadFile = WebViewType.GetMethod("LoadFile", BindingFlags.Instance | BindingFlags.Public); WebView_SetHostView = WebViewType.GetMethod("SetHostView", BindingFlags.Instance | BindingFlags.Public); WebView_SetSizeAndPosition = WebViewType.GetMethod("SetSizeAndPosition", BindingFlags.Instance | BindingFlags.Public); WebView_SetFocus = WebViewType.GetMethod("SetFocus", BindingFlags.Instance | BindingFlags.Public); WebView_SetApplicationFocus = WebViewType.GetMethod("SetApplicationFocus", BindingFlags.Instance | BindingFlags.Public); WebView_Show = WebViewType.GetMethod("Show", BindingFlags.Instance | BindingFlags.Public); WebView_Hide = WebViewType.GetMethod("Hide", BindingFlags.Instance | BindingFlags.Public); WebView_Back = WebViewType.GetMethod("Back", BindingFlags.Instance | BindingFlags.Public); WebView_Forward = WebViewType.GetMethod("Forward", BindingFlags.Instance | BindingFlags.Public); WebView_Reload = WebViewType.GetMethod("Reload", BindingFlags.Instance | BindingFlags.Public); WebView_IntPtrIsNull = WebViewType.GetMethod("IntPtrIsNull", BindingFlags.Instance | BindingFlags.NonPublic); if (WebView_InitWebView == null) { throw new MissingMemberException(WebViewType.FullName, "InitWebView"); } if (WebView_LoadUrl == null) { throw new MissingMemberException(WebViewType.FullName, "LoadURL"); } if (WebView_LoadFile == null) { throw new MissingMemberException(WebViewType.FullName, "LoadFile"); } if (WebView_SetHostView == null) { throw new MissingMemberException(WebViewType.FullName, "SetHostView"); } if (WebView_SetSizeAndPosition == null) { throw new MissingMemberException(WebViewType.FullName, "SetSizeAndPosition"); } if (WebView_SetFocus == null) { throw new MissingMemberException(WebViewType.FullName, "SetFocus"); } if (WebView_SetApplicationFocus == null) { throw new MissingMemberException(WebViewType.FullName, "SetApplicationFocus"); } if (WebView_Show == null) { throw new MissingMemberException(WebViewType.FullName, "Show"); } if (WebView_Hide == null) { throw new MissingMemberException(WebViewType.FullName, "Hide"); } if (WebView_Back == null) { throw new MissingMemberException(WebViewType.FullName, "Back"); } if (WebView_Forward == null) { throw new MissingMemberException(WebViewType.FullName, "Forward"); } if (WebView_Reload == null) { throw new MissingMemberException(WebViewType.FullName, "Reload"); } if (WebView_IntPtrIsNull == null) { throw new MissingMemberException(WebViewType.FullName, "IntPtrIsNull"); } EditorWindow_m_Parent = typeof(EditorWindow).GetField("m_Parent", BindingFlags.Instance | BindingFlags.NonPublic); } catch (Exception ex) { throw new UnityEditorInternalException(ex); } }