12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- var t = require;
- var e = module;
- var i = exports;
- e =
- (this && this.__decorate) ||
- function (t, e, i, s) {
- var o,
- a = arguments.length,
- n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
- if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
- else
- for (var r = t.length - 1; 0 <= r; r--)
- (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
- return 3 < a && n && Object.defineProperty(e, i, n), n;
- };
- Object.defineProperty(i, "__esModule", {value: !0});
- const s = t("App"),
- o = t("LayerManager"),
- {ccclass: a, property: n} = cc._decorator;
- t = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.targetNode = null),
- (this.isPlayAni = !1),
- (this.pool = null),
- (this.ani = null),
- (this.padding = null),
- (this.nextTick = 0);
- }
- onLoad() {}
- find(t, e) {
- this.isPlayAni && this.ani.stop(), (this.padding = e);
- e = cc.director.getScene();
- Locator.locateNode(e, t, (t, e) => {
- t ? cc.log(t) : ((this.targetNode = e), s.default.TimerManager.setTimeOut(500, this.playAni, this));
- });
- }
- playAni() {
- let t = o.default.getLayer(100);
- this.node.parent || t.addChild(this.node);
- let e = this.targetNode.convertToWorldSpaceAR(cc.v2(0, 0));
- this.padding && e.addSelf(this.padding),
- (this.node.position = this.node.parent.convertToNodeSpaceAR(e)),
- this.ani.play(),
- (this.isPlayAni = !0);
- }
- update(t) {
- if (((this.nextTick -= t), this.nextTick <= 0)) {
- this.nextTick = 0.2;
- let t = this.targetNode.convertToWorldSpaceAR(cc.v2(0, 0));
- this.padding && t.addSelf(this.padding), (this.node.position = this.node.parent.convertToNodeSpaceAR(t));
- }
- }
- playOver() {
- (this.isPlayAni = !1), this.pool ? this.pool.push2(this.node, 3) : this.node.parent.removeChild(this.node, !1);
- }
- };
- e([n(cc.Animation)], t.prototype, "ani", void 0), (t = e([a], t)), (i.default = t);
|