mirror of
https://github.com/photonstorm/phaser
synced 2024-11-14 00:47:29 +00:00
Loader.File.retryAttempts
is the internal property holding the counter for the number of times to retry loading this file before it fails. This value is decreased after each attempt. When it reaches zero, the file is considered as failed.
This commit is contained in:
parent
195bede40e
commit
0a7df76c3f
1 changed files with 29 additions and 1 deletions
|
@ -241,6 +241,25 @@ var File = new Class({
|
||||||
* @since 3.80.0
|
* @since 3.80.0
|
||||||
*/
|
*/
|
||||||
this.base64 = (typeof url === 'string') && (url.indexOf('data:') === 0);
|
this.base64 = (typeof url === 'string') && (url.indexOf('data:') === 0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The counter for the number of times to retry loading this file before it fails.
|
||||||
|
*
|
||||||
|
* You can set this property value in the FileConfig object. If not present,
|
||||||
|
* this property is read from the `LoaderPlugin.maxRetries` property when
|
||||||
|
* this File instance is created.
|
||||||
|
*
|
||||||
|
* You can set this value via the Game Config, or you can adjust the `LoaderPlugin` property
|
||||||
|
* at any point after the Loader has started. However, it will not apply to files
|
||||||
|
* that have already been added to the Loader, only those added after this value
|
||||||
|
* is changed.
|
||||||
|
*
|
||||||
|
* @name Phaser.Loader.File#retryAttempts
|
||||||
|
* @type {number}
|
||||||
|
* @default 2
|
||||||
|
* @since 3.85.0
|
||||||
|
*/
|
||||||
|
this.retryAttempts = GetFastValue(fileConfig, 'maxRetries', loader.maxRetries);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,7 +395,16 @@ var File = new Class({
|
||||||
{
|
{
|
||||||
this.resetXHR();
|
this.resetXHR();
|
||||||
|
|
||||||
this.loader.nextFile(this, false);
|
if (this.retryAttempts > 0)
|
||||||
|
{
|
||||||
|
this.retryAttempts--;
|
||||||
|
|
||||||
|
this.load();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.loader.nextFile(this, false);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue