e31b1734-6253-43db-9551-438af871d0cb.js 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. "use strict";
  2. cc._RF.push(module, 'e31b1c0YlND25VRQ4r4cdDL', 'RecommendGamesWidget');
  3. // common-plugin/Scripts/RecommendGamesWidget.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 PlatUtils_1 = require("./PlatUtils");
  27. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  28. var RecommendGamesWidget = /** @class */ (function (_super) {
  29. __extends(RecommendGamesWidget, _super);
  30. function RecommendGamesWidget() {
  31. var _this = _super !== null && _super.apply(this, arguments) || this;
  32. _this._recommendNode = null;
  33. _this._isInit = false;
  34. return _this;
  35. }
  36. RecommendGamesWidget.prototype.onLoad = function () {
  37. this._recommendNode = this.getComponentInChildren("RecommendGamesNode");
  38. this._recommendNode.node.active = false;
  39. };
  40. RecommendGamesWidget.prototype.onEnable = function () {
  41. var _this = this;
  42. Utils_1.utils.registerServerInitEvent(function () {
  43. _this._initWidget();
  44. }, this);
  45. };
  46. RecommendGamesWidget.prototype.onDisable = function () {
  47. Utils_1.utils.unregisterServerInitEvent(this);
  48. };
  49. RecommendGamesWidget.prototype._initWidget = function () {
  50. if (this._isInit)
  51. return;
  52. var valid = true;
  53. if (Utils_1.utils.isShowRecommondGamesList()) {
  54. if (PlatUtils_1.default.IsDouyin) {
  55. if (!Utils_1.utils.Tool_Douyin.isShowMoreGamesModal()) {
  56. this.node.destroy();
  57. }
  58. }
  59. var data = Utils_1.utils.getRecommondGameList();
  60. if (data) {
  61. if (data.length > 0) {
  62. this._isInit = true;
  63. this._recommendNode.init(data);
  64. this._recommendNode.node.active = true;
  65. }
  66. else {
  67. cc.warn("交叉推广数据长度为0");
  68. valid = false;
  69. }
  70. }
  71. else {
  72. cc.warn("交叉推广数据为null!");
  73. valid = false;
  74. }
  75. }
  76. if (!valid) {
  77. this.node.destroy();
  78. }
  79. };
  80. RecommendGamesWidget = __decorate([
  81. ccclass
  82. ], RecommendGamesWidget);
  83. return RecommendGamesWidget;
  84. }(cc.Component));
  85. exports.default = RecommendGamesWidget;
  86. cc._RF.pop();