UniWebViewPlaceholder.cs 5.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #if UNITY_EDITOR_WIN || (!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, string identifier) { CheckPlatform(); return false; }
  17. public static bool Hide(string name, bool fade, int edge, float duration, 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 SetJavaScriptEnabled(bool flag) { CheckPlatform(); }
  32. public static void CleanCache(string name) { CheckPlatform(); }
  33. public static void ClearCookies() { CheckPlatform(); }
  34. public static void SetCookie(string url, string cookie, bool skipEncoding) { CheckPlatform(); }
  35. public static string GetCookie(string url, string key, bool skipEncoding) { CheckPlatform(); return ""; }
  36. public static void ClearHttpAuthUsernamePassword(string host, string realm) { CheckPlatform(); }
  37. public static void SetBackgroundColor(string name, float r, float g, float b, float a) { CheckPlatform(); }
  38. public static void SetWebViewAlpha(string name, float alpha) { CheckPlatform(); }
  39. public static float GetWebViewAlpha(string name) { CheckPlatform(); return 0.0f; }
  40. public static void SetShowSpinnerWhileLoading(string name, bool show) { CheckPlatform(); }
  41. public static void SetSpinnerText(string name, string text) { CheckPlatform(); }
  42. public static bool CanGoBack(string name) { CheckPlatform(); return false; }
  43. public static bool CanGoForward(string name) { CheckPlatform(); return false; }
  44. public static void GoBack(string name) { CheckPlatform(); }
  45. public static void GoForward(string name) { CheckPlatform(); }
  46. public static void SetOpenLinksInExternalBrowser(string name, bool flag) { CheckPlatform(); }
  47. public static void SetHorizontalScrollBarEnabled(string name, bool enabled) { CheckPlatform(); }
  48. public static void SetVerticalScrollBarEnabled(string name, bool enabled) { CheckPlatform(); }
  49. public static void SetBouncesEnabled(string name, bool enabled) { CheckPlatform(); }
  50. public static void SetZoomEnabled(string name, bool enabled) { CheckPlatform(); }
  51. public static void SetShowToolbar(string name, bool show, bool animated, bool onTop, bool adjustInset) { CheckPlatform(); }
  52. public static void SetToolbarDoneButtonText(string name, string text) { CheckPlatform(); }
  53. public static void SetWebContentsDebuggingEnabled(bool enabled) { CheckPlatform(); }
  54. public static void SetAllowHTTPAuthPopUpWindow(string name, bool flag) { CheckPlatform(); }
  55. public static void Print(string name) { CheckPlatform(); }
  56. public static void SetCalloutEnabled(string name, bool flag) { CheckPlatform(); }
  57. public static void SetDragInteractionEnabled(string name, bool flag) { CheckPlatform(); }
  58. public static void CheckPlatform() {
  59. if (!alreadyLoggedWarning) {
  60. alreadyLoggedWarning = true;
  61. Debug.LogWarning("UniWebView only supports iOS/Android/macOS Editor. You current platform " + Application.platform + " is not supported.");
  62. }
  63. }
  64. }
  65. #endif