44f5b512-d2f5-4eb2-bf55-15c7b351fb08.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. "use strict";
  2. cc._RF.push(module, '44f5bUS0vVOsr9VFcezUfsI', 'TryGamesWidget');
  3. // common-plugin/Scripts/TryGamesWidget.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 TryGamesWidget = /** @class */ (function (_super) {
  28. __extends(TryGamesWidget, _super);
  29. function TryGamesWidget() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this._tryGameNode = null;
  32. _this._isInit = false;
  33. return _this;
  34. }
  35. TryGamesWidget.prototype.onLoad = function () {
  36. this._tryGameNode = this.getComponentInChildren("TryGameNode");
  37. this._tryGameNode.node.active = false;
  38. };
  39. TryGamesWidget.prototype.onEnable = function () {
  40. var _this = this;
  41. Utils_1.utils.registerServerInitEvent(function () {
  42. _this._initWidget();
  43. }, this);
  44. };
  45. TryGamesWidget.prototype.onDisable = function () {
  46. Utils_1.utils.unregisterServerInitEvent(this);
  47. };
  48. TryGamesWidget.prototype._initWidget = function () {
  49. if (this._isInit)
  50. return;
  51. var dataValid = true;
  52. var data = Utils_1.utils.getInnerRecommendData();
  53. if (data) {
  54. if (data.jump_list) {
  55. if (data.jump_list.length <= 0) {
  56. cc.warn("字段jump_list的长度不合法!");
  57. dataValid = false;
  58. }
  59. }
  60. else {
  61. cc.warn("字段jump_list不存在!");
  62. dataValid = false;
  63. }
  64. }
  65. else {
  66. cc.warn("交叉推广数据为null");
  67. dataValid = false;
  68. }
  69. if (dataValid) {
  70. this._isInit = true;
  71. Utils_1.utils.showLog("交叉推广数据:", JSON.stringify(data));
  72. this._tryGameNode.init({ "jump_refresh_time": data.jump_refresh_time, "jump_list": data.jump_list });
  73. this._tryGameNode.node.active = true;
  74. }
  75. else {
  76. this.node.destroy();
  77. }
  78. };
  79. TryGamesWidget = __decorate([
  80. ccclass
  81. ], TryGamesWidget);
  82. return TryGamesWidget;
  83. }(cc.Component));
  84. exports.default = TryGamesWidget;
  85. cc._RF.pop();