@galacean/effects 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -7
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +38 -7
- package/dist/index.mjs.map +1 -1
- package/dist/weapp.js +37 -6
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +37 -6
- package/dist/weapp.mjs.map +1 -1
- package/package.json +3 -3
package/dist/weapp.js
CHANGED
|
@@ -23448,6 +23448,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
23448
23448
|
*/
|
|
23449
23449
|
this.assets = {};
|
|
23450
23450
|
this.id = seed$5++;
|
|
23451
|
+
/**
|
|
23452
|
+
* 场景加载的超时定时器
|
|
23453
|
+
*/
|
|
23454
|
+
this.timers = [];
|
|
23451
23455
|
this.updateOptions(options);
|
|
23452
23456
|
}
|
|
23453
23457
|
AssetManager.prototype.updateOptions = function (options) {
|
|
@@ -23480,25 +23484,33 @@ var AssetManager = /** @class */ (function () {
|
|
|
23480
23484
|
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
23481
23485
|
cancelLoading = false;
|
|
23482
23486
|
waitPromise = new Promise(function (resolve, reject) {
|
|
23483
|
-
|
|
23487
|
+
loadTimer = weapp.window.setTimeout(function () {
|
|
23484
23488
|
cancelLoading = true;
|
|
23489
|
+
_this.removeTimer(loadTimer);
|
|
23485
23490
|
var totalTime = weapp.performance.now() - startTime;
|
|
23486
23491
|
reject("Load time out: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23487
23492
|
}, _this.timeout * 1000);
|
|
23493
|
+
_this.timers.push(loadTimer);
|
|
23488
23494
|
});
|
|
23489
23495
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
23490
|
-
var st, result;
|
|
23496
|
+
var st, result, e_1;
|
|
23491
23497
|
return __generator(this, function (_a) {
|
|
23492
23498
|
switch (_a.label) {
|
|
23493
23499
|
case 0:
|
|
23494
|
-
if (!!cancelLoading) return [3 /*break*/,
|
|
23500
|
+
if (!!cancelLoading) return [3 /*break*/, 4];
|
|
23495
23501
|
st = weapp.performance.now();
|
|
23496
|
-
|
|
23502
|
+
_a.label = 1;
|
|
23497
23503
|
case 1:
|
|
23504
|
+
_a.trys.push([1, 3, , 4]);
|
|
23505
|
+
return [4 /*yield*/, func()];
|
|
23506
|
+
case 2:
|
|
23498
23507
|
result = _a.sent();
|
|
23499
23508
|
timeInfos.push("[".concat(label, ": ").concat((weapp.performance.now() - st).toFixed(2), "]"));
|
|
23500
23509
|
return [2 /*return*/, result];
|
|
23501
|
-
case
|
|
23510
|
+
case 3:
|
|
23511
|
+
e_1 = _a.sent();
|
|
23512
|
+
throw new Error("load error in ".concat(label, ", ").concat(e_1));
|
|
23513
|
+
case 4: throw new Error('load canceled.');
|
|
23502
23514
|
}
|
|
23503
23515
|
});
|
|
23504
23516
|
}); };
|
|
@@ -23582,6 +23594,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23582
23594
|
totalTime = weapp.performance.now() - startTime;
|
|
23583
23595
|
logger.info("Load asset: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23584
23596
|
weapp.window.clearTimeout(loadTimer);
|
|
23597
|
+
this.removeTimer(loadTimer);
|
|
23585
23598
|
scene.totalTime = totalTime;
|
|
23586
23599
|
scene.startTime = startTime;
|
|
23587
23600
|
return [2 /*return*/, scene];
|
|
@@ -23890,16 +23903,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23890
23903
|
});
|
|
23891
23904
|
});
|
|
23892
23905
|
};
|
|
23906
|
+
AssetManager.prototype.removeTimer = function (id) {
|
|
23907
|
+
var index = this.timers.indexOf(id);
|
|
23908
|
+
if (index !== -1) {
|
|
23909
|
+
this.timers.splice(index, 1);
|
|
23910
|
+
}
|
|
23911
|
+
};
|
|
23893
23912
|
/**
|
|
23894
23913
|
* 销毁方法
|
|
23895
23914
|
*/
|
|
23896
23915
|
AssetManager.prototype.dispose = function () {
|
|
23897
23916
|
var _a;
|
|
23917
|
+
if (this.timers.length) {
|
|
23918
|
+
this.timers.map(function (id) { return weapp.window.clearTimeout(id); });
|
|
23919
|
+
}
|
|
23898
23920
|
for (var key in this.assets) {
|
|
23899
23921
|
var asset = this.assets[key];
|
|
23900
23922
|
(_a = asset === null || asset === void 0 ? void 0 : asset.dispose) === null || _a === void 0 ? void 0 : _a.call(asset);
|
|
23901
23923
|
}
|
|
23902
23924
|
this.assets = {};
|
|
23925
|
+
this.timers = [];
|
|
23903
23926
|
};
|
|
23904
23927
|
/**
|
|
23905
23928
|
* 自定义文本缓存,随页面销毁而销毁
|
|
@@ -29853,6 +29876,10 @@ var Player = /** @class */ (function () {
|
|
|
29853
29876
|
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29854
29877
|
case 1:
|
|
29855
29878
|
scene = _a.sent();
|
|
29879
|
+
// 加载期间 player 销毁
|
|
29880
|
+
if (this.disposed) {
|
|
29881
|
+
throw new Error('Disposed player can not used to create Composition');
|
|
29882
|
+
}
|
|
29856
29883
|
composition = new Composition(__assign$1(__assign$1({}, opts), { renderer: renderer, width: renderer.getWidth(), height: renderer.getHeight(), event: this.event, onPlayerPause: this.handlePlayerPause, onMessageItem: this.handleMessageItem }), scene);
|
|
29857
29884
|
if (this.ticker) {
|
|
29858
29885
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -30211,6 +30238,10 @@ var Player = /** @class */ (function () {
|
|
|
30211
30238
|
this.resize = throwErrorFunc;
|
|
30212
30239
|
this.loadScene = throwErrorPromiseFunc;
|
|
30213
30240
|
this.play = throwErrorPromiseFunc;
|
|
30241
|
+
this.gotoAndPlay = throwErrorPromiseFunc;
|
|
30242
|
+
this.gotoAndStop = throwErrorPromiseFunc;
|
|
30243
|
+
this.playSequence = throwErrorFunc;
|
|
30244
|
+
this.destroyCurrentCompositions = throwErrorFunc;
|
|
30214
30245
|
this.resume = throwErrorPromiseFunc;
|
|
30215
30246
|
this.disposed = true;
|
|
30216
30247
|
};
|
|
@@ -30386,7 +30417,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30386
30417
|
Engine.create = function (gl) {
|
|
30387
30418
|
return new GLEngine(gl);
|
|
30388
30419
|
};
|
|
30389
|
-
var version = "1.2.
|
|
30420
|
+
var version = "1.2.1";
|
|
30390
30421
|
logger.info('player version: ' + version);
|
|
30391
30422
|
|
|
30392
30423
|
exports.AbstractPlugin = AbstractPlugin;
|