CostumeMergeAniView.js 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 s = t("App"),
  18. o = t("BaseView"),
  19. a = (t("ViewConst"), t("CostumeConst")),
  20. n = t("CostumeBagItem"),
  21. {ccclass: r, property: l} = cc._decorator;
  22. t = class extends o.default {
  23. constructor() {
  24. super(...arguments),
  25. (this.infoAni = null),
  26. (this.infoNode = null),
  27. (this.newIcon = null),
  28. (this.specialSpr = null),
  29. (this.specialRichText = null),
  30. (this.nameLab = null),
  31. (this.moneyRateLab = null),
  32. (this.mergeAni = null),
  33. (this.newItem = null),
  34. (this.mergeItems = []),
  35. (this.isCanClose = !1),
  36. (this.num = 0),
  37. (this.bgType = 1);
  38. }
  39. initUI() {
  40. super.initUI(),
  41. this.mergeAni.on(cc.Animation.EventType.FINISHED, this.onMergeAniFinished, this),
  42. this.infoAni.on(cc.Animation.EventType.FINISHED, this.onInfoAniFinished, this);
  43. }
  44. open(e, t, i) {
  45. if ((super.open(), (this.infoNode.active = !1), (this.num = i), 1 === e.length))
  46. this.mergeItems[0].setData(e[0]),
  47. this.mergeItems[1].setData(t.getLastGradeItem()),
  48. this.mergeAni.play("work2");
  49. else {
  50. for (let t = 0; t < e.length; t++) this.mergeItems[t].setData(e[t]);
  51. this.mergeItems[2].setData(t.getLastGradeItem()), this.mergeAni.play("work");
  52. }
  53. this.scheduleOnce(() => {
  54. (this.infoNode.active = !0), this.infoAni.play("work");
  55. }, 1.15),
  56. this.newItem.setData(t),
  57. (this.nameLab.string = t.getName()),
  58. (this.moneyRateLab.string = "+" + t.getValue() + "%"),
  59. t.data.grade < a.RarityType.rare
  60. ? (this.specialSpr.node.active = !1)
  61. : (s.default.CommonUtils.setSpriteFrame(a.getGradeBgByGrade(t.data.grade), this.specialSpr),
  62. (this.specialRichText.string = t.getCurMaxSpecialAbilityStr()),
  63. (t = a.getGradeLv(t.data.grade)),
  64. (this.newIcon.active = 0 === t)),
  65. (this.isCanClose = !1);
  66. }
  67. onMergeAniFinished() {
  68. this.isCanClose = !0;
  69. }
  70. onInfoAniFinished() {
  71. this.infoAni.play("idle");
  72. }
  73. onTouchClose() {
  74. this.isCanClose && (this.closeView(), this.num && s.default.ViewManager.open(49, this.num));
  75. }
  76. };
  77. e([l(cc.Animation)], t.prototype, "infoAni", void 0),
  78. e([l(cc.Node)], t.prototype, "infoNode", void 0),
  79. e([l(cc.Node)], t.prototype, "newIcon", void 0),
  80. e([l(cc.Sprite)], t.prototype, "specialSpr", void 0),
  81. e([l(cc.RichText)], t.prototype, "specialRichText", void 0),
  82. e([l(cc.Label)], t.prototype, "nameLab", void 0),
  83. e([l(cc.Label)], t.prototype, "moneyRateLab", void 0),
  84. e([l(cc.Animation)], t.prototype, "mergeAni", void 0),
  85. e([l(n.CostumeBagItem)], t.prototype, "newItem", void 0),
  86. e([l([n.CostumeBagItem])], t.prototype, "mergeItems", void 0),
  87. (t = e([r], t)),
  88. (i.default = t);