MoneyBar.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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("NotificationConst"),
  19. a = t("IBuff"),
  20. n = t("GameConst"),
  21. r = t("GlobalAttr"),
  22. l = t("MyBigLong"),
  23. h = t("MapService"),
  24. {ccclass: c, property: d} = cc._decorator;
  25. t = class extends cc.Component {
  26. constructor() {
  27. super(...arguments), (this.icon = null), (this.label = null), (this.rateLab = null);
  28. }
  29. onLoad() {
  30. this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
  31. }
  32. onTouchEnd() {}
  33. onEnable() {
  34. s.default.NotificationCenter.addListener(o.NotificationConst.UPDATE_MONEY, this.onUpdateMoney, this),
  35. s.default.NotificationCenter.addListener(n.GameNotificationConst.UPDATE_BUFF, this.onUpdateBuff, this),
  36. this.onUpdateMoney(),
  37. this.onUpdateBuff(null, null, "FOOD_SELL_RATE");
  38. }
  39. onUpdateMoney() {
  40. this.label.string = l.default.toString(h.default.ins.mapSaveData.money);
  41. }
  42. updateContent() {}
  43. onUpdateBuff(t, e, i) {
  44. a.BUFF_TYPE[i] == a.BUFF_TYPE.FOOD_SELL_RATE &&
  45. ((i = r.default.ins.buffAttr.attr.FOOD_SELL_RATE) && 1 < i
  46. ? ((this.rateLab.node.active = !0),
  47. (this.rateLab.string = "x" + r.default.ins.buffAttr.attr.FOOD_SELL_RATE))
  48. : (this.rateLab.node.active = !1));
  49. }
  50. onDisable() {
  51. s.default.NotificationCenter.removeListener(o.NotificationConst.UPDATE_MONEY, this.onUpdateMoney, this),
  52. s.default.NotificationCenter.removeListener(n.GameNotificationConst.UPDATE_BUFF, this.onUpdateBuff, this);
  53. }
  54. };
  55. e([d(cc.Sprite)], t.prototype, "icon", void 0),
  56. e([d(cc.Label)], t.prototype, "label", void 0),
  57. e([d(cc.Label)], t.prototype, "rateLab", void 0),
  58. (t = e([c], t)),
  59. (i.default = t);