CotumeUpgradView.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 a = t("App"),
  18. s = t("BaseView"),
  19. o = t("EffectUtils"),
  20. n = t("BagController"),
  21. r = t("GameConst"),
  22. l = t("CostumeConst"),
  23. h = t("CostumeController"),
  24. {ccclass: c, property: d} = cc._decorator;
  25. t = class extends s.default {
  26. constructor() {
  27. super(...arguments),
  28. (this.qualitySpr = null),
  29. (this.curItemBgSpr = null),
  30. (this.curIconSpr = null),
  31. (this.curCostumeTypeSpr = null),
  32. (this.curArrowListNode = null),
  33. (this.nextItemBgSpr = null),
  34. (this.nextIconSpr = null),
  35. (this.nextCostumeTypeSpr = null),
  36. (this.nextArrowListNode = null),
  37. (this.curMaxLvLab = null),
  38. (this.nextMaxLvLab = null),
  39. (this.curMaxRateLab = null),
  40. (this.nextMaxRateLab = null),
  41. (this.descRichText = null),
  42. (this.bottomNode = null),
  43. (this.costBtnNode = null),
  44. (this.costLabLab = null),
  45. (this.diamondIcon = null),
  46. (this.bgType = 1),
  47. (this.item = null),
  48. (this.nextItem = null);
  49. }
  50. initUI() {
  51. super.initUI();
  52. }
  53. open(t, e) {
  54. super.open(),
  55. (this.item = t),
  56. (this.nextItem = t.getGradeItemByGrade(e)),
  57. this.item.data.grade + 1 == e && this.item.canUpgradeGrade()
  58. ? ((this.bottomNode.active = !0),
  59. (this.costLabLab.string = this.item.gradeCfg.upgrade_grade_cost.toString()))
  60. : (this.bottomNode.active = !1),
  61. this.updateUI();
  62. }
  63. updateUI() {
  64. (this.curMaxLvLab.string = this.item.gradeCfg.max_level.toString()),
  65. (this.curMaxRateLab.string = "+" + this.item.getMaxLvValue() + "%"),
  66. a.default.CommonUtils.setSpriteFrameByBundle(r.BundleType.MAP_ICON, this.item.getIcon(), this.curIconSpr),
  67. a.default.CommonUtils.setSpriteFrameByBundle(
  68. r.BundleType.MAP_ICON,
  69. this.item.getTypeIcon(),
  70. this.curCostumeTypeSpr
  71. ),
  72. a.default.CommonUtils.setSpriteFrame(l.getRarityUrlByGrade(this.item.data.grade), this.curItemBgSpr);
  73. var e = l.getGradeLv(this.item.data.grade);
  74. const i = this.curArrowListNode.children;
  75. for (let t = 0; t < i.length; t++) i[t].active = t < e;
  76. (this.nextMaxLvLab.string = this.nextItem.gradeCfg.max_level.toString()),
  77. (this.nextMaxRateLab.string = "+" + this.nextItem.getMaxLvValue() + "%"),
  78. a.default.CommonUtils.setSpriteFrameByBundle(
  79. r.BundleType.MAP_ICON,
  80. this.nextItem.getIcon(),
  81. this.nextIconSpr
  82. ),
  83. a.default.CommonUtils.setSpriteFrameByBundle(
  84. r.BundleType.MAP_ICON,
  85. this.nextItem.getTypeIcon(),
  86. this.nextCostumeTypeSpr
  87. ),
  88. a.default.CommonUtils.setSpriteFrame(l.getRarityUrlByGrade(this.nextItem.data.grade), this.nextItemBgSpr);
  89. var s = l.getGradeLv(this.item.data.grade);
  90. const o = this.curArrowListNode.children;
  91. for (let t = 0; t < o.length; t++) o[t].active = t < s;
  92. (this.descRichText.string = this.item.getCurMaxSpecialAbilityStr(this.nextItem.data.grade)),
  93. a.default.CommonUtils.setSpriteFrame(l.getGradeBgByGrade(this.nextItem.data.grade), this.qualitySpr);
  94. }
  95. playDiamonAni(t) {
  96. const e = a.default.ViewManager.uiRoot;
  97. var i = this.node.convertToWorldSpaceAR(cc.Vec2.ZERO),
  98. i = e.convertToNodeSpaceAR(i),
  99. s = this.diamondIcon.convertToWorldSpaceAR(cc.Vec2.ZERO),
  100. s = e.convertToNodeSpaceAR(s);
  101. o.default.instance.playMoneyAni(i, s, n.CostType.diamond, e, t);
  102. }
  103. onToucUpgradeBtn() {
  104. var t = this.item.getLvCost(this.item.data.lv);
  105. h.default.ins.upgradeGrade(this.item.data.uuid) && (this.closeView(), this.playDiamonAni(t));
  106. }
  107. };
  108. e([d({type: cc.Sprite})], t.prototype, "qualitySpr", void 0),
  109. e([d({type: cc.Sprite})], t.prototype, "curItemBgSpr", void 0),
  110. e([d({type: cc.Sprite})], t.prototype, "curIconSpr", void 0),
  111. e([d({type: cc.Sprite})], t.prototype, "curCostumeTypeSpr", void 0),
  112. e([d({type: cc.Node})], t.prototype, "curArrowListNode", void 0),
  113. e([d({type: cc.Sprite})], t.prototype, "nextItemBgSpr", void 0),
  114. e([d({type: cc.Sprite})], t.prototype, "nextIconSpr", void 0),
  115. e([d({type: cc.Sprite})], t.prototype, "nextCostumeTypeSpr", void 0),
  116. e([d({type: cc.Node})], t.prototype, "nextArrowListNode", void 0),
  117. e([d({type: cc.Label})], t.prototype, "curMaxLvLab", void 0),
  118. e([d({type: cc.Label})], t.prototype, "nextMaxLvLab", void 0),
  119. e([d({type: cc.Label})], t.prototype, "curMaxRateLab", void 0),
  120. e([d({type: cc.Label})], t.prototype, "nextMaxRateLab", void 0),
  121. e([d({type: cc.RichText})], t.prototype, "descRichText", void 0),
  122. e([d({type: cc.Node})], t.prototype, "bottomNode", void 0),
  123. e([d({type: cc.Node})], t.prototype, "costBtnNode", void 0),
  124. e([d({type: cc.Label})], t.prototype, "costLabLab", void 0),
  125. e([d(cc.Node)], t.prototype, "diamondIcon", void 0),
  126. (t = e([c], t)),
  127. (i.default = t);