CostumeBagItem.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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.CostumeBagItem = void 0);
  17. const s = t("App"),
  18. o = (t("ViewConst"), t("GameConst")),
  19. a = t("CostumeConst"),
  20. {ccclass: n, property: r} = cc._decorator;
  21. t = class extends cc.Component {
  22. constructor() {
  23. super(...arguments),
  24. (this.typeIcon = null),
  25. (this.icon = null),
  26. (this.bgSpr = null),
  27. (this.lvLab = null),
  28. (this.data = null),
  29. (this.arrowList = null),
  30. (this.recommendNode = null);
  31. }
  32. setData(t) {
  33. (this.data = t),
  34. this.lvLab && (this.lvLab.string = "Lv." + t.data.lv),
  35. s.default.CommonUtils.setSpriteFrame(a.getRarityUrlByGrade(t.data.grade), this.bgSpr),
  36. s.default.CommonUtils.setSpriteFrameByBundle(o.BundleType.MAP_ICON, t.getIcon(), this.icon),
  37. s.default.CommonUtils.setSpriteFrameByBundle(o.BundleType.MAP_ICON, t.getTypeIcon(), this.typeIcon);
  38. var e = a.getGradeLv(t.data.grade);
  39. const i = this.arrowList.children;
  40. for (let t = 0; t < i.length; t++) i[t].active = t < e;
  41. }
  42. hide() {
  43. (this.data = null),
  44. (this.lvLab.node.active = this.typeIcon.node.active = this.icon.node.active = !1),
  45. s.default.CommonUtils.setSpriteFrame(a.getRarityUrlByGrade(a.RarityType.none), this.bgSpr);
  46. }
  47. show() {
  48. this.lvLab.node.active = this.typeIcon.node.active = this.icon.node.active = !0;
  49. }
  50. onToucItem() {
  51. s.default.ViewManager.open(26, this.data);
  52. }
  53. };
  54. e([r(cc.Sprite)], t.prototype, "typeIcon", void 0),
  55. e([r(cc.Sprite)], t.prototype, "icon", void 0),
  56. e([r(cc.Sprite)], t.prototype, "bgSpr", void 0),
  57. e([r(cc.Label)], t.prototype, "lvLab", void 0),
  58. e([r(cc.Node)], t.prototype, "arrowList", void 0),
  59. e([r(cc.Node)], t.prototype, "recommendNode", void 0),
  60. (t = e([n()], t)),
  61. (i.CostumeBagItem = t);