CostumeBagEquipItem.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.CostumeBagEquipItem = void 0);
  17. const s = t("App"),
  18. o = (t("ViewConst"), t("MachineLvUpAni")),
  19. a = t("GameConst"),
  20. n = t("CostumeConst"),
  21. r = t("CostumeController"),
  22. l = t("CostumeBagItem"),
  23. {ccclass: h, property: c} = cc._decorator;
  24. t = class extends l.CostumeBagItem {
  25. constructor() {
  26. super(...arguments),
  27. (this.costLab = null),
  28. (this.lvUpRateLab = null),
  29. (this.lvUpBtn = null),
  30. (this.defaultIcon = null);
  31. }
  32. setData(t) {
  33. if (t) {
  34. (this.data = t),
  35. (this.lvLab.string = `Lv.${t.data.lv}/${t.gradeCfg.max_level}`),
  36. s.default.CommonUtils.setSpriteFrame(n.getRarityUrlByGrade(t.data.grade), this.bgSpr),
  37. s.default.CommonUtils.setSpriteFrameByBundle(a.BundleType.MAP_ICON, t.getIcon(), this.icon),
  38. s.default.CommonUtils.setSpriteFrameByBundle(a.BundleType.MAP_ICON, t.getTypeIcon(), this.typeIcon),
  39. (this.costLab.string = t.cost + ""),
  40. t.isMaxLv()
  41. ? ((this.lvUpRateLab.node.active = !1), (this.lvUpBtn.node.active = !1))
  42. : ((this.lvUpBtn.node.active = !0),
  43. (this.lvUpRateLab.node.active = !0),
  44. (this.lvUpRateLab.string = `+${t.gradeCfg.value_add}%`)),
  45. (this.lvLab.node.active =
  46. this.typeIcon.node.active =
  47. this.icon.node.active =
  48. this.costLab.node.active =
  49. !0),
  50. this.defaultIcon && (this.defaultIcon.active = !1),
  51. (this.arrowList.active = !0);
  52. var e = n.getGradeLv(t.data.grade);
  53. const i = this.arrowList.children;
  54. for (let t = 0; t < i.length; t++) i[t].active = t < e;
  55. } else
  56. (this.lvUpRateLab.node.active =
  57. this.lvLab.node.active =
  58. this.typeIcon.node.active =
  59. this.icon.node.active =
  60. this.lvUpBtn.node.active =
  61. this.costLab.node.active =
  62. !1),
  63. this.defaultIcon && (this.defaultIcon.active = !0),
  64. s.default.CommonUtils.setSpriteFrame(n.getRarityUrlByGrade(n.RarityType.none), this.bgSpr),
  65. (this.arrowList.active = !1);
  66. }
  67. onTouchLvUpBtn() {
  68. if (r.default.ins.lvUp(this.data.data.uuid)) {
  69. const e = this.node;
  70. let t = s.default.NodePoolMsr.machineLvUpAni.pop();
  71. e.addChild(t), t.getComponent(o.default).playAni();
  72. }
  73. }
  74. onTouchItem() {
  75. s.default.ViewManager.open(26, this.data);
  76. }
  77. };
  78. e([c(cc.Label)], t.prototype, "costLab", void 0),
  79. e([c(cc.Label)], t.prototype, "lvUpRateLab", void 0),
  80. e([c(cc.Button)], t.prototype, "lvUpBtn", void 0),
  81. e([c(cc.Node)], t.prototype, "defaultIcon", void 0),
  82. (t = e([h()], t)),
  83. (i.CostumeBagEquipItem = t);