CostumeRefundView.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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("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.curItemBgSpr = null),
  29. (this.iconSpr = null),
  30. (this.costumeTypeSpr = null),
  31. (this.curArrowListNode = null),
  32. (this.lvLab = null),
  33. (this.originalItemBgSpr = null),
  34. (this.originalIconSpr = null),
  35. (this.originalCostumeTypeSpr = null),
  36. (this.originalArrowListNode = null),
  37. (this.originalLvLab = null),
  38. (this.refundBtnBtn = null),
  39. (this.diamondLabLab = null),
  40. (this.diamondIcon = null),
  41. (this.bgType = 1),
  42. (this.item = null);
  43. }
  44. initUI() {
  45. super.initUI();
  46. }
  47. open(t) {
  48. super.open(), (this.item = t), this.updateUI();
  49. }
  50. updateUI() {
  51. (this.lvLab.string = `Lv.${this.item.data.lv}/${this.item.gradeCfg.max_level}`),
  52. o.default.CommonUtils.setSpriteFrameByBundle(r.BundleType.MAP_ICON, this.item.getIcon(), this.iconSpr),
  53. o.default.CommonUtils.setSpriteFrameByBundle(
  54. r.BundleType.MAP_ICON,
  55. this.item.getTypeIcon(),
  56. this.costumeTypeSpr
  57. ),
  58. o.default.CommonUtils.setSpriteFrame(l.getRarityUrlByGrade(this.item.data.grade), this.curItemBgSpr),
  59. (this.originalLvLab.string = `Lv.1/${this.item.gradeCfg.max_level}`),
  60. o.default.CommonUtils.setSpriteFrameByBundle(
  61. r.BundleType.MAP_ICON,
  62. this.item.getIcon(),
  63. this.originalIconSpr
  64. ),
  65. o.default.CommonUtils.setSpriteFrameByBundle(
  66. r.BundleType.MAP_ICON,
  67. this.item.getTypeIcon(),
  68. this.originalCostumeTypeSpr
  69. ),
  70. o.default.CommonUtils.setSpriteFrame(l.getRarityUrlByGrade(this.item.data.grade), this.originalItemBgSpr),
  71. (this.diamondLabLab.string = "" + this.item.getLvCost(this.item.data.lv));
  72. var e = l.getGradeLv(this.item.data.grade);
  73. const i = this.curArrowListNode.children,
  74. s = this.originalArrowListNode.children;
  75. for (let t = 0; t < i.length; t++) i[t].active = s[t].active = t < e;
  76. }
  77. playDiamonAni(t) {
  78. const e = o.default.ViewManager.uiRoot;
  79. var i = this.diamondLabLab.node.parent.convertToWorldSpaceAR(this.diamondLabLab.node.position),
  80. i = e.convertToNodeSpaceAR(i),
  81. s = this.diamondIcon.convertToWorldSpaceAR(cc.Vec2.ZERO),
  82. s = e.convertToNodeSpaceAR(s);
  83. a.default.instance.playMoneyAni(i, s, n.CostType.diamond, e, t);
  84. }
  85. onToucRefundBtn() {
  86. var t = this.item.getLvCost(this.item.data.lv);
  87. h.default.ins.refundCostume(this.item) && (this.closeView(), this.playDiamonAni(t));
  88. }
  89. };
  90. e([d({type: cc.Sprite})], t.prototype, "curItemBgSpr", void 0),
  91. e([d({type: cc.Sprite})], t.prototype, "iconSpr", void 0),
  92. e([d({type: cc.Sprite})], t.prototype, "costumeTypeSpr", void 0),
  93. e([d({type: cc.Node})], t.prototype, "curArrowListNode", void 0),
  94. e([d({type: cc.Label})], t.prototype, "lvLab", void 0),
  95. e([d({type: cc.Sprite})], t.prototype, "originalItemBgSpr", void 0),
  96. e([d({type: cc.Sprite})], t.prototype, "originalIconSpr", void 0),
  97. e([d({type: cc.Sprite})], t.prototype, "originalCostumeTypeSpr", void 0),
  98. e([d({type: cc.Node})], t.prototype, "originalArrowListNode", void 0),
  99. e([d({type: cc.Label})], t.prototype, "originalLvLab", void 0),
  100. e([d({type: cc.Button})], t.prototype, "refundBtnBtn", void 0),
  101. e([d({type: cc.Label})], t.prototype, "diamondLabLab", void 0),
  102. e([d(cc.Node)], t.prototype, "diamondIcon", void 0),
  103. (t = e([c], t)),
  104. (i.default = t);