您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

98 行
3.9 KiB

  1. // Copyright (C) 2015 Google, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. using GoogleMobileAds.Api;
  15. using GoogleMobileAds.Common;
  16. namespace GoogleMobileAds
  17. {
  18. public class GoogleMobileAdsClientFactory
  19. {
  20. public static IBannerClient BuildBannerClient()
  21. {
  22. #if UNITY_EDITOR
  23. // Testing UNITY_EDITOR first because the editor also responds to the currently
  24. // selected platform.
  25. return new GoogleMobileAds.Common.DummyClient();
  26. #elif UNITY_ANDROID
  27. return new GoogleMobileAds.Android.BannerClient();
  28. #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
  29. return new GoogleMobileAds.iOS.BannerClient();
  30. #else
  31. return new GoogleMobileAds.Common.DummyClient();
  32. #endif
  33. }
  34. public static IInterstitialClient BuildInterstitialClient()
  35. {
  36. #if UNITY_EDITOR
  37. // Testing UNITY_EDITOR first because the editor also responds to the currently
  38. // selected platform.
  39. return new GoogleMobileAds.Common.DummyClient();
  40. #elif UNITY_ANDROID
  41. return new GoogleMobileAds.Android.InterstitialClient();
  42. #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
  43. return new GoogleMobileAds.iOS.InterstitialClient();
  44. #else
  45. return new GoogleMobileAds.Common.DummyClient();
  46. #endif
  47. }
  48. public static IRewardBasedVideoAdClient BuildRewardBasedVideoAdClient()
  49. {
  50. #if UNITY_EDITOR
  51. // Testing UNITY_EDITOR first because the editor also responds to the currently
  52. // selected platform.
  53. return new GoogleMobileAds.Common.DummyClient();
  54. #elif UNITY_ANDROID
  55. return new GoogleMobileAds.Android.RewardBasedVideoAdClient();
  56. #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
  57. return new GoogleMobileAds.iOS.RewardBasedVideoAdClient();
  58. #else
  59. return new GoogleMobileAds.Common.DummyClient();
  60. #endif
  61. }
  62. public static IAdLoaderClient BuildAdLoaderClient(AdLoader adLoader)
  63. {
  64. #if UNITY_EDITOR
  65. // Testing UNITY_EDITOR first because the editor also responds to the currently
  66. // selected platform.
  67. return new GoogleMobileAds.Common.DummyClient();
  68. #elif UNITY_ANDROID
  69. return new GoogleMobileAds.Android.AdLoaderClient(adLoader);
  70. #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
  71. return new GoogleMobileAds.iOS.AdLoaderClient(adLoader);
  72. #else
  73. return new GoogleMobileAds.Common.DummyClient();
  74. #endif
  75. }
  76. public static IMobileAdsClient MobileAdsInstance()
  77. {
  78. #if UNITY_EDITOR
  79. // Testing UNITY_EDITOR first because the editor also responds to the currently
  80. // selected platform.
  81. return new GoogleMobileAds.Common.DummyClient();
  82. #elif UNITY_ANDROID
  83. return GoogleMobileAds.Android.MobileAdsClient.Instance;
  84. #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE
  85. return GoogleMobileAds.iOS.MobileAdsClient.Instance;
  86. #else
  87. return new GoogleMobileAds.Common.DummyClient();
  88. #endif
  89. }
  90. }
  91. }