43ccc544-93b5-4222-987b-9a07be98b56f.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. "use strict";
  2. cc._RF.push(module, '43cccVEk7VCIph7mge+mLVv', 'GameBoxListItem');
  3. // common-plugin/Scripts/GameBoxListItem.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. /**
  28. * 推荐列表节点
  29. */
  30. var GameBoxListItem = /** @class */ (function (_super) {
  31. __extends(GameBoxListItem, _super);
  32. function GameBoxListItem() {
  33. var _this = _super !== null && _super.apply(this, arguments) || this;
  34. _this.data = null;
  35. _this.titleLabel = null;
  36. _this._dataDirty = false;
  37. _this._gameList = null;
  38. _this._gameItems = [];
  39. return _this;
  40. }
  41. GameBoxListItem.prototype.onLoad = function () {
  42. this.titleLabel = this.node.getChildByName("titleLabel").getComponent(cc.RichText);
  43. this._gameList = this.node.getChildByName("listLay");
  44. for (var i = 0; i < this._gameList.childrenCount; i++) {
  45. this._gameItems.push(this._gameList.children[i].getComponent("GameBoxListGameItem"));
  46. this._gameList.children[i].active = false;
  47. }
  48. };
  49. GameBoxListItem.prototype.init = function (data) {
  50. this.data = data;
  51. this._dataDirty = true;
  52. };
  53. GameBoxListItem.prototype.update = function (dt) {
  54. if (this._dataDirty) {
  55. this._dataDirty = false;
  56. this.updateItem();
  57. }
  58. };
  59. GameBoxListItem.prototype.updateItem = function () {
  60. if (this.data) {
  61. Utils_1.utils.showLog("boxList: ", this.data);
  62. if (this.data.title) {
  63. this.titleLabel.string = "<b>" + this.data.title + "</b>";
  64. }
  65. if (this.data.infos && this.data.infos.length > 0) {
  66. for (var i = 0; i < this.data.infos.length; i++) {
  67. if (this._gameItems[i]) {
  68. this._gameItems[i].init(this.data.infos[i]);
  69. this._gameItems[i].node.active = true;
  70. }
  71. }
  72. }
  73. }
  74. };
  75. GameBoxListItem = __decorate([
  76. ccclass
  77. ], GameBoxListItem);
  78. return GameBoxListItem;
  79. }(cc.Component));
  80. exports.default = GameBoxListItem;
  81. cc._RF.pop();