TipData.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0});
  5. const s = t("App"),
  6. o = t("LabelTip"),
  7. a = t("SoundEffectConst"),
  8. n = t("GlobalAttr"),
  9. r = t("MyBigLong"),
  10. l = t("CurrencyService"),
  11. h = t("MapService");
  12. i.default = class {
  13. constructor(t) {
  14. (this.value = 0),
  15. (this.ani = null),
  16. (this.effect = null),
  17. (this.isPlaying = !1),
  18. (this.goldLab = null),
  19. (this.deskNode = null),
  20. (this.pos = t);
  21. }
  22. addValue(t) {
  23. if (!this.ani) {
  24. const t = s.default.NodePoolMsr.tipAniPool.pop();
  25. this.deskNode.addChild(t),
  26. (t.position = this.pos),
  27. (t.y = this.pos.y + 10 - this.deskNode.y),
  28. (t.x -= this.deskNode.x),
  29. (this.ani = t.getComponent(cc.Animation)),
  30. t.on(cc.Node.EventType.TOUCH_END, this.onTouchTap, this),
  31. (this.goldLab = t.getComponentInChildren(cc.Label));
  32. }
  33. this.isPlaying || 0 !== this.value || this.ani.play("idle"),
  34. (this.ani.node.active = !0),
  35. (this.value += t),
  36. (this.goldLab.string = r.default.toString(this.value));
  37. }
  38. onPlayFinish() {
  39. this.ani.play("idle");
  40. }
  41. onTouchTap() {
  42. s.default.SoundManager.playEffect(a.SoundsDefine.GET_COIN2), this.ani.stop(), (this.ani.node.active = !1);
  43. let t = this.value,
  44. e = r.default.toString(this.value);
  45. 1 < n.default.ins.moneyRate && ((t = Math.floor(t * n.default.ins.moneyRate)), (e = r.default.toString(t))),
  46. l.default.ins.moneyChange(t),
  47. s.default.NodePoolMsr.flyLabel
  48. .pop()
  49. .getComponent(o.default)
  50. .init(h.default.ins.uiLayer, e, 35)
  51. .flyUp(this.pos.x, this.pos.y + 100, !0),
  52. (this.value = 0);
  53. const i = s.default.NodePoolMsr.getCoinEffect.pop();
  54. (i.position = this.pos), h.default.ins.uiLayer.addChild(i);
  55. }
  56. };