mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Loader.pack will allow you to load in a new Phaser Asset Pack JSON file. An Asset Pack is a specially structured file that allows you to define all assets for your game in an external file. The file can be split into sections, allowing you to control loading a specific set of files from it. An example JSON file can be found in the resources
folder and examples of use in the Phaser Examples repository.
Loader.totalQueuedPacks returns the number of Asset Packs in the queue. Loader.totalLoadedPacks returns the number of Asset Packs already loaded.
This commit is contained in:
parent
4004cc92e3
commit
5b5bdc80d9
3 changed files with 27 additions and 4 deletions
|
@ -76,6 +76,9 @@ Version 2.0.6 - "Jornhill" - -in development-
|
|||
* ArcadePhysics.Body has a new boolean property `enable`. If `false` the body won't be checked for any collision or overlaps, or have its pre or post update methods called. Use this for easy toggling of physics bodies without having to destroy or re-create the Body object itself.
|
||||
* BitmapData.addToWorld will create a new Phaser.Image object, assign the BitmapData to be its texture, add it to the world then return it.
|
||||
* BitmapData.copyPixels now accepts a Sprite, Image, BitmapData, HTMLImage or string as its source.
|
||||
* Loader.pack will allow you to load in a new Phaser Asset Pack JSON file. An Asset Pack is a specially structured file that allows you to define all assets for your game in an external file. The file can be split into sections, allowing you to control loading a specific set of files from it. An example JSON file can be found in the `resources` folder and examples of use in the Phaser Examples repository.
|
||||
* Loader.totalQueuedPacks returns the number of Asset Packs in the queue.
|
||||
* Loader.totalLoadedPacks returns the number of Asset Packs already loaded.
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
|
7
build/phaser.d.ts
vendored
7
build/phaser.d.ts
vendored
|
@ -2686,7 +2686,8 @@ declare module Phaser {
|
|||
image(key: string, url: string, overwrite?: boolean): Phaser.Loader;
|
||||
json(key: string, url: string, overwrite?: boolean): Phaser.Loader;
|
||||
jsonLoadComplete(index: number): void;
|
||||
physics(key: string, dataURL?: string, jsonData?: Object, format?: string): Phaser.Loader;
|
||||
pack(key: string, url?: string, data?: Object, callbackContext?: any): Phaser.Loader;
|
||||
physics(key: string, url?: string, data?: Object, format?: string): Phaser.Loader;
|
||||
removeAll(): void;
|
||||
removeFile(key: string, type: string): void;
|
||||
replaceInFileList(type: string, key: string, url: string, properties: Object): void;
|
||||
|
@ -2696,9 +2697,11 @@ declare module Phaser {
|
|||
spritesheet(key: string, url: string, frameWidth: number, frameHeight: number, frameMax?: number, margin?: number, spacing?: number): Phaser.Loader;
|
||||
start(): void;
|
||||
text(key: string, url: string, overwrite?: boolean): Phaser.Loader;
|
||||
tilemap(key: string, mapDataURL?: string, mapData?: Object, format?: number): Phaser.Loader;
|
||||
tilemap(key: string, url?: string, data?: Object, format?: number): Phaser.Loader;
|
||||
totalLoadedFiles(): number;
|
||||
totalLoadedPacks(): number;
|
||||
totalQueuedFiles(): number;
|
||||
totalQueuedPacks(): number;
|
||||
xmlLoadComplete(index: number): void;
|
||||
|
||||
}
|
||||
|
|
|
@ -1275,6 +1275,17 @@ Phaser.Loader.prototype = {
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* Starts the xhr loader.
|
||||
*
|
||||
* @method Phaser.Loader#xhrLoad
|
||||
* @private
|
||||
* @param {number} index - The index of the file to load from the file list.
|
||||
* @param {string} url - The URL of the file.
|
||||
* @param {string} type - The xhr responseType.
|
||||
* @param {string} onload - A String of the name of the local function to be called on a successful file load.
|
||||
* @param {string} onerror - A String of the name of the local function to be called on a file load error.
|
||||
*/
|
||||
xhrLoad: function (index, url, type, onload, onerror) {
|
||||
|
||||
// console.log('xhrLoad', index, url, type, onload, onerror);
|
||||
|
@ -1298,9 +1309,10 @@ Phaser.Loader.prototype = {
|
|||
|
||||
/**
|
||||
* Private method ONLY used by loader.
|
||||
*
|
||||
* @method Phaser.Loader#getAudioURL
|
||||
* @param {array|string} urls - Either an array of audio file URLs or a string containing a single URL path.
|
||||
* @private
|
||||
* @param {array|string} urls - Either an array of audio file URLs or a string containing a single URL path.
|
||||
*/
|
||||
getAudioURL: function (urls) {
|
||||
|
||||
|
@ -1624,9 +1636,10 @@ Phaser.Loader.prototype = {
|
|||
/**
|
||||
* Handle loading next file.
|
||||
*
|
||||
* @method Phaser.Loader#nextFile
|
||||
* @private
|
||||
* @param {number} previousIndex - Index of the previously loaded asset.
|
||||
* @param {boolean} success - Whether the previous asset loaded successfully or not.
|
||||
* @private
|
||||
*/
|
||||
nextFile: function (previousIndex, success) {
|
||||
|
||||
|
@ -1674,6 +1687,7 @@ Phaser.Loader.prototype = {
|
|||
/**
|
||||
* Returns the number of files that have already been loaded, even if they errored.
|
||||
*
|
||||
* @method Phaser.Loader#totalLoadedFiles
|
||||
* @return {number} The number of files that have already been loaded (even if they errored)
|
||||
*/
|
||||
totalLoadedFiles: function () {
|
||||
|
@ -1695,6 +1709,7 @@ Phaser.Loader.prototype = {
|
|||
/**
|
||||
* Returns the number of files still waiting to be processed in the load queue. This value decreases as each file in the queue is loaded.
|
||||
*
|
||||
* @method Phaser.Loader#totalQueuedFiles
|
||||
* @return {number} The number of files that still remain in the load queue.
|
||||
*/
|
||||
totalQueuedFiles: function () {
|
||||
|
@ -1716,6 +1731,7 @@ Phaser.Loader.prototype = {
|
|||
/**
|
||||
* Returns the number of asset packs that have already been loaded, even if they errored.
|
||||
*
|
||||
* @method Phaser.Loader#totalLoadedPacks
|
||||
* @return {number} The number of asset packs that have already been loaded (even if they errored)
|
||||
*/
|
||||
totalLoadedPacks: function () {
|
||||
|
@ -1737,6 +1753,7 @@ Phaser.Loader.prototype = {
|
|||
/**
|
||||
* Returns the number of asset packs still waiting to be processed in the load queue. This value decreases as each pack in the queue is loaded.
|
||||
*
|
||||
* @method Phaser.Loader#totalQueuedPacks
|
||||
* @return {number} The number of asset packs that still remain in the load queue.
|
||||
*/
|
||||
totalQueuedPacks: function () {
|
||||
|
|
Loading…
Reference in a new issue