RoleSpeakComponent.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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.RoleSpeakComponent = void 0);
  17. const s = t("App"),
  18. o = t("RoleService"),
  19. {ccclass: a, property: n} = cc._decorator;
  20. t = class extends cc.Component {
  21. constructor() {
  22. super(...arguments), (this.langLab = null), (this.followNode = null), (this.talkTime = 3);
  23. }
  24. init(t, e) {
  25. (this.followNode = t),
  26. (this.langLab.string = e),
  27. (this.talkTime = 3),
  28. this.followNode
  29. ? ((this.node.x = this.followNode.x), (this.node.y = this.followNode.y + this.followNode.height + 30))
  30. : (o.default.ins.talkingFinish(),
  31. s.default.NodePoolMsr.roleLangPool.push(this.node),
  32. (this.followNode = null));
  33. }
  34. update(t) {
  35. (this.talkTime -= t),
  36. this.talkTime < 0 || !this.followNode || !this.followNode.active
  37. ? s.default.NodePoolMsr.roleLangPool.push(this.node)
  38. : ((this.node.x = this.followNode.x), (this.node.y = this.followNode.y + this.followNode.height + 30));
  39. }
  40. onDisable() {
  41. o.default.ins.talkingFinish(), (this.followNode = null);
  42. }
  43. };
  44. e([n(cc.Label)], t.prototype, "langLab", void 0), (t = e([a], t)), (i.RoleSpeakComponent = t);