123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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}), (i.EasyLoading = void 0);
- const o = t("App"),
- {ccclass: s, property: a} = cc._decorator;
- t = class extends cc.Component {
- constructor() {
- super(...arguments),
- (this.tween = null),
- (this.loadReel = null),
- (this.bg = null),
- (this.touchNode = null),
- (this.count = 0);
- }
- onLoad() {
- (this.tween = cc.tween(this.loadReel).by(2, {angle: 360}).repeatForever()),
- (this.node.active = !1),
- cc.game.addPersistRootNode(this.node),
- ((o.default.EasyLoading = this).count = 0);
- }
- init() {}
- showLoading(t = !0) {
- this.count++,
- (this.node.active = !0),
- t
- ? (this.tween.start(), (this.loadReel.active = !0), (this.bg.enabled = !0))
- : ((this.loadReel.active = !1), (this.bg.enabled = !1));
- }
- showLoadingByTime(t = 0, e, i, s = !0) {
- this.showLoading(s),
- o.default.TimerManager.doTimer(1e3, t, this.loadingByTimeUpdate, this, () => {
- e && e.apply(i), this.hideLoadingByTime();
- });
- }
- hideLoading() {
- this.count--,
- this.count <= 0 &&
- ((this.count = 0),
- this.loadReel.stopAllActions(),
- (this.node.active = !1),
- o.default.TimerManager.remove(this.loadingByTimeUpdate, this));
- }
- hideLoadingByTime() {
- this.hideLoading();
- }
- loadingByTimeUpdate() {}
- showLoadingTouchEnd(t) {
- t &&
- (this.count++,
- (this.node.active = !0),
- (this.loadReel.active = !1),
- (this.bg.enabled = !1),
- (this.callBack = t),
- this.touchNode.on(cc.Node.EventType.TOUCH_START, this.callBack, this));
- }
- hideLoadingTouchEnd() {
- this.count--,
- this.count <= 0 &&
- ((this.count = 0),
- this.loadReel.stopAllActions(),
- (this.node.active = !1),
- o.default.TimerManager.remove(this.loadingByTimeUpdate, this)),
- this.callBack &&
- (this.touchNode.off(cc.Node.EventType.TOUCH_START, this.callBack, this), (this.callBack = null));
- }
- };
- e([a(cc.Node)], t.prototype, "loadReel", void 0),
- e([a(cc.Sprite)], t.prototype, "bg", void 0),
- e([a(cc.Node)], t.prototype, "touchNode", void 0),
- (t = e([s], t)),
- (i.EasyLoading = t);
|