GameTipsLab.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. {ccclass: a, property: n} = cc._decorator;
  20. let r = [],
  21. l = class extends cc.Component {
  22. constructor() {
  23. super(...arguments), (this.lab = null), (this.nextTipTime = 0), (this.index = 0);
  24. }
  25. onLoad() {
  26. if (!r.length) {
  27. let t = 1;
  28. for (;;) {
  29. var e = "game_help_tip_" + t++,
  30. i = o.GameText.getTextByStr(e);
  31. if (i == e) break;
  32. r.push(i);
  33. }
  34. s.default.RandomUtils.shuffle(r);
  35. }
  36. this.showNextLab();
  37. }
  38. showNextLab() {
  39. (this.lab.string = r[this.index]), this.index++, this.index == r.length && (this.index = 0);
  40. }
  41. update(t) {
  42. 5 < this.nextTipTime ? ((this.nextTipTime = 0), this.showNextLab()) : (this.nextTipTime += t);
  43. }
  44. };
  45. e([n(cc.Label)], l.prototype, "lab", void 0), (l = e([a], l)), (i.default = l);