CostumeInfoView.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 o = t("App"),
  18. s = t("BaseView"),
  19. a = (t("ViewConst"), t("MachineLvUpAni")),
  20. n = t("GameConst"),
  21. r = t("CostumeConst"),
  22. l = t("CostumeController"),
  23. h = t("CostumeSpecialItem"),
  24. {ccclass: c, property: d} = cc._decorator;
  25. t = class extends s.default {
  26. constructor() {
  27. super(...arguments),
  28. (this.bgNode = null),
  29. (this.itemBgSpr = null),
  30. (this.iconSpr = null),
  31. (this.costumeTypeSpr = null),
  32. (this.arrowListNode = null),
  33. (this.lvLab = null),
  34. (this.nextLab = null),
  35. (this.curLab = null),
  36. (this.equipBtn = null),
  37. (this.equipLab = null),
  38. (this.upLvBtn = null),
  39. (this.costLab = null),
  40. (this.refundBtn = null),
  41. (this.lvUpTipLab = null),
  42. (this.bgType = 1),
  43. (this.refundIconSpr = null),
  44. (this.refundBtnLab = null),
  45. (this.titleLab = null),
  46. (this.specialItems = []),
  47. (this.item = null);
  48. }
  49. initUI() {
  50. super.initUI();
  51. }
  52. open(t) {
  53. super.open(), (this.item = t), this.updateData(), (this.titleLab.string = this.item.getName());
  54. t = null != this.item.data.uuid;
  55. (this.equipBtn.node.active = t),
  56. (this.refundBtn.node.active = t),
  57. (this.upLvBtn.node.active = t),
  58. (this.lvUpTipLab.node.active = t),
  59. (this.bgNode.height = t ? 980 : 880);
  60. }
  61. updateData() {
  62. const t = this.item;
  63. t.isEquip ? (this.equipLab.string = "卸下") : (this.equipLab.string = "装备"),
  64. t.isMaxLv()
  65. ? ((this.upLvBtn.interactable = !1),
  66. (this.costLab.string = "MAX"),
  67. (this.nextLab.string = `+${t.getValue()}%`))
  68. : ((this.nextLab.string = `+${t.getNextLvValue()}%`), (this.costLab.string = t.cost + "")),
  69. this.updateRefundBtnState(),
  70. (this.lvLab.string = `Lv.${t.data.lv}/${t.gradeCfg.max_level}`),
  71. (this.curLab.string = `+${t.getValue()}%`),
  72. o.default.CommonUtils.setSpriteFrameByBundle(n.BundleType.MAP_ICON, t.getIcon(), this.iconSpr),
  73. o.default.CommonUtils.setSpriteFrameByBundle(n.BundleType.MAP_ICON, t.getTypeIcon(), this.costumeTypeSpr),
  74. o.default.CommonUtils.setSpriteFrame(r.getRarityUrlByGrade(t.data.grade), this.itemBgSpr);
  75. var e = t.canUpgradeGrade();
  76. this.specialItems[0].setData(
  77. t.getSpecialAbilityStr1(),
  78. 0,
  79. t.data.grade >= r.RarityType.rare,
  80. e && this.item.data.grade + 1 == r.RarityType.rare
  81. ),
  82. this.specialItems[1].setData(
  83. t.getSpecialAbilityStr2(),
  84. 1,
  85. t.data.grade >= r.RarityType.epic,
  86. e && this.item.data.grade + 1 == r.RarityType.epic
  87. ),
  88. this.specialItems[2].setData(
  89. t.getSpecialAbilityStr3(),
  90. 2,
  91. t.data.grade >= r.RarityType.legendary,
  92. e && this.item.data.grade + 1 == r.RarityType.legendary
  93. ),
  94. this.specialItems[3].setData(
  95. t.getSpecialAbilityStr4(),
  96. 3,
  97. t.data.grade >= r.RarityType.mystic,
  98. e && this.item.data.grade + 1 == r.RarityType.mystic
  99. );
  100. var i = r.getGradeLv(t.data.grade);
  101. const s = this.arrowListNode.children;
  102. for (let t = 0; t < s.length; t++) s[t].active = t < i;
  103. }
  104. updateRefundBtnState() {
  105. var t = this.item;
  106. this.refundBtn.interactable = 1 < t.data.lv;
  107. t = 1 < t.data.lv ? this.refundBtn.normalMaterial : this.refundBtn.grayMaterial;
  108. this.refundIconSpr.setMaterial(0, t), this.refundBtnLab.setMaterial(0, t);
  109. }
  110. onTouchEquipBtn() {
  111. this.item.isEquip
  112. ? l.default.ins.unequipCostume(this.item.cfg.parts, !0, !0)
  113. : l.default.ins.equipCostume(this.item.data.uuid, !0),
  114. this.closeView();
  115. }
  116. onToucRefundBtn() {
  117. o.default.ViewManager.open(33, this.item);
  118. }
  119. onTouchLvUpBtn() {
  120. if (l.default.ins.lvUp(this.item.data.uuid)) {
  121. this.updateData();
  122. const e = this.itemBgSpr.node;
  123. let t = o.default.NodePoolMsr.machineLvUpAni.pop();
  124. e.addChild(t), t.getComponent(a.default).playAni();
  125. }
  126. }
  127. onTouchGradeBtn(t, e) {
  128. 0 <= this.item.data.uuid && o.default.ViewManager.open(34, this.item, parseInt(e));
  129. }
  130. };
  131. e([d({type: cc.Node})], t.prototype, "bgNode", void 0),
  132. e([d({type: cc.Sprite})], t.prototype, "itemBgSpr", void 0),
  133. e([d({type: cc.Sprite})], t.prototype, "iconSpr", void 0),
  134. e([d({type: cc.Sprite})], t.prototype, "costumeTypeSpr", void 0),
  135. e([d({type: cc.Node})], t.prototype, "arrowListNode", void 0),
  136. e([d({type: cc.Label})], t.prototype, "lvLab", void 0),
  137. e([d({type: cc.Label})], t.prototype, "nextLab", void 0),
  138. e([d({type: cc.Label})], t.prototype, "curLab", void 0),
  139. e([d({type: cc.Button})], t.prototype, "equipBtn", void 0),
  140. e([d({type: cc.Label})], t.prototype, "equipLab", void 0),
  141. e([d({type: cc.Button})], t.prototype, "upLvBtn", void 0),
  142. e([d({type: cc.Label})], t.prototype, "costLab", void 0),
  143. e([d({type: cc.Button})], t.prototype, "refundBtn", void 0),
  144. e([d({type: cc.Label})], t.prototype, "lvUpTipLab", void 0),
  145. e([d({type: cc.Sprite})], t.prototype, "refundIconSpr", void 0),
  146. e([d({type: cc.Label})], t.prototype, "refundBtnLab", void 0),
  147. e([d(cc.Label)], t.prototype, "titleLab", void 0),
  148. e([d(h.default)], t.prototype, "specialItems", void 0),
  149. (t = e([c], t)),
  150. (i.default = t);