AbilityView.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 });
  17. const s = t("BaseView"),
  18. o = t("AbilityInfoService"),
  19. a = t("AbilityViewItem"),
  20. { ccclass: n, property: r, menu: l } = cc._decorator;
  21. t = class extends s.default {
  22. constructor() {
  23. super(...arguments),
  24. (this.itemPre = null),
  25. (this.content = null),
  26. (this.abilityViewItems = null),
  27. (this.bgType = 1);
  28. }
  29. initUI() {
  30. super.initUI(), this.initItem();
  31. }
  32. open() {
  33. super.open(), this.updateUI();
  34. }
  35. initItem() {
  36. this.abilityViewItems = [];
  37. var s = o.default.ins.datas;
  38. for (let i = 0; i < s.length; i++) {
  39. let t = cc.instantiate(this.itemPre);
  40. this.content.addChild(t);
  41. let e = t.getComponent(a.default);
  42. e.setData(s[i]), this.abilityViewItems.push(e);
  43. }
  44. }
  45. updateUI() {
  46. const e = o.default.ins.datas;
  47. for (let t = 0; t < e.length; t++)
  48. if (!e[t].isUnlock() && (0 === t || e[t - 1].isUnlock())) {
  49. this.abilityViewItems[t].showUnlockBtn();
  50. break;
  51. }
  52. }
  53. };
  54. e([r(cc.Prefab)], t.prototype, "itemPre", void 0),
  55. e([r(cc.Node)], t.prototype, "content", void 0),
  56. (t = e([n], t)),
  57. (i.default = t);