Toast.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. var s,
  5. e =
  6. (this && this.__decorate) ||
  7. function (t, e, i, s) {
  8. var o,
  9. a = arguments.length,
  10. n = a < 3 ? e : null === s ? (s = Object.getOwnPropertyDescriptor(e, i)) : s;
  11. if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, i, s);
  12. else
  13. for (var r = t.length - 1; 0 <= r; r--)
  14. (o = t[r]) && (n = (a < 3 ? o(n) : 3 < a ? o(e, i, n) : o(e, i)) || n);
  15. return 3 < a && n && Object.defineProperty(e, i, n), n;
  16. };
  17. Object.defineProperty(i, "__esModule", {value: !0});
  18. t("LayerManager");
  19. const o = t("App"),
  20. {ccclass: a, property: n} = cc._decorator;
  21. t = s = class extends cc.Component {
  22. constructor() {
  23. super(...arguments), (this.bgSp = null), (this.msgLab = null), (this.msgList = []);
  24. }
  25. static launch(t, e = 1e3) {
  26. this.instance.launch(t, e);
  27. }
  28. onLoad() {
  29. (this.node.zIndex = 200), ((s.instance = this).node.active = !1), this.node.removeFromParent(!1);
  30. }
  31. launch(t, e = 1e3) {
  32. this.showMsg({msg: t, waitTime: e});
  33. }
  34. checkMsg(e) {
  35. if (!this.curMsg || this.curMsg.msg != e.msg) {
  36. var i = this.msgList.length;
  37. for (let t = 0; t < i; t++) {
  38. var s = this.msgList[t].msg;
  39. if (e.msg === s) return;
  40. }
  41. this.msgList.push(e);
  42. }
  43. }
  44. showMsg(t) {
  45. this.isShow && this.node.removeFromParent(!0),
  46. t &&
  47. ((this.isShow = !0),
  48. (this.msgLab.string = t.msg),
  49. this.node.parent || o.default.ViewManager.uiRoot.addChild(this.node),
  50. (this.node.active = !0),
  51. (this.node.opacity = 0),
  52. (this.tw = cc
  53. .tween(this.node)
  54. .to(0.7, {opacity: 255}, {easing: cc.easing.quadOut})
  55. .delay(t.waitTime / 1e3)
  56. .to(0.8, {opacity: 0}, {easing: cc.easing.circIn})
  57. .call(() => {
  58. (this.node.active = !1), (this.isShow = !1), this.node.removeFromParent(!0);
  59. })
  60. .start()));
  61. }
  62. };
  63. e([n(cc.Sprite)], t.prototype, "bgSp", void 0),
  64. e([n(cc.Label)], t.prototype, "msgLab", void 0),
  65. (t = s = e([a], t)),
  66. (i.default = t = s);