Files
Alien_Sniper/temp/programming/packer-driver/targets/preview/chunks/af/aff6617cbbb7a53a4de9a5219456dcc3e0d312e5.js
T
2026-07-14 11:44:07 +08:00

134 lines
5.5 KiB
JavaScript

System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2"], function (_export, _context) {
"use strict";
var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Sprite, UIManager, PanelBase, _dec, _dec2, _class, _class2, _descriptor, _descriptor2, _class3, _crd, ccclass, property, LoadingPanel;
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
function _reportPossibleCrUseOfUIManager(extras) {
_reporterNs.report("UIManager", "../framework/ui/UIManager", _context.meta, extras);
}
function _reportPossibleCrUseOfPanelBase(extras) {
_reporterNs.report("PanelBase", "../framework/ui/PanelBase", _context.meta, extras);
}
return {
setters: [function (_unresolved_) {
_reporterNs = _unresolved_;
}, function (_cc) {
_cclegacy = _cc.cclegacy;
__checkObsolete__ = _cc.__checkObsolete__;
__checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
_decorator = _cc._decorator;
Sprite = _cc.Sprite;
}, function (_unresolved_2) {
UIManager = _unresolved_2.UIManager;
}, function (_unresolved_3) {
PanelBase = _unresolved_3.PanelBase;
}],
execute: function () {
_crd = true;
_cclegacy._RF.push({}, "f4b84y056JFgq0b0ZnqXOvk", "LoadingPanel", undefined);
__checkObsolete__(['_decorator', 'Button', 'Component', 'Label', 'Node', 'Sprite', 'Tween', 'tween', 'Vec3']);
({
ccclass,
property
} = _decorator);
_export("LoadingPanel", LoadingPanel = (_dec = ccclass('LoadingPanel'), _dec2 = property({
type: Sprite
}), _dec(_class = (_class2 = (_class3 = class LoadingPanel extends (_crd && PanelBase === void 0 ? (_reportPossibleCrUseOfPanelBase({
error: Error()
}), PanelBase) : PanelBase) {
constructor() {
super(...arguments);
_initializerDefineProperty(this, "loadingSprite", _descriptor, this);
_initializerDefineProperty(this, "fillDuration", _descriptor2, this);
// 填充持续时间,单位为秒
this.fillAmount = 0;
this.loadingComplete = false;
this.completeCallback = null;
}
// 当前填充量
startFill() {
this.schedule(this.updateFill, 0.01); // 每0.01秒更新一次填充量
}
onOpen() {
LoadingPanel.instance.startFill();
}
onLoadingComplete(callBack) {
this.completeCallback = callBack;
this.loadingComplete = true;
if (this.fillAmount < 1) {
this.fillDuration = 1;
} else {
(_crd && UIManager === void 0 ? (_reportPossibleCrUseOfUIManager({
error: Error()
}), UIManager) : UIManager).instance.closePanel(LoadingPanel);
callBack();
}
}
onDestroy() {
this.unschedule(this.updateFill);
}
updateFill() {
if (this.fillAmount < 1) {
this.fillAmount += 0.01 / this.fillDuration; // 根据持续时间逐步增加填充量
this.loadingSprite.fillRange = this.fillAmount; // 更新 Sprite 的填充量
} else {
this.unschedule(this.updateFill); // 填充完成后停止更新
if (this.loadingComplete) {
(_crd && UIManager === void 0 ? (_reportPossibleCrUseOfUIManager({
error: Error()
}), UIManager) : UIManager).instance.closePanel(LoadingPanel);
this.completeCallback();
}
}
}
onLoad() {
LoadingPanel.instance = this;
}
}, _class3.instance = void 0, _class3), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "loadingSprite", [_dec2], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer() {
return null;
}
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "fillDuration", [property], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer() {
return 5;
}
})), _class2)) || _class));
_cclegacy._RF.pop();
_crd = false;
}
};
});
//# sourceMappingURL=aff6617cbbb7a53a4de9a5219456dcc3e0d312e5.js.map