ShopGiftContent.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. e =
  5. (this && this.__decorate) ||
  6. function (t, e, i, s) {
  7. var o,
  8. a = arguments.length,
  9. n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
  10. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
  11. else
  12. for (var r = t.length - 1; 0 <= r; r--)
  13. (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
  14. return 3 < a && n && Object.defineProperty(e, i, n), n;
  15. };
  16. Object.defineProperty(i, "__esModule", {value: !0}), (i.ShopGiftContent = void 0);
  17. const o = t("ShopGiftItem"),
  18. s = t("ShopContent"),
  19. {property: a, ccclass: n, menu: r} = cc._decorator;
  20. t = class extends s.ShopContent {
  21. constructor() {
  22. super(...arguments), (this.pageView = null), (this.items = null);
  23. }
  24. setData(t) {
  25. (this.items = []), (this.datas = t);
  26. }
  27. initContent() {
  28. let i = 0;
  29. if (this.itemPre)
  30. for (const s of this.datas)
  31. if (s.isShowInShopView()) {
  32. let t = cc.instantiate(this.itemPre);
  33. this.pageView.addPage(t);
  34. let e = t.getComponent(o.ShopGiftItem);
  35. e.setData(s), this.items.push(e), i++;
  36. }
  37. i || (this.node.active = !1);
  38. }
  39. updateUI() {
  40. for (let t = this.items.length - 1; 0 <= t; t--) {
  41. const e = this.items[t];
  42. if (e.isRemove()) {
  43. this.pageView.removePage(e.node), this.items.remove(e);
  44. break;
  45. }
  46. }
  47. this.items.length || (this.node.active = !1);
  48. }
  49. showContent() {
  50. this.content.active = !0;
  51. for (const t of this.items) t.showItem();
  52. }
  53. hideContent() {
  54. this.content.active = !1;
  55. }
  56. onPageView(t, e, i) {}
  57. };
  58. e([a(cc.PageView)], t.prototype, "pageView", void 0),
  59. (t = e([n, r("view/Shop/ShopGiftContent")], t)),
  60. (i.ShopGiftContent = t);