StageUpgradeViewItem.js 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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("SwitchFrame"),
  19. a = t("MyBigLong"),
  20. n = t("StageUpgradeService"),
  21. { ccclass: r, property: l, menu: h } = cc._decorator;
  22. t = class extends cc.Component {
  23. constructor() {
  24. super(...arguments),
  25. (this.content = null),
  26. (this.titleLab = null),
  27. (this.descLab = null),
  28. (this.iconSpr = null),
  29. (this.costBtn = null),
  30. (this.costLab = null),
  31. (this.switchFrame = null),
  32. (this.data = null),
  33. (this.isShow = !1),
  34. (this.isDestroy = !0);
  35. }
  36. setData(t) {
  37. (this.data = t), (this.isShow = !1);
  38. }
  39. updtaeBtnState() {
  40. var t = this.data.canBuy();
  41. (this.costBtn.interactable = t),
  42. this.costLab.setMaterial(0, t ? this.costBtn.normalMaterial : this.costBtn.grayMaterial);
  43. }
  44. show() {
  45. var t;
  46. (this.content.active = !0),
  47. this.isShow ||
  48. ((this.isShow = !0),
  49. (this.titleLab.string = this.data.title),
  50. (this.descLab.string = this.data.desc),
  51. (this.costLab.string = a.default.toString(this.data.cost)),
  52. (t = this.data.getIconUrl()) ?
  53. s.default.CommonUtils.setSpriteFrame(t, this.iconSpr) :
  54. ((this.iconSpr.spriteFrame = this.data.getFoodImg().spriteFrame),
  55. this.switchFrame &&
  56. ((this.switchFrame.node.active = !0),
  57. this.data.cfg.ability_type == n.AbilityType.menuprofit ?
  58. (this.switchFrame.frameIndex = 0) :
  59. this.data.cfg.ability_type == n.AbilityType.fastermenu ?
  60. (this.switchFrame.frameIndex = 1) :
  61. (this.switchFrame.node.active = !1)))),
  62. this.updtaeBtnState();
  63. }
  64. hide() {
  65. this.content.active = !1;
  66. }
  67. onTouchCostBtn() {
  68. var t = this.costBtn.node.convertToWorldSpaceAR(cc.Vec2.ZERO);
  69. n.default.ins.buy(this.data.cfg.order, !1, t) &&
  70. this.isDestroy &&
  71. (this.node.removeFromParent(), this.node.destroy());
  72. }
  73. };
  74. e([l(cc.Node)], t.prototype, "content", void 0),
  75. e([l(cc.Label)], t.prototype, "titleLab", void 0),
  76. e([l(cc.Label)], t.prototype, "descLab", void 0),
  77. e([l(cc.Sprite)], t.prototype, "iconSpr", void 0),
  78. e([l(cc.Button)], t.prototype, "costBtn", void 0),
  79. e([l(cc.Label)], t.prototype, "costLab", void 0),
  80. e([l(o.default)], t.prototype, "switchFrame", void 0),
  81. (t = e([r], t)),
  82. (i.default = t);