12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- 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("GameText"),
- a = t("LocalizedLabel"),
- { ccclass: n, property: r, menu: l, executeInEditMode: h } = cc._decorator;
- t = class extends a.default {
- constructor() {
- super(...arguments), (this.timeBaseStr = ""), (this._time = -1), (this.isBref = !1);
- }
- onLoad() {
- super.onLoad();
- }
- setEndTime(t) {
- this._time = t;
- }
- updateLabel() {
- var t;
- this.label ?
- this.dataID ?
- ((t = o.GameText.getTextByStr(this.dataID)), (this.timeBaseStr = t || "{0}")) :
- (this.timeBaseStr = "{0}") :
- cc.error("Failed to update localized label, label component is invalid!");
- }
- startCount() {
- s.default.TimerManager.doTimer(1e3, 0, this.routine, this), this.routine();
- }
- stopCount() {
- s.default.TimerManager.remove(this.routine, this);
- }
- onDestroy() {
- s.default.TimerManager.remove(this.routine, this);
- }
- routine() {
- let t = this._time - s.default.DateUtils.Now();
- t < 0 ?
- ((t = 0), s.default.TimerManager.remove(this.routine, this), (this.label.string = "00:00:00")) :
- (this.label.string = this.timeBaseStr.format(s.default.CommonUtils.getFormatTime(t, this.isBref)));
- }
- };
- e([r()], t.prototype, "isBref", void 0), (t = e([n, h], t)), (i.default = t);
|