@galacean/effects-plugin-stats 2.1.5 → 2.2.0
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/core.d.ts +1 -1
- package/dist/hooks/drawcall-hook.d.ts +2 -1
- package/dist/hooks/program-hook.d.ts +2 -1
- package/dist/hooks/shader-hook.d.ts +2 -1
- package/dist/hooks/texture-hook.d.ts +2 -1
- package/dist/index.js +105 -51
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +105 -51
- package/dist/index.mjs.map +1 -1
- package/dist/monitor.d.ts +5 -1
- package/dist/stats-component.d.ts +2 -1
- package/dist/stats.d.ts +23 -4
- package/package.json +2 -2
package/dist/core.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare class Core {
|
|
|
16
16
|
private updateCounter;
|
|
17
17
|
private updateTime;
|
|
18
18
|
private programHook;
|
|
19
|
-
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
19
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug?: boolean);
|
|
20
20
|
private hook;
|
|
21
21
|
/**
|
|
22
22
|
* reset draw call hook
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default class DrawCallHook {
|
|
5
5
|
private readonly gl;
|
|
6
|
+
private readonly debug;
|
|
6
7
|
drawCall: number;
|
|
7
8
|
triangles: number;
|
|
8
9
|
lines: number;
|
|
@@ -10,7 +11,7 @@ export default class DrawCallHook {
|
|
|
10
11
|
private hooked;
|
|
11
12
|
private readonly realDrawElements;
|
|
12
13
|
private readonly realDrawArrays;
|
|
13
|
-
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
14
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
14
15
|
private hookedDrawElements;
|
|
15
16
|
private hookedDrawArrays;
|
|
16
17
|
private update;
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export default class ProgramHook {
|
|
6
6
|
private readonly gl;
|
|
7
|
+
private readonly debug;
|
|
7
8
|
programs: number;
|
|
8
9
|
private readonly realUseProgram;
|
|
9
10
|
private hooked;
|
|
10
|
-
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
11
12
|
private hookedUseProgram;
|
|
12
13
|
reset(): void;
|
|
13
14
|
release(): void;
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default class ShaderHook {
|
|
5
5
|
private readonly gl;
|
|
6
|
+
private readonly debug;
|
|
6
7
|
shaders: number;
|
|
7
8
|
private readonly realAttachShader;
|
|
8
9
|
private readonly realDetachShader;
|
|
9
10
|
private hooked;
|
|
10
|
-
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
11
12
|
private hookedAttachShader;
|
|
12
13
|
private hookedDetachShader;
|
|
13
14
|
reset(): void;
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export default class TextureHook {
|
|
5
5
|
private readonly gl;
|
|
6
|
+
private readonly debug;
|
|
6
7
|
textures: number;
|
|
7
8
|
private readonly realCreateTexture;
|
|
8
9
|
private readonly realDeleteTexture;
|
|
9
10
|
private hooked;
|
|
10
|
-
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext);
|
|
11
|
+
constructor(gl: WebGLRenderingContext | WebGL2RenderingContext, debug: boolean);
|
|
11
12
|
private hookedCreateTexture;
|
|
12
13
|
private hookedDeleteTexture;
|
|
13
14
|
reset(): void;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime stats for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 云垣
|
|
6
|
-
* Version: v2.
|
|
6
|
+
* Version: v2.2.0
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -59,6 +59,17 @@ function _async_to_generator(fn) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
function _extends() {
|
|
63
|
+
_extends = Object.assign || function assign(target) {
|
|
64
|
+
for(var i = 1; i < arguments.length; i++){
|
|
65
|
+
var source = arguments[i];
|
|
66
|
+
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
67
|
+
}
|
|
68
|
+
return target;
|
|
69
|
+
};
|
|
70
|
+
return _extends.apply(this, arguments);
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
function _instanceof1(left, right) {
|
|
63
74
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
64
75
|
return !!right[Symbol.hasInstance](left);
|
|
@@ -74,12 +85,8 @@ function __generator(thisArg, body) {
|
|
|
74
85
|
},
|
|
75
86
|
trys: [],
|
|
76
87
|
ops: []
|
|
77
|
-
}, f, y, t, g;
|
|
78
|
-
return g = {
|
|
79
|
-
next: verb(0),
|
|
80
|
-
"throw": verb(1),
|
|
81
|
-
"return": verb(2)
|
|
82
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
88
|
+
}, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
89
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
83
90
|
return this;
|
|
84
91
|
}), g;
|
|
85
92
|
function verb(n) {
|
|
@@ -187,9 +194,12 @@ function _inherits(subClass, superClass) {
|
|
|
187
194
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
188
195
|
}
|
|
189
196
|
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
/**
|
|
198
|
+
* DrawCallHook
|
|
199
|
+
*/ var DrawCallHook = /*#__PURE__*/ function() {
|
|
200
|
+
function DrawCallHook(gl, debug) {
|
|
192
201
|
this.gl = gl;
|
|
202
|
+
this.debug = debug;
|
|
193
203
|
this.drawCall = 0;
|
|
194
204
|
this.triangles = 0;
|
|
195
205
|
this.lines = 0;
|
|
@@ -199,7 +209,7 @@ var DrawCallHook = /*#__PURE__*/ function() {
|
|
|
199
209
|
this.realDrawArrays = gl.drawArrays;
|
|
200
210
|
gl.drawElements = this.hookedDrawElements.bind(this);
|
|
201
211
|
gl.drawArrays = this.hookedDrawArrays.bind(this);
|
|
202
|
-
if (
|
|
212
|
+
if (debug) {
|
|
203
213
|
console.debug("DrawCall is hooked.");
|
|
204
214
|
}
|
|
205
215
|
}
|
|
@@ -256,14 +266,18 @@ var DrawCallHook = /*#__PURE__*/ function() {
|
|
|
256
266
|
return DrawCallHook;
|
|
257
267
|
}();
|
|
258
268
|
|
|
259
|
-
|
|
260
|
-
|
|
269
|
+
/**
|
|
270
|
+
* ProgramHook
|
|
271
|
+
* 每一帧的 shader 数量
|
|
272
|
+
*/ var ProgramHook = /*#__PURE__*/ function() {
|
|
273
|
+
function ProgramHook(gl, debug) {
|
|
261
274
|
this.gl = gl;
|
|
275
|
+
this.debug = debug;
|
|
262
276
|
this.programs = 0;
|
|
263
277
|
this.hooked = true;
|
|
264
278
|
this.realUseProgram = gl.useProgram;
|
|
265
279
|
gl.useProgram = this.hookedUseProgram.bind(this);
|
|
266
|
-
if (
|
|
280
|
+
if (debug) {
|
|
267
281
|
console.debug("Program is hooked.");
|
|
268
282
|
}
|
|
269
283
|
}
|
|
@@ -271,7 +285,7 @@ var ProgramHook = /*#__PURE__*/ function() {
|
|
|
271
285
|
_proto.hookedUseProgram = function hookedUseProgram(program) {
|
|
272
286
|
this.realUseProgram.call(this.gl, program);
|
|
273
287
|
this.programs++;
|
|
274
|
-
if (
|
|
288
|
+
if (this.debug) {
|
|
275
289
|
console.debug("UseProgram: " + program + ", program: " + this.programs + ".");
|
|
276
290
|
}
|
|
277
291
|
};
|
|
@@ -287,16 +301,19 @@ var ProgramHook = /*#__PURE__*/ function() {
|
|
|
287
301
|
return ProgramHook;
|
|
288
302
|
}();
|
|
289
303
|
|
|
290
|
-
|
|
291
|
-
|
|
304
|
+
/**
|
|
305
|
+
* ShaderHook
|
|
306
|
+
*/ var ShaderHook = /*#__PURE__*/ function() {
|
|
307
|
+
function ShaderHook(gl, debug) {
|
|
292
308
|
this.gl = gl;
|
|
309
|
+
this.debug = debug;
|
|
293
310
|
this.shaders = 0;
|
|
294
311
|
this.hooked = true;
|
|
295
312
|
this.realAttachShader = gl.attachShader;
|
|
296
313
|
this.realDetachShader = gl.detachShader;
|
|
297
314
|
gl.attachShader = this.hookedAttachShader.bind(this);
|
|
298
315
|
gl.detachShader = this.hookedDetachShader.bind(this);
|
|
299
|
-
if (
|
|
316
|
+
if (debug) {
|
|
300
317
|
console.debug("Shader is hooked.");
|
|
301
318
|
}
|
|
302
319
|
}
|
|
@@ -304,14 +321,14 @@ var ShaderHook = /*#__PURE__*/ function() {
|
|
|
304
321
|
_proto.hookedAttachShader = function hookedAttachShader(program, shader) {
|
|
305
322
|
this.realAttachShader.call(this.gl, program, shader);
|
|
306
323
|
this.shaders++;
|
|
307
|
-
if (
|
|
324
|
+
if (this.debug) {
|
|
308
325
|
console.debug("AttachShader: " + shader + ". shaders: " + this.shaders);
|
|
309
326
|
}
|
|
310
327
|
};
|
|
311
328
|
_proto.hookedDetachShader = function hookedDetachShader(program, shader) {
|
|
312
329
|
this.realDetachShader.call(this.gl, program, shader);
|
|
313
330
|
this.shaders--;
|
|
314
|
-
if (
|
|
331
|
+
if (this.debug) {
|
|
315
332
|
console.debug("DetachShader. shaders: " + this.shaders);
|
|
316
333
|
}
|
|
317
334
|
};
|
|
@@ -328,16 +345,19 @@ var ShaderHook = /*#__PURE__*/ function() {
|
|
|
328
345
|
return ShaderHook;
|
|
329
346
|
}();
|
|
330
347
|
|
|
331
|
-
|
|
332
|
-
|
|
348
|
+
/**
|
|
349
|
+
* TextureHook
|
|
350
|
+
*/ var TextureHook = /*#__PURE__*/ function() {
|
|
351
|
+
function TextureHook(gl, debug) {
|
|
333
352
|
this.gl = gl;
|
|
353
|
+
this.debug = debug;
|
|
334
354
|
this.textures = 0;
|
|
335
355
|
this.hooked = true;
|
|
336
356
|
this.realCreateTexture = gl.createTexture;
|
|
337
357
|
this.realDeleteTexture = gl.deleteTexture;
|
|
338
358
|
gl.createTexture = this.hookedCreateTexture.bind(this);
|
|
339
359
|
gl.deleteTexture = this.hookedDeleteTexture.bind(this);
|
|
340
|
-
if (
|
|
360
|
+
if (debug) {
|
|
341
361
|
console.debug("Texture is hooked.");
|
|
342
362
|
}
|
|
343
363
|
}
|
|
@@ -345,7 +365,7 @@ var TextureHook = /*#__PURE__*/ function() {
|
|
|
345
365
|
_proto.hookedCreateTexture = function hookedCreateTexture() {
|
|
346
366
|
var texture = this.realCreateTexture.call(this.gl);
|
|
347
367
|
this.textures++;
|
|
348
|
-
if (
|
|
368
|
+
if (this.debug) {
|
|
349
369
|
console.debug("CreateTexture: " + texture + ", textures: " + this.textures + ".");
|
|
350
370
|
}
|
|
351
371
|
return texture;
|
|
@@ -353,7 +373,7 @@ var TextureHook = /*#__PURE__*/ function() {
|
|
|
353
373
|
_proto.hookedDeleteTexture = function hookedDeleteTexture(texture) {
|
|
354
374
|
this.realDeleteTexture.call(this.gl, texture);
|
|
355
375
|
this.textures--;
|
|
356
|
-
if (
|
|
376
|
+
if (this.debug) {
|
|
357
377
|
console.debug("DeleteTexture, textures: " + this.textures + ".");
|
|
358
378
|
}
|
|
359
379
|
};
|
|
@@ -373,7 +393,8 @@ var TextureHook = /*#__PURE__*/ function() {
|
|
|
373
393
|
/**
|
|
374
394
|
* Hook gl to calculate stats
|
|
375
395
|
*/ var Core = /*#__PURE__*/ function() {
|
|
376
|
-
function Core(gl) {
|
|
396
|
+
function Core(gl, debug) {
|
|
397
|
+
if (debug === void 0) debug = false;
|
|
377
398
|
this.gl = gl;
|
|
378
399
|
this.samplingFrames = 60;
|
|
379
400
|
this.samplingIndex = 0;
|
|
@@ -382,14 +403,14 @@ var TextureHook = /*#__PURE__*/ function() {
|
|
|
382
403
|
if (!gl) {
|
|
383
404
|
throw new Error("Unsupported WebGL context.");
|
|
384
405
|
}
|
|
385
|
-
this.hook(gl);
|
|
406
|
+
this.hook(gl, debug);
|
|
386
407
|
}
|
|
387
408
|
var _proto = Core.prototype;
|
|
388
|
-
_proto.hook = function hook(gl) {
|
|
389
|
-
this.drawCallHook = new DrawCallHook(gl);
|
|
390
|
-
this.textureHook = new TextureHook(gl);
|
|
391
|
-
this.shaderHook = new ShaderHook(gl);
|
|
392
|
-
this.programHook = new ProgramHook(gl);
|
|
409
|
+
_proto.hook = function hook(gl, debug) {
|
|
410
|
+
this.drawCallHook = new DrawCallHook(gl, debug);
|
|
411
|
+
this.textureHook = new TextureHook(gl, debug);
|
|
412
|
+
this.shaderHook = new ShaderHook(gl, debug);
|
|
413
|
+
this.programHook = new ProgramHook(gl, debug);
|
|
393
414
|
};
|
|
394
415
|
/**
|
|
395
416
|
* reset draw call hook
|
|
@@ -425,12 +446,12 @@ var TextureHook = /*#__PURE__*/ function() {
|
|
|
425
446
|
fps: Math.round(this.updateCounter * 1000 / (now - this.updateTime)),
|
|
426
447
|
// eslint-disable-next-line compat/compat -- performance.memory is not standard
|
|
427
448
|
memory: performance.memory && performance.memory.usedJSHeapSize / 1048576 >> 0,
|
|
428
|
-
drawCall: this.drawCallHook.drawCall === 0 ? 0 : this.drawCallHook.drawCall
|
|
429
|
-
triangles: this.drawCallHook.triangles === 0 ? 0 : this.drawCallHook.triangles
|
|
449
|
+
drawCall: this.drawCallHook.drawCall === 0 ? 0 : this.drawCallHook.drawCall,
|
|
450
|
+
triangles: this.drawCallHook.triangles === 0 ? 0 : this.drawCallHook.triangles,
|
|
430
451
|
lines: this.drawCallHook.lines,
|
|
431
452
|
points: this.drawCallHook.points,
|
|
432
453
|
textures: this.textureHook.textures,
|
|
433
|
-
shaders: this.shaderHook.shaders === 0 ? 0 : this.shaderHook.shaders
|
|
454
|
+
shaders: this.shaderHook.shaders === 0 ? 0 : this.shaderHook.shaders,
|
|
434
455
|
programs: this.programHook.programs,
|
|
435
456
|
webglContext: _instanceof1(this.gl, WebGL2RenderingContext) ? "2.0" : "1.0"
|
|
436
457
|
};
|
|
@@ -443,9 +464,10 @@ var TextureHook = /*#__PURE__*/ function() {
|
|
|
443
464
|
}();
|
|
444
465
|
|
|
445
466
|
var tpl = '\n <dl>\n <dt>FPS</dt>\n <dd>0</dd>\n <dt>Memory <span class="unit">(MB)</span></dt>\n <dd>0</dd>\n <dt>DrawCall</dt>\n <dd>0</dd>\n <dt>Triangles</dt>\n <dd>0</dd>\n <dt>Textures</dt>\n <dd>0</dd>\n <dt>Shaders</dt>\n <dd>0</dd>\n <dt>Program</dt>\n <dd>0</dd>\n <dt>WebGL</dt>\n <dd></dd>\n </dl>\n';
|
|
446
|
-
var css = "\n .gl-perf {\n pointer-events: none;\n user-select: none;\n position:
|
|
467
|
+
var css = "\n .gl-perf {\n pointer-events: none;\n user-select: none;\n position: absolute;\n top: 0;\n left: 0;\n padding: " + 10 / 7.5 + "vh " + 10 / 7.5 + "vh 0 " + 10 / 7.5 + "vh;\n background: rgba(0, 0, 0, 0.3);\n color: #fff;\n font: " + 10 / 7.5 + "vh arial;\n }\n\n .gl-perf dl,\n .gl-perf dt,\n .gl-perf dd {\n padding: 0;\n margin: 0;\n }\n\n .gl-perf dt {\n color: #fff;\n text-shadow: #000 0 0 1px;\n }\n\n .gl-perf dt .unit{\n font-size: " + 10 / 7.5 + "vh;\n }\n\n .gl-perf dd {\n font-size: " + 20 / 7.5 + "vh;\n padding: " + 10 / 7.5 + "vh 0 " + 10 / 7.5 + "vh;\n }\n";
|
|
447
468
|
var Monitor = /*#__PURE__*/ function() {
|
|
448
|
-
function Monitor(gl) {
|
|
469
|
+
function Monitor(gl, options) {
|
|
470
|
+
this.options = options;
|
|
449
471
|
this.items = [
|
|
450
472
|
"fps",
|
|
451
473
|
"memory",
|
|
@@ -468,19 +490,22 @@ var Monitor = /*#__PURE__*/ function() {
|
|
|
468
490
|
programs: 0,
|
|
469
491
|
webglContext: "2.0"
|
|
470
492
|
};
|
|
471
|
-
this.core = new Core(gl);
|
|
493
|
+
this.core = new Core(gl, options.debug);
|
|
472
494
|
this.createContainer();
|
|
473
495
|
this.update = this.update.bind(this);
|
|
474
496
|
}
|
|
475
497
|
var _proto = Monitor.prototype;
|
|
476
498
|
_proto.createContainer = function createContainer() {
|
|
477
499
|
var container = document.createElement("div");
|
|
500
|
+
this.container = container;
|
|
501
|
+
if (!this.options.visible) {
|
|
502
|
+
this.hide();
|
|
503
|
+
}
|
|
478
504
|
container.classList.add("gl-perf");
|
|
479
505
|
container.innerHTML = tpl;
|
|
480
506
|
container.appendChild(this.createStyle());
|
|
481
|
-
|
|
507
|
+
this.options.container.appendChild(container);
|
|
482
508
|
this.doms = Array.prototype.slice.apply(container.querySelectorAll("dd"));
|
|
483
|
-
this.container = container;
|
|
484
509
|
};
|
|
485
510
|
_proto.createStyle = function createStyle() {
|
|
486
511
|
var style = document.createElement("style");
|
|
@@ -500,11 +525,17 @@ var Monitor = /*#__PURE__*/ function() {
|
|
|
500
525
|
});
|
|
501
526
|
};
|
|
502
527
|
var data = this.core.update(dt);
|
|
503
|
-
if (!data || data.
|
|
528
|
+
if (!data || data.triangles === 0) {
|
|
504
529
|
return;
|
|
505
530
|
}
|
|
506
531
|
for(var i = 0, l = this.items.length; i < l; i++)_this = this, _loop(i);
|
|
507
532
|
};
|
|
533
|
+
_proto.hide = function hide() {
|
|
534
|
+
this.container.style.display = "none";
|
|
535
|
+
};
|
|
536
|
+
_proto.show = function show() {
|
|
537
|
+
this.container.style.display = "block";
|
|
538
|
+
};
|
|
508
539
|
/**
|
|
509
540
|
* reset all hooks
|
|
510
541
|
*/ _proto.reset = function reset() {
|
|
@@ -529,7 +560,7 @@ var Monitor = /*#__PURE__*/ function() {
|
|
|
529
560
|
* dispose the instance
|
|
530
561
|
*/ _proto.dispose = function dispose() {
|
|
531
562
|
this.release();
|
|
532
|
-
|
|
563
|
+
this.container.remove();
|
|
533
564
|
};
|
|
534
565
|
return Monitor;
|
|
535
566
|
}();
|
|
@@ -540,10 +571,10 @@ var StatsComponent = /*#__PURE__*/ function(Behaviour) {
|
|
|
540
571
|
return Behaviour.apply(this, arguments);
|
|
541
572
|
}
|
|
542
573
|
var _proto = StatsComponent.prototype;
|
|
543
|
-
_proto.
|
|
574
|
+
_proto.init = function init(options) {
|
|
544
575
|
var renderer = this.engine.renderer;
|
|
545
576
|
var gl = renderer.pipelineContext.gl;
|
|
546
|
-
this.monitor = new Monitor(gl);
|
|
577
|
+
this.monitor = new Monitor(gl, options);
|
|
547
578
|
};
|
|
548
579
|
_proto.onUpdate = function onUpdate(dt) {
|
|
549
580
|
this.monitor.update(dt);
|
|
@@ -555,6 +586,11 @@ var StatsComponent = /*#__PURE__*/ function(Behaviour) {
|
|
|
555
586
|
return StatsComponent;
|
|
556
587
|
}(EFFECTS.Behaviour);
|
|
557
588
|
|
|
589
|
+
var defaultStatsOptions = {
|
|
590
|
+
debug: false,
|
|
591
|
+
visible: true,
|
|
592
|
+
container: document.body
|
|
593
|
+
};
|
|
558
594
|
var json = {
|
|
559
595
|
"images": [],
|
|
560
596
|
"fonts": [],
|
|
@@ -649,18 +685,16 @@ var json = {
|
|
|
649
685
|
*
|
|
650
686
|
*/ var Stats = /*#__PURE__*/ function() {
|
|
651
687
|
function Stats(player, options) {
|
|
652
|
-
if (options === void 0) options = {
|
|
653
|
-
debug: false
|
|
654
|
-
};
|
|
655
688
|
this.player = player;
|
|
656
|
-
|
|
689
|
+
this.options = options;
|
|
690
|
+
this.disposed = false;
|
|
657
691
|
void this.init();
|
|
658
692
|
}
|
|
659
693
|
var _proto = Stats.prototype;
|
|
660
694
|
_proto.init = function init() {
|
|
661
695
|
var _this = this;
|
|
662
696
|
return _async_to_generator(function() {
|
|
663
|
-
var composition,
|
|
697
|
+
var composition, item, e;
|
|
664
698
|
return __generator(this, function(_state) {
|
|
665
699
|
switch(_state.label){
|
|
666
700
|
case 0:
|
|
@@ -676,8 +710,11 @@ var json = {
|
|
|
676
710
|
];
|
|
677
711
|
case 1:
|
|
678
712
|
composition = _state.sent();
|
|
679
|
-
|
|
680
|
-
|
|
713
|
+
item = composition.getItemByName("component");
|
|
714
|
+
if (item) {
|
|
715
|
+
item.addComponent(StatsComponent).init(_extends({}, defaultStatsOptions, _this.options));
|
|
716
|
+
_this.component = item.getComponent(StatsComponent);
|
|
717
|
+
}
|
|
681
718
|
return [
|
|
682
719
|
3,
|
|
683
720
|
3
|
|
@@ -693,12 +730,29 @@ var json = {
|
|
|
693
730
|
});
|
|
694
731
|
})();
|
|
695
732
|
};
|
|
733
|
+
_proto.hide = function hide() {
|
|
734
|
+
var _this_component;
|
|
735
|
+
(_this_component = this.component) == null ? void 0 : _this_component.monitor.hide();
|
|
736
|
+
};
|
|
737
|
+
_proto.show = function show() {
|
|
738
|
+
var _this_component;
|
|
739
|
+
(_this_component = this.component) == null ? void 0 : _this_component.monitor.show();
|
|
740
|
+
};
|
|
741
|
+
_proto.dispose = function dispose() {
|
|
742
|
+
var _this_component;
|
|
743
|
+
if (this.disposed) {
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
this.disposed = true;
|
|
747
|
+
(_this_component = this.component) == null ? void 0 : _this_component.dispose();
|
|
748
|
+
this.component = undefined;
|
|
749
|
+
};
|
|
696
750
|
return Stats;
|
|
697
751
|
}();
|
|
698
752
|
|
|
699
753
|
/**
|
|
700
754
|
* 插件版本号
|
|
701
|
-
*/ var version = "2.
|
|
755
|
+
*/ var version = "2.2.0";
|
|
702
756
|
EFFECTS.logger.info("Plugin stats version: " + version + ".");
|
|
703
757
|
if (version !== EFFECTS__namespace.version) {
|
|
704
758
|
console.error("注意:请统一 Stats 插件与 Player 版本,不统一的版本混用会有不可预知的后果!", "\nAttention: Please ensure the Stats plugin is synchronized with the Player version. Mixing and matching incompatible versions may result in unpredictable consequences!");
|