HandGuide.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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("LayerManager"),
  19. {ccclass: a, property: n} = cc._decorator;
  20. t = class extends cc.Component {
  21. constructor() {
  22. super(...arguments),
  23. (this.targetNode = null),
  24. (this.isPlayAni = !1),
  25. (this.pool = null),
  26. (this.ani = null),
  27. (this.padding = null),
  28. (this.nextTick = 0);
  29. }
  30. onLoad() {}
  31. find(t, e) {
  32. this.isPlayAni && this.ani.stop(), (this.padding = e);
  33. e = cc.director.getScene();
  34. Locator.locateNode(e, t, (t, e) => {
  35. t ? cc.log(t) : ((this.targetNode = e), s.default.TimerManager.setTimeOut(500, this.playAni, this));
  36. });
  37. }
  38. playAni() {
  39. let t = o.default.getLayer(100);
  40. this.node.parent || t.addChild(this.node);
  41. let e = this.targetNode.convertToWorldSpaceAR(cc.v2(0, 0));
  42. this.padding && e.addSelf(this.padding),
  43. (this.node.position = this.node.parent.convertToNodeSpaceAR(e)),
  44. this.ani.play(),
  45. (this.isPlayAni = !0);
  46. }
  47. update(t) {
  48. if (((this.nextTick -= t), this.nextTick <= 0)) {
  49. this.nextTick = 0.2;
  50. let t = this.targetNode.convertToWorldSpaceAR(cc.v2(0, 0));
  51. this.padding && t.addSelf(this.padding), (this.node.position = this.node.parent.convertToNodeSpaceAR(t));
  52. }
  53. }
  54. playOver() {
  55. (this.isPlayAni = !1), this.pool ? this.pool.push2(this.node, 3) : this.node.parent.removeChild(this.node, !1);
  56. }
  57. };
  58. e([n(cc.Animation)], t.prototype, "ani", void 0), (t = e([a], t)), (i.default = t);