@vpmedia/phaser 1.110.0 → 1.112.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/index.js +41 -22
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +15 -2
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/phaser/core/animation_manager.ts +4 -2
- package/src/phaser/core/cache.ts +17 -4
- package/src/phaser/core/device_util.ts +6 -6
- package/src/phaser/core/game.ts +3 -3
- package/src/phaser/core/loader.ts +2 -2
- package/src/phaser/core/sound_manager.ts +6 -5
- package/src/phaser/display/canvas/tinter.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLogger } from "@logtape/logtape";
|
|
2
2
|
import { v4 } from "uuid";
|
|
3
|
+
import { PAGE_LIFECYCLE_STATE_ACTIVE, PAGE_LIFECYCLE_STATE_CHANGE_EVENT, addPageLifecycleCallback, getPageLifecycleEventEmitter } from "@vpmedia/simplify";
|
|
3
4
|
//#region \0rolldown/runtime.js
|
|
4
5
|
var __defProp = Object.defineProperty;
|
|
5
6
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -1678,14 +1679,14 @@ const detectCapabilities = (game) => {
|
|
|
1678
1679
|
window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = canUseNewCanvasBlendModes();
|
|
1679
1680
|
} catch (error) {
|
|
1680
1681
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
1681
|
-
game.logger.
|
|
1682
|
+
game.logger.fatal("Tinter", { error: typedError });
|
|
1682
1683
|
window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY = false;
|
|
1683
1684
|
}
|
|
1684
1685
|
if (!window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY) try {
|
|
1685
1686
|
window.PhaserRegistry.CAN_CANVAS_HANDLE_ALPHA = checkInverseAlpha();
|
|
1686
1687
|
} catch (error) {
|
|
1687
1688
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
1688
|
-
game.logger.
|
|
1689
|
+
game.logger.fatal("Tinter", { error: typedError });
|
|
1689
1690
|
window.PhaserRegistry.CAN_CANVAS_HANDLE_ALPHA = false;
|
|
1690
1691
|
}
|
|
1691
1692
|
window.PhaserRegistry.CANVAS_TINT_METHOD = window.PhaserRegistry.CAN_CANVAS_USE_MULTIPLY ? tintWithMultiply : tintWithPerPixel;
|
|
@@ -3557,7 +3558,10 @@ var AnimationManager = class {
|
|
|
3557
3558
|
if (typeof value === "number" && this._frameData && this._frameData.getFrame(value) !== null) {
|
|
3558
3559
|
this.currentFrame = this._frameData.getFrame(value);
|
|
3559
3560
|
if (this.currentFrame) this.sprite.setFrame(this.currentFrame);
|
|
3560
|
-
} else this.game.logger.
|
|
3561
|
+
} else this.game.logger.fatal("AnimationManager", {
|
|
3562
|
+
error: /* @__PURE__ */ new Error(ENGINE_ERROR_CANNOT_SET_FRAME),
|
|
3563
|
+
tags: { "asset.key": value }
|
|
3564
|
+
});
|
|
3561
3565
|
}
|
|
3562
3566
|
/**
|
|
3563
3567
|
* Gets the current frame name.
|
|
@@ -3577,7 +3581,10 @@ var AnimationManager = class {
|
|
|
3577
3581
|
this._frameIndex = this.currentFrame.index;
|
|
3578
3582
|
this.sprite.setFrame(this.currentFrame);
|
|
3579
3583
|
}
|
|
3580
|
-
} else this.game.logger.
|
|
3584
|
+
} else this.game.logger.fatal("AnimationManager", {
|
|
3585
|
+
error: /* @__PURE__ */ new Error(ENGINE_ERROR_CANNOT_SET_FRAME_NAME),
|
|
3586
|
+
tags: { "asset.key": value }
|
|
3587
|
+
});
|
|
3581
3588
|
}
|
|
3582
3589
|
};
|
|
3583
3590
|
//#endregion
|
|
@@ -12879,14 +12886,14 @@ var Cache = class {
|
|
|
12879
12886
|
* @param {string} key - The unique key for the cache entry to remove.
|
|
12880
12887
|
*/
|
|
12881
12888
|
removeSpriteSheet(key) {
|
|
12882
|
-
delete this._cache.
|
|
12889
|
+
delete this._cache.image[key];
|
|
12883
12890
|
}
|
|
12884
12891
|
/**
|
|
12885
12892
|
* Removes a texture atlas cache entry.
|
|
12886
12893
|
* @param {string} key - The unique key for the cache entry to remove.
|
|
12887
12894
|
*/
|
|
12888
12895
|
removeTextureAtlas(key) {
|
|
12889
|
-
delete this._cache.
|
|
12896
|
+
delete this._cache.image[key];
|
|
12890
12897
|
}
|
|
12891
12898
|
/**
|
|
12892
12899
|
* Clears all GL textures from the cache.
|
|
@@ -12996,7 +13003,7 @@ var Device = class {
|
|
|
12996
13003
|
};
|
|
12997
13004
|
//#endregion
|
|
12998
13005
|
//#region src/phaser/core/device_util.ts
|
|
12999
|
-
const logger =
|
|
13006
|
+
const logger = getLogger(["phaser", "device"]);
|
|
13000
13007
|
/**
|
|
13001
13008
|
* Check if the device can play a specific audio format.
|
|
13002
13009
|
* @param {Device} device - The device instance to check.
|
|
@@ -13100,7 +13107,10 @@ const canPlayType = (audioElement, type) => {
|
|
|
13100
13107
|
return canPlayResult === "maybe" || canPlayResult === "probably";
|
|
13101
13108
|
} catch (error) {
|
|
13102
13109
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
13103
|
-
logger.
|
|
13110
|
+
logger.fatal("canPlayType error", {
|
|
13111
|
+
error: typedError,
|
|
13112
|
+
type
|
|
13113
|
+
});
|
|
13104
13114
|
return false;
|
|
13105
13115
|
}
|
|
13106
13116
|
};
|
|
@@ -13114,7 +13124,10 @@ const isMediaSourceTypeSupported = (type) => {
|
|
|
13114
13124
|
return MediaSource.isTypeSupported(type);
|
|
13115
13125
|
} catch (error) {
|
|
13116
13126
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
13117
|
-
logger.
|
|
13127
|
+
logger.fatal("MediaSource.isTypeSupported error", {
|
|
13128
|
+
error: typedError,
|
|
13129
|
+
type
|
|
13130
|
+
});
|
|
13118
13131
|
return false;
|
|
13119
13132
|
}
|
|
13120
13133
|
return false;
|
|
@@ -15473,7 +15486,7 @@ var Loader = class {
|
|
|
15473
15486
|
} catch (error) {
|
|
15474
15487
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
15475
15488
|
if (!scope.hasLoaded) scope.asyncComplete(file, typedError.message || "Exception");
|
|
15476
|
-
else scope.game.logger.
|
|
15489
|
+
else scope.game.logger.fatal("Loader", { error: typedError });
|
|
15477
15490
|
}
|
|
15478
15491
|
return null;
|
|
15479
15492
|
};
|
|
@@ -15487,7 +15500,7 @@ var Loader = class {
|
|
|
15487
15500
|
} catch (error) {
|
|
15488
15501
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
15489
15502
|
if (!scope.hasLoaded) scope.asyncComplete(file, typedError.message || "Exception");
|
|
15490
|
-
else scope.game.logger.
|
|
15503
|
+
else scope.game.logger.fatal("Loader", { error: typedError });
|
|
15491
15504
|
}
|
|
15492
15505
|
return null;
|
|
15493
15506
|
};
|
|
@@ -17799,7 +17812,7 @@ var SoundManager = class {
|
|
|
17799
17812
|
this.context = null;
|
|
17800
17813
|
setAudioDisabledState();
|
|
17801
17814
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
17802
|
-
this.game.logger.
|
|
17815
|
+
this.game.logger.fatal("SoundManager", { error: typedError });
|
|
17803
17816
|
}
|
|
17804
17817
|
else if (window.webkitAudioContext) try {
|
|
17805
17818
|
this.game.logger.info("initWebkitAudioContext");
|
|
@@ -17809,10 +17822,10 @@ var SoundManager = class {
|
|
|
17809
17822
|
this.context = null;
|
|
17810
17823
|
setAudioDisabledState();
|
|
17811
17824
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
17812
|
-
this.game.logger.
|
|
17825
|
+
this.game.logger.fatal("SoundManager", { error: typedError });
|
|
17813
17826
|
}
|
|
17814
17827
|
if (!this.context) {
|
|
17815
|
-
this.game.logger.
|
|
17828
|
+
this.game.logger.fatal("SoundManager", { error: /* @__PURE__ */ new Error(ENGINE_ERROR_CREATING_AUDIO_CONTEXT) });
|
|
17816
17829
|
setAudioDisabledState();
|
|
17817
17830
|
return;
|
|
17818
17831
|
}
|
|
@@ -17917,10 +17930,13 @@ var SoundManager = class {
|
|
|
17917
17930
|
error
|
|
17918
17931
|
});
|
|
17919
17932
|
this.removeUnlockHandlers();
|
|
17920
|
-
this.game.logger.
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
|
|
17933
|
+
this.game.logger.fatal("SoundManager", {
|
|
17934
|
+
error,
|
|
17935
|
+
tags: {
|
|
17936
|
+
"audio.initialState": initialState,
|
|
17937
|
+
"audio.state": this.context.state
|
|
17938
|
+
}
|
|
17939
|
+
});
|
|
17924
17940
|
});
|
|
17925
17941
|
};
|
|
17926
17942
|
/**
|
|
@@ -17957,7 +17973,10 @@ var SoundManager = class {
|
|
|
17957
17973
|
this.game.cache.decodedSound(key, buffer);
|
|
17958
17974
|
}).catch((error) => {
|
|
17959
17975
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
17960
|
-
this.game.logger.
|
|
17976
|
+
this.game.logger.fatal("SoundManager", {
|
|
17977
|
+
error: typedError,
|
|
17978
|
+
tags: { "asset.key": key }
|
|
17979
|
+
});
|
|
17961
17980
|
if (typedError.name === "InvalidStateError") addPageLifecycleCallback(PAGE_LIFECYCLE_STATE_ACTIVE, () => {
|
|
17962
17981
|
this.decode(key);
|
|
17963
17982
|
});
|
|
@@ -20139,7 +20158,7 @@ var Game = class {
|
|
|
20139
20158
|
if (window.PhaserRegistry?.GL_PROGRAM_INFO_LOG) this.logger.warn("WebGL program info", { log: window.PhaserRegistry.GL_PROGRAM_INFO_LOG });
|
|
20140
20159
|
if (window.PhaserRegistry?.GL_SHADER_INFO_LOG) this.logger.warn("WebGL shader info", { log: window.PhaserRegistry.GL_SHADER_INFO_LOG });
|
|
20141
20160
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
20142
|
-
this.logger.
|
|
20161
|
+
this.logger.fatal("Game", { error: typedError });
|
|
20143
20162
|
}
|
|
20144
20163
|
if (!isWebGlReady) {
|
|
20145
20164
|
if (this.contextLostBinded) this.canvas.removeEventListener("webglcontextlost", this.contextLostBinded, false);
|
|
@@ -20169,7 +20188,7 @@ var Game = class {
|
|
|
20169
20188
|
* @param {object} config - The configuration object to parse.
|
|
20170
20189
|
*/
|
|
20171
20190
|
parseConfig(config) {
|
|
20172
|
-
this.logger = config.logger ??
|
|
20191
|
+
this.logger = config.logger ?? getLogger(["phaser"]);
|
|
20173
20192
|
this.logger.info("parseConfig");
|
|
20174
20193
|
this.parseConfigElement(config, "width", 800);
|
|
20175
20194
|
this.parseConfigElement(config, "height", 600);
|