Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

87 linhas
2.2 KiB

  1. using System;
  2. namespace CI.WSANative.Advertising
  3. {
  4. public static class WSANativeInterstitialAd
  5. {
  6. public static Action<WSAInterstitialAdType> AdReady { get; set; }
  7. public static Action<WSAInterstitialAdType> Cancelled { get; set; }
  8. public static Action<WSAInterstitialAdType> Completed { get; set; }
  9. public static Action<WSAInterstitialAdType, string> ErrorOccurred { get; set; }
  10. public static void Initialise(WSAInterstitialAdType adType, string appId, string adUnitId)
  11. {
  12. if (adType != WSAInterstitialAdType.AdDuplex)
  13. {
  14. if (adType != WSAInterstitialAdType.Microsoft)
  15. {
  16. if (adType == WSAInterstitialAdType.Vungle)
  17. {
  18. WSANativeInterstitialAd._vungleAppId = appId;
  19. }
  20. }
  21. else
  22. {
  23. WSANativeInterstitialAd._msAppId = appId;
  24. WSANativeInterstitialAd._msAdUnitId = adUnitId;
  25. }
  26. }
  27. else
  28. {
  29. WSANativeInterstitialAd._adDuplexAppId = appId;
  30. WSANativeInterstitialAd._adDuplexAdUnitId = adUnitId;
  31. }
  32. }
  33. public static void RequestAd(WSAInterstitialAdType adType)
  34. {
  35. if (WSANativeInterstitialAd._Request != null)
  36. {
  37. if (adType != WSAInterstitialAdType.AdDuplex)
  38. {
  39. if (adType != WSAInterstitialAdType.Microsoft)
  40. {
  41. if (adType == WSAInterstitialAdType.Vungle)
  42. {
  43. WSANativeInterstitialAd._Request(adType, WSANativeInterstitialAd._vungleAppId, string.Empty);
  44. }
  45. }
  46. else
  47. {
  48. WSANativeInterstitialAd._Request(adType, WSANativeInterstitialAd._msAppId, WSANativeInterstitialAd._msAdUnitId);
  49. }
  50. }
  51. else
  52. {
  53. WSANativeInterstitialAd._Request(adType, WSANativeInterstitialAd._adDuplexAppId, WSANativeInterstitialAd._adDuplexAdUnitId);
  54. }
  55. }
  56. }
  57. public static void ShowAd(WSAInterstitialAdType adType)
  58. {
  59. if (WSANativeInterstitialAd._Show != null)
  60. {
  61. WSANativeInterstitialAd._Show(adType);
  62. }
  63. }
  64. public static Action<WSAInterstitialAdType, string, string> _Request;
  65. public static Action<WSAInterstitialAdType> _Show;
  66. private static string _adDuplexAppId;
  67. private static string _adDuplexAdUnitId;
  68. private static string _msAppId;
  69. private static string _msAdUnitId;
  70. private static string _vungleAppId;
  71. }
  72. }