88f791a3-d567-4fb0-8cbe-3e6e92b3d6ab.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. cc._RF.push(module, '88f79Gj1WdPsIy+Pm6Ss9ar', 'YZ_NativeAdObject');
  3. // common-plugin/Scripts/YZ_NativeAdObject.ts
  4. "use strict";
  5. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  6. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  7. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  8. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  9. return c > 3 && r && Object.defineProperty(target, key, r), r;
  10. };
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var PlatUtils_1 = require("./PlatUtils");
  13. var Utils_1 = require("./Utils");
  14. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  15. var YZ_NativeAdObject = /** @class */ (function () {
  16. function YZ_NativeAdObject() {
  17. this._nativeObj = null;
  18. this._nativeAdData = null;
  19. this.is_reportClick = false;
  20. this.is_reportShow = false;
  21. }
  22. Object.defineProperty(YZ_NativeAdObject.prototype, "data", {
  23. get: function () {
  24. return this._nativeAdData;
  25. },
  26. set: function (_data) {
  27. this._nativeAdData = _data;
  28. },
  29. enumerable: false,
  30. configurable: true
  31. });
  32. /**
  33. * 上报原生广告展示
  34. */
  35. YZ_NativeAdObject.prototype.reportAdShow = function () {
  36. if (this._nativeAdData && !this.is_reportShow) {
  37. this.is_reportShow = true;
  38. Utils_1.utils.showLog("上报原生广告展示! adId:", this._nativeAdData.adId);
  39. if (this._nativeObj) {
  40. this._nativeObj.reportAdShow({
  41. adId: this._nativeAdData.adId
  42. });
  43. }
  44. }
  45. };
  46. /**
  47. * 上报原生广告点击
  48. * @param type 1:banner,2:结算广告
  49. */
  50. YZ_NativeAdObject.prototype.reportAdClick = function (type) {
  51. if (type === void 0) { type = 2; }
  52. this.is_reportClick = true;
  53. if (this._nativeAdData) {
  54. Utils_1.utils.showLog("上报原生广告点击! adId:", this._nativeAdData.adId);
  55. if (this._nativeObj) {
  56. this._nativeObj.reportAdClick({
  57. adId: this._nativeAdData.adId
  58. });
  59. if (type == 2) {
  60. if (PlatUtils_1.default.IsOPPO) {
  61. Utils_1.utils.oppoTool.countNativeInserClick();
  62. }
  63. else if (PlatUtils_1.default.IsVIVO) {
  64. Utils_1.utils.Tool_Vivo.countNativeInserClick();
  65. }
  66. }
  67. }
  68. }
  69. };
  70. YZ_NativeAdObject = __decorate([
  71. ccclass
  72. ], YZ_NativeAdObject);
  73. return YZ_NativeAdObject;
  74. }());
  75. exports.default = YZ_NativeAdObject;
  76. cc._RF.pop();