@vpmedia/phaser 1.6.0 → 1.8.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/README.md +1 -1
- package/package.json +7 -7
- package/src/phaser/core/loader.js +18 -2
- package/src/phaser/display/bitmap_text.js +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@vpmedia/phaser
|
|
2
2
|
===============
|
|
3
3
|
|
|
4
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
5
5
|
[](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
|
|
6
6
|
|
|
7
7
|
@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
],
|
|
22
22
|
"main": "./src/index.js",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"eslint": "^8.
|
|
25
|
-
"eslint-config-prettier": "^8.
|
|
24
|
+
"eslint": "^8.36.0",
|
|
25
|
+
"eslint-config-prettier": "^8.7.0",
|
|
26
26
|
"eslint-plugin-import": "^2.27.5",
|
|
27
27
|
"eslint-plugin-jest": "^27.2.1",
|
|
28
|
-
"eslint-plugin-jsdoc": "^
|
|
28
|
+
"eslint-plugin-jsdoc": "^40.1.0",
|
|
29
29
|
"eslint-plugin-prettier": "^4.2.1",
|
|
30
30
|
"husky": "^8.0.3",
|
|
31
|
-
"jest": "^29.
|
|
32
|
-
"lint-staged": "^13.
|
|
33
|
-
"prettier": "^2.8.
|
|
31
|
+
"jest": "^29.5.0",
|
|
32
|
+
"lint-staged": "^13.2.0",
|
|
33
|
+
"prettier": "^2.8.5"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
|
|
@@ -15,6 +15,9 @@ export default class {
|
|
|
15
15
|
this.game = game;
|
|
16
16
|
this.cache = game.cache;
|
|
17
17
|
this.isLoading = false;
|
|
18
|
+
this.isLogging = false;
|
|
19
|
+
this.isUseRetry = false;
|
|
20
|
+
this.maxRetry = 1;
|
|
18
21
|
this.hasLoaded = false;
|
|
19
22
|
this.preloadSprite = null;
|
|
20
23
|
this.crossOrigin = false;
|
|
@@ -456,10 +459,11 @@ export default class {
|
|
|
456
459
|
asyncComplete(file, errorMessage = '') {
|
|
457
460
|
file.loaded = true;
|
|
458
461
|
file.error = !!errorMessage;
|
|
459
|
-
if (
|
|
462
|
+
if (file.error) {
|
|
460
463
|
file.errorMessage = errorMessage;
|
|
461
464
|
console.warn(file, errorMessage);
|
|
462
465
|
}
|
|
466
|
+
this.log('asyncComplete', file);
|
|
463
467
|
this.processLoadQueue();
|
|
464
468
|
}
|
|
465
469
|
|
|
@@ -552,6 +556,7 @@ export default class {
|
|
|
552
556
|
}
|
|
553
557
|
|
|
554
558
|
loadImageTag(file) {
|
|
559
|
+
this.log('loadImageTag', file);
|
|
555
560
|
const _this = this;
|
|
556
561
|
file.data = new Image();
|
|
557
562
|
file.data.name = file.key;
|
|
@@ -566,7 +571,10 @@ export default class {
|
|
|
566
571
|
}
|
|
567
572
|
};
|
|
568
573
|
file.data.onerror = () => {
|
|
569
|
-
if (file.
|
|
574
|
+
if (_this.isUseRetry && (!file.numRetry || file.numRetry < _this.maxRetry)) {
|
|
575
|
+
file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
|
|
576
|
+
_this.loadImageTag(file);
|
|
577
|
+
} else if (file.data.onload) {
|
|
570
578
|
file.data.onload = null;
|
|
571
579
|
file.data.onerror = null;
|
|
572
580
|
_this.fileError(file);
|
|
@@ -576,6 +584,7 @@ export default class {
|
|
|
576
584
|
}
|
|
577
585
|
|
|
578
586
|
xhrLoad(file, url, type, onload, onerror) {
|
|
587
|
+
this.log('xhrLoad', file);
|
|
579
588
|
const xhr = new XMLHttpRequest();
|
|
580
589
|
xhr.open('GET', url, true);
|
|
581
590
|
xhr.responseType = type;
|
|
@@ -814,6 +823,13 @@ export default class {
|
|
|
814
823
|
}
|
|
815
824
|
}
|
|
816
825
|
|
|
826
|
+
log(message, data = '') {
|
|
827
|
+
if (!this.isLogging) {
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
console.log(`[Loader] ${message}`, data);
|
|
831
|
+
}
|
|
832
|
+
|
|
817
833
|
totalLoadedFiles() {
|
|
818
834
|
return this._loadedFileCount;
|
|
819
835
|
}
|
|
@@ -260,7 +260,7 @@ export default class extends DisplayObject {
|
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
get fill() {
|
|
263
|
-
return typeof this.tint === 'number' ? `#${this.tint.toString(16)}` : this.tint;
|
|
263
|
+
return typeof this.tint === 'number' ? `#${this.tint.toString(16).toUpperCase()}` : this.tint;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
set fill(value) {
|