暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UniWebViewPlaceholder.cs 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #if UNITY_EDITOR_WIN || UNITY_EDITOR_LINUX || (!UNITY_EDITOR_OSX && !UNITY_STANDALONE_OSX && !UNITY_IOS && !UNITY_ANDROID)
  2. using UnityEngine;
  3. public class UniWebViewInterface {
  4. private static bool alreadyLoggedWarning = false;
  5. public static void SetLogLevel(int level) { CheckPlatform(); }
  6. public static void Init(string name, int x, int y, int width, int height) { CheckPlatform(); }
  7. public static void Destroy(string name) { CheckPlatform(); }
  8. public static void Load(string name, string url, bool skipEncoding, string readAccessURL) { CheckPlatform(); }
  9. public static void LoadHTMLString(string name, string html, string baseUrl, bool skipEncoding) { CheckPlatform(); }
  10. public static void Reload(string name) { CheckPlatform(); }
  11. public static void Stop(string name) { CheckPlatform(); }
  12. public static string GetUrl(string name) { CheckPlatform(); return ""; }
  13. public static void SetFrame(string name, int x, int y, int width, int height) { CheckPlatform(); }
  14. public static void SetPosition(string name, int x, int y) { CheckPlatform(); }
  15. public static void SetSize(string name, int width, int height) { CheckPlatform(); }
  16. public static bool Show(string name, bool fade, int edge, float duration, bool useAsync, string identifier) { CheckPlatform(); return false; }
  17. public static bool Hide(string name, bool fade, int edge, float duration, bool useAsync, string identifier) { CheckPlatform(); return false; }
  18. public static bool AnimateTo(string name, int x, int y, int width, int height, float duration, float delay, string identifier) { CheckPlatform(); return false; }
  19. public static void AddJavaScript(string name, string jsString, string identifier) { CheckPlatform(); }
  20. public static void EvaluateJavaScript(string name, string jsString, string identifier) { CheckPlatform(); }
  21. public static void AddUrlScheme(string name, string scheme) { CheckPlatform(); }
  22. public static void RemoveUrlScheme(string name, string scheme) { CheckPlatform(); }
  23. public static void AddSslExceptionDomain(string name, string domain) { CheckPlatform(); }
  24. public static void RemoveSslExceptionDomain(string name, string domain) { CheckPlatform(); }
  25. public static void SetHeaderField(string name, string key, string value) { CheckPlatform(); }
  26. public static void SetUserAgent(string name, string userAgent) { CheckPlatform(); }
  27. public static string GetUserAgent(string name) { CheckPlatform(); return ""; }
  28. public static void SetAllowAutoPlay(bool flag) { CheckPlatform(); }
  29. public static void SetAllowInlinePlay(bool flag) { CheckPlatform(); }
  30. public static void SetAllowJavaScriptOpenWindow(bool flag) { CheckPlatform(); }
  31. public static void SetAllowFileAccess(string name, bool flag) { CheckPlatform(); }
  32. public static void SetAllowFileAccessFromFileURLs(string name, bool flag) { CheckPlatform(); }
  33. public static void SetAllowUniversalAccessFromFileURLs(bool flag) { CheckPlatform(); }
  34. public static void SetJavaScriptEnabled(bool flag) { CheckPlatform(); }
  35. public static void SetLimitsNavigationsToAppBoundDomains(bool enabled) { CheckPlatform(); }
  36. public static void CleanCache(string name) { CheckPlatform(); }
  37. public static void ClearCookies() { CheckPlatform(); }
  38. public static void SetCookie(string url, string cookie, bool skipEncoding) { CheckPlatform(); }
  39. public static void RemoveCookies(string url, bool skipEncoding) { CheckPlatform(); }
  40. public static void RemoveCookie(string url, string key, bool skipEncoding) { CheckPlatform(); }
  41. public static string GetCookie(string url, string key, bool skipEncoding) { CheckPlatform(); return ""; }
  42. public static void ClearHttpAuthUsernamePassword(string host, string realm) { CheckPlatform(); }
  43. public static void SetBackgroundColor(string name, float r, float g, float b, float a) { CheckPlatform(); }
  44. public static void SetWebViewAlpha(string name, float alpha) { CheckPlatform(); }
  45. public static float GetWebViewAlpha(string name) { CheckPlatform(); return 0.0f; }
  46. public static void SetShowSpinnerWhileLoading(string name, bool show) { CheckPlatform(); }
  47. public static void SetSpinnerText(string name, string text) { CheckPlatform(); }
  48. public static void SetAllowUserDismissSpinnerByGesture(string name, bool flag) { CheckPlatform(); }
  49. public static void ShowSpinner(string name) { CheckPlatform(); }
  50. public static void HideSpinner(string name) { CheckPlatform(); }
  51. public static bool CanGoBack(string name) { CheckPlatform(); return false; }
  52. public static bool CanGoForward(string name) { CheckPlatform(); return false; }
  53. public static void GoBack(string name) { CheckPlatform(); }
  54. public static void GoForward(string name) { CheckPlatform(); }
  55. public static void SetOpenLinksInExternalBrowser(string name, bool flag) { CheckPlatform(); }
  56. public static void SetHorizontalScrollBarEnabled(string name, bool enabled) { CheckPlatform(); }
  57. public static void SetVerticalScrollBarEnabled(string name, bool enabled) { CheckPlatform(); }
  58. public static void SetBouncesEnabled(string name, bool enabled) { CheckPlatform(); }
  59. public static void SetZoomEnabled(string name, bool enabled) { CheckPlatform(); }
  60. public static void SetShowToolbar(string name, bool show, bool animated, bool onTop, bool adjustInset) { CheckPlatform(); }
  61. public static void SetToolbarDoneButtonText(string name, string text) { CheckPlatform(); }
  62. public static void SetToolbarGoBackButtonText(string name, string text) { CheckPlatform(); }
  63. public static void SetToolbarGoForwardButtonText(string name, string text) { CheckPlatform(); }
  64. public static void SetToolbarTintColor(string name, float r, float g, float b) { CheckPlatform(); }
  65. public static void SetToolbarTextColor(string name, float r, float g, float b) { CheckPlatform(); }
  66. public static void SetUserInteractionEnabled(string name, bool enabled) { CheckPlatform(); }
  67. public static void SetTransparencyClickingThroughEnabled(string name, bool enabled) { CheckPlatform(); }
  68. public static void SetWebContentsDebuggingEnabled(bool enabled) { CheckPlatform(); }
  69. public static void SetAllowHTTPAuthPopUpWindow(string name, bool flag) { CheckPlatform(); }
  70. public static void Print(string name) { CheckPlatform(); }
  71. public static void CaptureSnapshot(string name, string filename) { CheckPlatform(); }
  72. public static void SetCalloutEnabled(string name, bool flag) { CheckPlatform(); }
  73. public static void SetSupportMultipleWindows(string name, bool enabled, bool allowJavaScriptOpening) { CheckPlatform(); }
  74. public static void SetDragInteractionEnabled(string name, bool flag) { CheckPlatform(); }
  75. public static void ScrollTo(string name, int x, int y, bool animated) { CheckPlatform(); }
  76. public static float NativeScreenWidth() { CheckPlatform(); return 0.0f; }
  77. public static float NativeScreenHeight() { CheckPlatform(); return 0.0f; }
  78. public static void SafeBrowsingInit(string name, string url) { CheckPlatform(); }
  79. public static void SafeBrowsingSetToolbarColor(string name, float r, float g, float b) { CheckPlatform(); }
  80. public static void SafeBrowsingShow(string name) { CheckPlatform(); }
  81. public static bool IsAuthenticationIsSupported() { CheckPlatform(); return false; }
  82. public static void AuthenticationInit(string name, string url, string scheme) { CheckPlatform(); }
  83. public static void AuthenticationStart(string name) { CheckPlatform(); }
  84. public static void AuthenticationSetPrivateMode(string name, bool enabled) { CheckPlatform(); }
  85. public static void SetShowEmbeddedToolbar(string name, bool show) { CheckPlatform(); }
  86. public static void SetEmbeddedToolbarOnTop(string name, bool top) { CheckPlatform(); }
  87. public static void SetEmbeddedToolbarDoneButtonText(string name, string text) { CheckPlatform(); }
  88. public static void SetEmbeddedToolbarGoBackButtonText(string name, string text) { CheckPlatform(); }
  89. public static void SetEmbeddedToolbarGoForwardButtonText(string name, string text) { CheckPlatform(); }
  90. public static void SetEmbeddedToolbarTitleText(string name, string text) { CheckPlatform(); }
  91. public static void SetEmbeddedToolbarBackgroundColor(string name, Color color) { CheckPlatform(); }
  92. public static void SetEmbeddedToolbarButtonTextColor(string name, Color color) { CheckPlatform(); }
  93. public static void SetEmbeddedToolbarTitleTextColor(string name, Color color) { CheckPlatform(); }
  94. public static void SetEmeddedToolbarNavigationButtonsShow(string name, bool show) { CheckPlatform(); }
  95. public static void CheckPlatform() {
  96. if (!alreadyLoggedWarning) {
  97. alreadyLoggedWarning = true;
  98. Debug.LogWarning("UniWebView only supports iOS/Android/macOS Editor. You current platform " + Application.platform + " is not supported.");
  99. }
  100. }
  101. }
  102. #endif