3913bff9-77e2-444f-96d3-be13feecebb7.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. "use strict";
  2. cc._RF.push(module, '3913b/5d+JET5bTvhP+7Ou3', 'YzCustomAdPanel');
  3. // common-plugin/Scripts/YzCustomAdPanel.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. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. 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;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var Utils_1 = require("./Utils");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var YzCustomAdPanel = /** @class */ (function (_super) {
  28. __extends(YzCustomAdPanel, _super);
  29. function YzCustomAdPanel() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this.exitBtn = null;
  32. _this.closeCallFunc = null;
  33. //关闭按钮点击次数
  34. _this.closeCount = 1;
  35. _this.closeBtnClickCount = 0;
  36. return _this;
  37. }
  38. YzCustomAdPanel.prototype.onLoad = function () {
  39. if (Utils_1.utils.otherConfig && Utils_1.utils.otherConfig.group) {
  40. this.node.group = Utils_1.utils.otherConfig.group;
  41. }
  42. Utils_1.utils.adManager.showCustomAd({ location: 100 });
  43. var ratio = 0;
  44. if (cc.winSize.height < cc.winSize.width) {
  45. // 横屏游戏
  46. ratio = cc.winSize.width / 1920 * 0.75;
  47. }
  48. else {
  49. ratio = cc.winSize.width / 1080;
  50. }
  51. if (Utils_1.utils.getConfigByKey("custom_panel_close_count")) {
  52. this.closeCount = Utils_1.utils.getConfigByKey("custom_panel_close_count");
  53. }
  54. cc.find("Panel", this.node).scale = ratio;
  55. this.exitBtn.runAction(cc.fadeIn(3));
  56. };
  57. YzCustomAdPanel.prototype.onExitBtnClickListener = function () {
  58. Utils_1.utils.showLog("退出游戏模版弹窗!");
  59. this.closeBtnClickCount++;
  60. if (this.closeCount == this.closeBtnClickCount) {
  61. cc.director.emit("CloseCustomADPanel");
  62. this.node.destroy();
  63. Utils_1.utils.adManager.hideCustomAd({ location: 100 });
  64. this.closeCallFunc && this.closeCallFunc();
  65. }
  66. };
  67. __decorate([
  68. property({ type: cc.Node })
  69. ], YzCustomAdPanel.prototype, "exitBtn", void 0);
  70. YzCustomAdPanel = __decorate([
  71. ccclass
  72. ], YzCustomAdPanel);
  73. return YzCustomAdPanel;
  74. }(cc.Component));
  75. exports.default = YzCustomAdPanel;
  76. cc._RF.pop();