OpenSysAni.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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("GameText"),
  19. a = t("EffectUtils"),
  20. n = t("UIImage"),
  21. r = t("NotificationConst"),
  22. l = t("SystemOpenConst"),
  23. {ccclass: h, property: c} = cc._decorator;
  24. t = class extends cc.Component {
  25. constructor() {
  26. super(...arguments),
  27. (this.ani = null),
  28. (this.icon = null),
  29. (this.desc = null),
  30. (this.boxAni = null),
  31. (this.isPlaying = !1),
  32. (this.isMove = !1),
  33. (this.isMoveFinish = !1),
  34. (this.tw = null),
  35. (this.endPosList = []),
  36. (this.NowItemType = null);
  37. }
  38. onLoad() {
  39. (this.icon.node.x = 0),
  40. (this.icon.node.y = 0),
  41. (this.icon.node.scaleX = this.icon.node.scaleY = 1),
  42. (this.boxAni = this.ani.getComponent(cc.Animation)),
  43. this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchTap, this),
  44. this.boxAni.on(cc.Animation.EventType.FINISHED, this.onAnimCompleted, this);
  45. }
  46. onAnimCompleted() {
  47. this.isPlaying && ((this.isPlaying = !1), this.playMoveIcon());
  48. }
  49. onTouchTap() {
  50. this.isPlaying ||
  51. (this.isMove || this.isMoveFinish
  52. ? this.isMove && !this.isMoveFinish
  53. ? (this.tw && (this.tw.stop(), this.tw.removeSelf(), (this.tw = null)),
  54. (this.icon.node.x = this.data.pos.x),
  55. (this.icon.node.y = this.data.pos.y),
  56. this.moveCb())
  57. : this.close()
  58. : (s.default.TimerManager.remove(this.playMoveIcon, this), this.playMoveIcon()));
  59. }
  60. close() {
  61. this.tw && (this.tw.stop(), this.tw.removeSelf(), (this.tw = null)),
  62. this.node.parent && this.node.removeFromParent(!1),
  63. (this.isMoveFinish = !1),
  64. (this.isMove = !1),
  65. (this.isPlaying = !1),
  66. (this.data = null),
  67. (this.desc.string = ""),
  68. (this.icon.node.x = 0),
  69. (this.icon.node.y = 0),
  70. (this.icon.node.scaleX = this.icon.node.scaleY = 1),
  71. a.default.instance.queueExecutor.finishFunc();
  72. }
  73. playMoveIcon() {
  74. (this.isMove = !0),
  75. (this.tw = cc
  76. .tween(this.icon.node)
  77. .to(1, {x: this.data.pos.x, y: this.data.pos.y, scaleX: 0.2, scaleY: 0.2}, {easing: cc.easing.quadIn})
  78. .call(() => {
  79. this.moveCb();
  80. })
  81. .start());
  82. }
  83. moveCb() {
  84. (this.isMove = !1),
  85. (this.isMoveFinish = !0),
  86. this.data.func && this.data.func.apply(this.data.obj),
  87. this.data.event && s.default.NotificationCenter.dispatch(this.data.event, this.data.param),
  88. s.default.NotificationCenter.dispatch(r.NotificationConst.SYS_OPEN_END, l.OpenTypeConst[this.data.id]),
  89. this.close();
  90. }
  91. play(t) {
  92. (this.data = t),
  93. (this.icon.source = t.icon),
  94. (this.desc.string = o.GameText.getTextByStr("system_title_" + t.id)),
  95. this.boxAni.play("work"),
  96. (this.isPlaying = !0);
  97. }
  98. };
  99. e([c(cc.Node)], t.prototype, "ani", void 0),
  100. e([c(n.UIImage)], t.prototype, "icon", void 0),
  101. e([c(cc.Label)], t.prototype, "desc", void 0),
  102. (t = e([h], t)),
  103. (i.default = t);