a1f40ac2-16d9-4e54-9513-b0c942f72323.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. "use strict";
  2. cc._RF.push(module, 'a1f40rCFtlOVJUTsMlC9yMj', 'YZ_StatementRecommentAd');
  3. // common-plugin/Scripts/YZ_StatementRecommentAd.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 List_1 = require("./List");
  29. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  30. var YZ_StatementRecommentAd = /** @class */ (function (_super) {
  31. __extends(YZ_StatementRecommentAd, _super);
  32. function YZ_StatementRecommentAd() {
  33. var _this = _super !== null && _super.apply(this, arguments) || this;
  34. _this._jumpList = null;
  35. _this._items = [];
  36. _this.listView = null;
  37. _this._pageItem = null;
  38. _this._pageRecItem = null;
  39. _this._recListNode = null;
  40. _this.nativeData = null;
  41. _this._nativeAd = null;
  42. _this.showNativeAd = true; //是否显示原生广告
  43. _this.yzItem = null;
  44. _this._nativeIsShow = false;
  45. _this.autoScorll = false;
  46. return _this;
  47. }
  48. YZ_StatementRecommentAd.prototype.onLoad = function () {
  49. this._recListNode = this.node.getChildByName("RecList");
  50. this.listView = this._recListNode.getChildByName("ScrollView").getComponent(List_1.default);
  51. this._nativeAd = this.node.getChildByName("nativeAd");
  52. AldUtils_1.default.SendEvent("显示结算推荐组件");
  53. };
  54. YZ_StatementRecommentAd.prototype.start = function () {
  55. if (this.showNativeAd) {
  56. this._recListNode.active = false;
  57. this.yzItem = this._nativeAd.getComponent("YZ_NativeItem");
  58. this.yzItem.showType = 1;
  59. Utils_1.utils.adManager.createNativeAd(null, this.yzItem);
  60. Utils_1.utils.showLog("交叉推广调用原生广告《《《《《《《");
  61. }
  62. else {
  63. this._recListNode.active = true;
  64. this._jumpList = Utils_1.utils.getRecommondGameList();
  65. if (this._jumpList && this._jumpList.length > 0) {
  66. this._initWidget();
  67. this.listView.numItems = this._jumpList.length;
  68. }
  69. else {
  70. cc.warn("交叉推广数据为null, 6元素交叉推广组件不显示!");
  71. this.node.destroy();
  72. }
  73. }
  74. };
  75. YZ_StatementRecommentAd.prototype.hideLastNode = function () {
  76. for (var i = 5; i > 2; i--) {
  77. this._items[i].node.active = false;
  78. }
  79. };
  80. YZ_StatementRecommentAd.prototype.update = function (dt) {
  81. if (this.yzItem && this.yzItem.content && this.yzItem.content.active && !this._nativeIsShow) {
  82. this._nativeIsShow = false;
  83. this._recListNode.active = false;
  84. }
  85. if (this.autoScorll && !this.listView.scrollView.isScrolling()) {
  86. this.listView.content.y += dt * 150;
  87. this.listView._onScrolling();
  88. }
  89. };
  90. YZ_StatementRecommentAd.prototype.onListRender = function (item, idx) {
  91. var qcrossWidgetItem = item.getComponent("QCrossWidgetItem");
  92. qcrossWidgetItem._location = YZ_Constant_1.SubLocation.isStatement;
  93. qcrossWidgetItem.getComponent("QCrossWidgetItem").init(this._jumpList[idx]);
  94. };
  95. YZ_StatementRecommentAd.prototype._initWidget = function () {
  96. var _this = this;
  97. if (Utils_1.utils.ServerConfig.st_recomment_is_hide_banner && Utils_1.utils.ServerConfig.st_recomment_is_hide_banner == "true") {
  98. Utils_1.utils.showLog("服务器配置显示结算互推后隐藏banner >>>");
  99. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Game);
  100. Utils_1.utils.adManager.HideBanner(YZ_Constant_1.BannerLocation.Over);
  101. }
  102. this.scheduleOnce(function () {
  103. _this.autoScorll = true;
  104. }, 1);
  105. Utils_1.utils.postRecommentShowData(YZ_Constant_1.SubLocation.isStatement);
  106. };
  107. YZ_StatementRecommentAd = __decorate([
  108. ccclass
  109. ], YZ_StatementRecommentAd);
  110. return YZ_StatementRecommentAd;
  111. }(cc.Component));
  112. exports.default = YZ_StatementRecommentAd;
  113. cc._RF.pop();