MoneyAni.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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}), (i.MoneyAni = void 0);
  17. const a = t("App"),
  18. s = t("SwitchFrame"),
  19. n = t("MyBigLong"),
  20. r = t("SoundEffectConst"),
  21. {ccclass: o, property: l} = cc._decorator;
  22. t = class extends cc.Component {
  23. constructor() {
  24. super(...arguments),
  25. (this.moneyAni = null),
  26. (this.lightAni = null),
  27. (this.switchFrame = null),
  28. (this.numLab = null),
  29. (this.pos = null),
  30. (this.callBack = null),
  31. (this.moveTime = 0.5);
  32. }
  33. onLoad() {
  34. this.moneyAni.on(cc.Animation.EventType.FINISHED, this.onMoneyAniFinish, this),
  35. this.lightAni.on(cc.Animation.EventType.FINISHED, this.onLightAniFinish, this);
  36. }
  37. playAni(t, e, i, s, o = 0) {
  38. a.default.SoundManager.playEffect(1 === e ? r.SoundsDefine.GET_COIN1 : r.SoundsDefine.GET_COIN2),
  39. (this.moneyAni.node.active = !0),
  40. (this.node.scale = 1),
  41. (this.switchFrame.frameIndex = e),
  42. (this.callBack = s),
  43. (this.pos = t),
  44. (this.moveTime = i),
  45. o
  46. ? ((this.numLab.node.active = !0), (this.numLab.string = n.default.toString(o)))
  47. : (this.numLab.node.active = !1),
  48. this.moneyAni.play("work");
  49. }
  50. onMoneyAniFinish() {
  51. cc.tween(this.node)
  52. .delay(0.5)
  53. .call(() => {
  54. this.numLab.node.active = !1;
  55. })
  56. .to(this.moveTime, {position: this.pos, scale: 0.2})
  57. .call(() => {
  58. (this.node.scale = 1),
  59. (this.moneyAni.node.active = !1),
  60. (this.lightAni.node.active = !0),
  61. this.lightAni.play("work");
  62. })
  63. .start();
  64. }
  65. onLightAniFinish() {
  66. (this.moneyAni.node.active = !1), this.callBack && this.callBack(), (this.callBack = null);
  67. }
  68. };
  69. e([l(cc.Animation)], t.prototype, "moneyAni", void 0),
  70. e([l(cc.Animation)], t.prototype, "lightAni", void 0),
  71. e([l(s.default)], t.prototype, "switchFrame", void 0),
  72. e([l(cc.Label)], t.prototype, "numLab", void 0),
  73. (t = e([o], t)),
  74. (i.MoneyAni = t);