RoleUnlockAni.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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("SoundEffectConst"),
  19. {ccclass: a} = cc._decorator;
  20. e = e(
  21. [a],
  22. (e = class extends cc.Component {
  23. constructor() {
  24. super(...arguments), (this.ani = null), (this.cb = null), (this.target = null);
  25. }
  26. onLoad() {
  27. (this.ani = this.getComponent(cc.Animation)),
  28. this.ani.on(cc.Animation.EventType.FINISHED, this.onAniPlayFinish, this);
  29. }
  30. init(t, e) {
  31. (this.cb = t),
  32. (this.target = e),
  33. this.ani.setCurrentTime(0, "work"),
  34. this.ani.play("idle"),
  35. this.node.once(cc.Node.EventType.TOUCH_END, this.onTouchTap, this);
  36. }
  37. onTouchTap() {
  38. s.default.SoundManager.playEffect(o.SoundsDefine.UNLOCK), this.ani.play("work");
  39. }
  40. onAniPlayFinish() {
  41. this.cb.call(this.target), (this.cb = this.target = null), this.node.destroy();
  42. }
  43. })
  44. );
  45. i.default = e;