mirror of
https://github.com/wassname/phaser.git
synced 2026-08-07 11:26:10 +08:00
Various small fixes
This commit is contained in:
+11
-6
@@ -86,6 +86,11 @@ module Phaser {
|
||||
*/
|
||||
public crossOrigin: string = '';
|
||||
|
||||
// If you want to append a URL before the path of any asset you can set this here.
|
||||
// Useful if you need to allow an asset url to be configured outside of the game code.
|
||||
// MUST have / on the end of it!
|
||||
public baseURL: string = '';
|
||||
|
||||
public onFileComplete: Phaser.Signal;
|
||||
public onFileError: Phaser.Signal;
|
||||
public onLoadStart: Phaser.Signal;
|
||||
@@ -326,7 +331,7 @@ module Phaser {
|
||||
file.data.onload = () => this.fileComplete(file.key);
|
||||
file.data.onerror = () => this.fileError(file.key);
|
||||
file.data.crossOrigin = this.crossOrigin;
|
||||
file.data.src = file.url;
|
||||
file.data.src = this.baseURL + file.url;
|
||||
break;
|
||||
|
||||
case 'audio':
|
||||
@@ -338,7 +343,7 @@ module Phaser {
|
||||
// WebAudio or Audio Tag?
|
||||
if (this.game.sound.usingWebAudio)
|
||||
{
|
||||
this._xhr.open("GET", file.url, true);
|
||||
this._xhr.open("GET", this.baseURL + file.url, true);
|
||||
this._xhr.responseType = "arraybuffer";
|
||||
this._xhr.onload = () => this.fileComplete(file.key);
|
||||
this._xhr.onerror = () => this.fileError(file.key);
|
||||
@@ -352,7 +357,7 @@ module Phaser {
|
||||
file.data = new Audio();
|
||||
file.data.name = file.key;
|
||||
file.data.preload = 'auto';
|
||||
file.data.src = file.url;
|
||||
file.data.src = this.baseURL + file.url;
|
||||
this.fileComplete(file.key);
|
||||
}
|
||||
else
|
||||
@@ -361,7 +366,7 @@ module Phaser {
|
||||
file.data.name = file.key;
|
||||
file.data.onerror = () => this.fileError(file.key);
|
||||
file.data.preload = 'auto';
|
||||
file.data.src = file.url;
|
||||
file.data.src = this.baseURL + file.url;
|
||||
file.data.addEventListener('canplaythrough', Phaser.GAMES[this.game.id].load.fileComplete(file.key), false);
|
||||
file.data.load();
|
||||
}
|
||||
@@ -371,7 +376,7 @@ module Phaser {
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
this._xhr.open("GET", file.url, true);
|
||||
this._xhr.open("GET", this.baseURL + file.url, true);
|
||||
this._xhr.responseType = "text";
|
||||
this._xhr.onload = () => this.fileComplete(file.key);
|
||||
this._xhr.onerror = () => this.fileError(file.key);
|
||||
@@ -454,7 +459,7 @@ module Phaser {
|
||||
{
|
||||
// Load the JSON or XML before carrying on with the next file
|
||||
loadNext = false;
|
||||
this._xhr.open("GET", file.atlasURL, true);
|
||||
this._xhr.open("GET", this.baseURL + file.atlasURL, true);
|
||||
this._xhr.responseType = "text";
|
||||
|
||||
if (file.format == Loader.TEXTURE_ATLAS_JSON_ARRAY)
|
||||
|
||||
Reference in New Issue
Block a user