7087b336-acf2-48a8-8e5a-e857a4bd0d97.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. "use strict";
  2. cc._RF.push(module, '7087bM2rPJIqI5a6FekvQ2X', 'RewardInsert');
  3. // common-plugin/Scripts/RewardInsert.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 AldUtils_1 = require("./AldUtils");
  27. var YZ_Constant_1 = require("./YZ_Constant");
  28. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  29. /**
  30. * 激励插屏
  31. */
  32. var RewardInsert = /** @class */ (function (_super) {
  33. __extends(RewardInsert, _super);
  34. function RewardInsert() {
  35. var _this = _super !== null && _super.apply(this, arguments) || this;
  36. _this._jumpList = null;
  37. _this._items = [];
  38. _this.isShow = false;
  39. _this._panel = null;
  40. _this._mask = null;
  41. return _this;
  42. }
  43. RewardInsert.prototype.onLoad = function () {
  44. cc.game.addPersistRootNode(this.node);
  45. this._mask = this.node.getChildByName("Mask");
  46. this._panel = this.node.getChildByName("Panel");
  47. for (var i = 0; i < 6; i++) {
  48. var item = this._panel.getChildByName("Item" + i);
  49. var qcrossWidgetItem = item.getComponent("QCrossWidgetItem");
  50. qcrossWidgetItem._location = YZ_Constant_1.SubLocation.isReward;
  51. this._items.push(qcrossWidgetItem);
  52. }
  53. var ratio = 1;
  54. if (cc.winSize.height < cc.winSize.width) {
  55. // 横屏游戏
  56. ratio = cc.winSize.width / 1920 * 0.7;
  57. }
  58. else {
  59. ratio = cc.winSize.width / 1080;
  60. }
  61. this._panel.scale = ratio;
  62. };
  63. RewardInsert.prototype.start = function () {
  64. this._jumpList = Utils_1.utils.getRecommondGameList();
  65. if (this._jumpList && this._jumpList.length > 0) {
  66. this._initWidget();
  67. }
  68. else {
  69. cc.warn("交叉推广数据为null,激励插屏组件不显示!");
  70. Utils_1.utils.adManager.videoCallBack && Utils_1.utils.adManager.videoCallBack(false, "激励组件加载失败!");
  71. Utils_1.utils.adManager.videoCallBack = null;
  72. this.node.destroy();
  73. }
  74. };
  75. RewardInsert.prototype._initWidget = function () {
  76. var idx = 0;
  77. for (var i = 0; i < this._jumpList.length; i++) {
  78. var data = this._jumpList[i];
  79. if (data && data.logo) {
  80. var itemIdx = idx;
  81. if (itemIdx >= this._items.length) {
  82. return;
  83. }
  84. idx++;
  85. this._items[itemIdx].init(data);
  86. }
  87. }
  88. };
  89. RewardInsert.prototype.hide = function () {
  90. // this._panel.runAction(cc.sequence(cc.moveTo(0.3, CompatibleTool.position(-this._panel.getContentSize().width, 0)).easing(cc.easeQuadraticActionOut()), cc.callFunc(() => {
  91. this._panel.active = false;
  92. this._mask.active = false;
  93. // })));
  94. };
  95. RewardInsert.prototype.onCloseBtnHandler = function (event, data) {
  96. this.hide();
  97. Utils_1.utils.adManager.videoCallBack && Utils_1.utils.adManager.videoCallBack(false, "未点击试玩奖励!");
  98. Utils_1.utils.adManager.videoCallBack = null;
  99. };
  100. RewardInsert.prototype.update = function (dt) {
  101. if (!this.isShow) {
  102. Utils_1.utils.showLog("show insertReward>>>>>");
  103. AldUtils_1.default.SendEvent("显示激励插屏");
  104. this.isShow = true;
  105. this._panel.active = true;
  106. this._mask.active = true;
  107. }
  108. };
  109. RewardInsert = __decorate([
  110. ccclass
  111. ], RewardInsert);
  112. return RewardInsert;
  113. }(cc.Component));
  114. exports.default = RewardInsert;
  115. cc._RF.pop();