@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/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.2.
|
|
6
|
+
* Version: v1.2.1
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -23454,6 +23454,10 @@ var AssetManager = /** @class */ (function () {
|
|
|
23454
23454
|
*/
|
|
23455
23455
|
this.assets = {};
|
|
23456
23456
|
this.id = seed$5++;
|
|
23457
|
+
/**
|
|
23458
|
+
* 场景加载的超时定时器
|
|
23459
|
+
*/
|
|
23460
|
+
this.timers = [];
|
|
23457
23461
|
this.updateOptions(options);
|
|
23458
23462
|
}
|
|
23459
23463
|
AssetManager.prototype.updateOptions = function (options) {
|
|
@@ -23486,25 +23490,33 @@ var AssetManager = /** @class */ (function () {
|
|
|
23486
23490
|
compressedTexture = (_c = gpuInstance === null || gpuInstance === void 0 ? void 0 : gpuInstance.detail.compressedTexture) !== null && _c !== void 0 ? _c : 0;
|
|
23487
23491
|
cancelLoading = false;
|
|
23488
23492
|
waitPromise = new Promise(function (resolve, reject) {
|
|
23489
|
-
|
|
23493
|
+
loadTimer = window.setTimeout(function () {
|
|
23490
23494
|
cancelLoading = true;
|
|
23495
|
+
_this.removeTimer(loadTimer);
|
|
23491
23496
|
var totalTime = performance.now() - startTime;
|
|
23492
23497
|
reject("Load time out: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23493
23498
|
}, _this.timeout * 1000);
|
|
23499
|
+
_this.timers.push(loadTimer);
|
|
23494
23500
|
});
|
|
23495
23501
|
hookTimeInfo = function (label, func) { return __awaiter(_this, void 0, void 0, function () {
|
|
23496
|
-
var st, result;
|
|
23502
|
+
var st, result, e_1;
|
|
23497
23503
|
return __generator(this, function (_a) {
|
|
23498
23504
|
switch (_a.label) {
|
|
23499
23505
|
case 0:
|
|
23500
|
-
if (!!cancelLoading) return [3 /*break*/,
|
|
23506
|
+
if (!!cancelLoading) return [3 /*break*/, 4];
|
|
23501
23507
|
st = performance.now();
|
|
23502
|
-
|
|
23508
|
+
_a.label = 1;
|
|
23503
23509
|
case 1:
|
|
23510
|
+
_a.trys.push([1, 3, , 4]);
|
|
23511
|
+
return [4 /*yield*/, func()];
|
|
23512
|
+
case 2:
|
|
23504
23513
|
result = _a.sent();
|
|
23505
23514
|
timeInfos.push("[".concat(label, ": ").concat((performance.now() - st).toFixed(2), "]"));
|
|
23506
23515
|
return [2 /*return*/, result];
|
|
23507
|
-
case
|
|
23516
|
+
case 3:
|
|
23517
|
+
e_1 = _a.sent();
|
|
23518
|
+
throw new Error("load error in ".concat(label, ", ").concat(e_1));
|
|
23519
|
+
case 4: throw new Error('load canceled.');
|
|
23508
23520
|
}
|
|
23509
23521
|
});
|
|
23510
23522
|
}); };
|
|
@@ -23588,6 +23600,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
23588
23600
|
totalTime = performance.now() - startTime;
|
|
23589
23601
|
logger.info("Load asset: totalTime: ".concat(totalTime.toFixed(4), "ms ").concat(timeInfos.join(' '), ", url: ").concat(assetUrl));
|
|
23590
23602
|
window.clearTimeout(loadTimer);
|
|
23603
|
+
this.removeTimer(loadTimer);
|
|
23591
23604
|
scene.totalTime = totalTime;
|
|
23592
23605
|
scene.startTime = startTime;
|
|
23593
23606
|
return [2 /*return*/, scene];
|
|
@@ -23896,16 +23909,26 @@ var AssetManager = /** @class */ (function () {
|
|
|
23896
23909
|
});
|
|
23897
23910
|
});
|
|
23898
23911
|
};
|
|
23912
|
+
AssetManager.prototype.removeTimer = function (id) {
|
|
23913
|
+
var index = this.timers.indexOf(id);
|
|
23914
|
+
if (index !== -1) {
|
|
23915
|
+
this.timers.splice(index, 1);
|
|
23916
|
+
}
|
|
23917
|
+
};
|
|
23899
23918
|
/**
|
|
23900
23919
|
* 销毁方法
|
|
23901
23920
|
*/
|
|
23902
23921
|
AssetManager.prototype.dispose = function () {
|
|
23903
23922
|
var _a;
|
|
23923
|
+
if (this.timers.length) {
|
|
23924
|
+
this.timers.map(function (id) { return window.clearTimeout(id); });
|
|
23925
|
+
}
|
|
23904
23926
|
for (var key in this.assets) {
|
|
23905
23927
|
var asset = this.assets[key];
|
|
23906
23928
|
(_a = asset === null || asset === void 0 ? void 0 : asset.dispose) === null || _a === void 0 ? void 0 : _a.call(asset);
|
|
23907
23929
|
}
|
|
23908
23930
|
this.assets = {};
|
|
23931
|
+
this.timers = [];
|
|
23909
23932
|
};
|
|
23910
23933
|
/**
|
|
23911
23934
|
* 自定义文本缓存,随页面销毁而销毁
|
|
@@ -29859,6 +29882,10 @@ var Player = /** @class */ (function () {
|
|
|
29859
29882
|
return [4 /*yield*/, this.assetManager.loadScene(source, this.renderer, { env: this.env })];
|
|
29860
29883
|
case 1:
|
|
29861
29884
|
scene = _a.sent();
|
|
29885
|
+
// 加载期间 player 销毁
|
|
29886
|
+
if (this.disposed) {
|
|
29887
|
+
throw new Error('Disposed player can not used to create Composition');
|
|
29888
|
+
}
|
|
29862
29889
|
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);
|
|
29863
29890
|
if (this.ticker) {
|
|
29864
29891
|
if (composition.renderLevel === RenderLevel$1.B) {
|
|
@@ -30217,6 +30244,10 @@ var Player = /** @class */ (function () {
|
|
|
30217
30244
|
this.resize = throwErrorFunc;
|
|
30218
30245
|
this.loadScene = throwErrorPromiseFunc;
|
|
30219
30246
|
this.play = throwErrorPromiseFunc;
|
|
30247
|
+
this.gotoAndPlay = throwErrorPromiseFunc;
|
|
30248
|
+
this.gotoAndStop = throwErrorPromiseFunc;
|
|
30249
|
+
this.playSequence = throwErrorFunc;
|
|
30250
|
+
this.destroyCurrentCompositions = throwErrorFunc;
|
|
30220
30251
|
this.resume = throwErrorPromiseFunc;
|
|
30221
30252
|
this.disposed = true;
|
|
30222
30253
|
};
|
|
@@ -30392,7 +30423,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
30392
30423
|
Engine.create = function (gl) {
|
|
30393
30424
|
return new GLEngine(gl);
|
|
30394
30425
|
};
|
|
30395
|
-
var version = "1.2.
|
|
30426
|
+
var version = "1.2.1";
|
|
30396
30427
|
logger.info('player version: ' + version);
|
|
30397
30428
|
|
|
30398
30429
|
exports.AbstractPlugin = AbstractPlugin;
|