63a41708-3d02-43bf-a0d7-7d653b469e76.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. "use strict";
  2. cc._RF.push(module, '63a41cIPQJDv6DXfWU7Rp52', 'GamePage');
  3. // common-plugin/Scripts/GamePage.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 YZ_Constant_1 = require("./YZ_Constant");
  26. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  27. var GamePage = /** @class */ (function (_super) {
  28. __extends(GamePage, _super);
  29. function GamePage() {
  30. var _this = _super !== null && _super.apply(this, arguments) || this;
  31. _this._gameList = null;
  32. _this._gameItemNodes = [];
  33. _this._isContentFilled = false;
  34. _this._dataDirty = false;
  35. return _this;
  36. }
  37. GamePage.prototype.init = function (data) {
  38. this._gameList = data;
  39. this._dataDirty = true;
  40. };
  41. GamePage.prototype.onLoad = function () {
  42. this._gameItemNodes = this.node.children;
  43. for (var i = 0; i < this._gameItemNodes.length; i++) {
  44. this._gameItemNodes[i].active = false;
  45. }
  46. };
  47. GamePage.prototype.update = function (dt) {
  48. if (this._dataDirty) {
  49. this._dataDirty = false;
  50. this._updateContent();
  51. }
  52. };
  53. GamePage.prototype._updateContent = function () {
  54. if (this._gameList && this._gameList.length > 0 && this._gameList.length <= 5) {
  55. this._isContentFilled = true;
  56. var itemData = null;
  57. for (var i = 0; i < this._gameList.length; i++) {
  58. itemData = this._gameList[i];
  59. var newGameItemNode = this._gameItemNodes[i];
  60. var gameItem = newGameItemNode.getComponent("GameItem");
  61. gameItem.init(itemData, YZ_Constant_1.SubLocation.isScrollbar);
  62. newGameItemNode.active = true;
  63. }
  64. }
  65. };
  66. GamePage = __decorate([
  67. ccclass
  68. ], GamePage);
  69. return GamePage;
  70. }(cc.Component));
  71. exports.default = GamePage;
  72. cc._RF.pop();