01821403-67c3-4efc-95af-67296860a63d.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. "use strict";
  2. cc._RF.push(module, '01821QDZ8NO/JWvZyloYKY9', 'AdAgentGoogleWeb');
  3. // common-plugin/Scripts/AdAgentGoogleWeb.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. Object.defineProperty(exports, "__esModule", { value: true });
  19. var AdAgent_1 = require("./AdAgent");
  20. var AdAgentGoogleWeb = /** @class */ (function (_super) {
  21. __extends(AdAgentGoogleWeb, _super);
  22. function AdAgentGoogleWeb() {
  23. var _this = _super !== null && _super.apply(this, arguments) || this;
  24. _this.googleAd = null;
  25. _this._videoIsPlay = false;
  26. return _this;
  27. }
  28. AdAgentGoogleWeb.prototype.Init = function () {
  29. console.log("[init googleWebAd]");
  30. //@ts-ignore
  31. this.googleAd = window.googleApi;
  32. };
  33. AdAgentGoogleWeb.prototype.ShowBanner = function (location) {
  34. if (location === void 0) { location = null; }
  35. console.log("[YouzhiAd ShowBanner] :" + location);
  36. this.googleAd && this.googleAd.showBanner();
  37. };
  38. AdAgentGoogleWeb.prototype.ShowInterstitial = function () {
  39. console.log("[YouzhiAd ShowInterstitial]");
  40. this.googleAd && this.googleAd.ShowInterstitial();
  41. };
  42. AdAgentGoogleWeb.prototype.HideBanner = function (location) {
  43. if (location === void 0) { location = null; }
  44. console.log("[YouzhiAd HideBanner]");
  45. this.googleAd && this.googleAd.hideBanner();
  46. };
  47. AdAgentGoogleWeb.prototype.ShowVideo = function (callback) {
  48. var _this = this;
  49. console.log("[YouzhiAd ShowVideo]");
  50. if (this._videoIsPlay) {
  51. console.warn("[YouzhiAd Video Ad is Loading]");
  52. return;
  53. }
  54. this._videoIsPlay = true;
  55. //@ts-ignore
  56. var videoAdSuccess = function () {
  57. _this._videoIsPlay = false;
  58. callback(true, "视频播放成功!");
  59. };
  60. //@ts-ignore
  61. var videoAdFail = function (msg) {
  62. _this._videoIsPlay = false;
  63. callback(false, msg ? msg : "视频播放失败!");
  64. };
  65. this.googleAd && this.googleAd.showVideo(videoAdSuccess, videoAdFail);
  66. };
  67. return AdAgentGoogleWeb;
  68. }(AdAgent_1.default));
  69. exports.default = AdAgentGoogleWeb;
  70. // var googleApi = new Object();
  71. // googleApi.showBanner = () => {
  72. // console.log("=====google showBanner=====");
  73. // }
  74. // googleApi.ShowInterstitial = () => {
  75. // console.log("=====google ShowInterstitial=====");
  76. // }
  77. // googleApi.hideBanner = () => {
  78. // console.log("=====google hideBanner=====");
  79. // }
  80. // googleApi.showVideo = (successFunc, failFunc) => {
  81. // console.log("=====google ShowVideo=====");
  82. // successFunc();
  83. // }
  84. // window.googleApi = googleApi;
  85. cc._RF.pop();