@@ -3,6 +3,7 @@ var CONST = require('./const');
33var CustomSet = require ( '../structs/Set' ) ;
44var EventEmitter = require ( 'eventemitter3' ) ;
55var FileTypesManager = require ( './FileTypesManager' ) ;
6+ var GetFastValue = require ( '../utils/object/GetFastValue' ) ;
67var ParseXMLBitmapFont = require ( '../gameobjects/bitmaptext/ParseXMLBitmapFont' ) ;
78var PluginManager = require ( '../plugins/PluginManager' ) ;
89var XHRSettings = require ( './XHRSettings' ) ;
@@ -33,17 +34,25 @@ var LoaderPlugin = new Class({
3334 // Inject the available filetypes into the Loader
3435 FileTypesManager . install ( this ) ;
3536
36- this . baseURL = '' ;
37- this . path = '' ;
37+ var sceneConfig = this . systems . settings . loader ;
38+ var gameConfig = this . systems . game . config ;
39+
40+ this . baseURL = GetFastValue ( sceneConfig , 'baseURL' , gameConfig . loaderBaseURL ) ;
41+ this . path = GetFastValue ( sceneConfig , 'path' , gameConfig . loaderPath ) ;
3842
39- // Read from Game / Scene Config
40- this . enableParallel = true ;
41- this . maxParallelDownloads = 4 ;
43+ this . enableParallel = GetFastValue ( sceneConfig , 'enableParallel' , gameConfig . loaderEnableParallel ) ;
44+ this . maxParallelDownloads = GetFastValue ( sceneConfig , 'maxParallelDownloads' , gameConfig . loaderMaxParallelDownloads ) ;
4245
4346 // xhr specific global settings (can be overridden on a per-file basis)
44- this . xhr = XHRSettings ( ) ;
47+ this . xhr = XHRSettings (
48+ GetFastValue ( sceneConfig , 'responseType' , gameConfig . loaderResponseType ) ,
49+ GetFastValue ( sceneConfig , 'async' , gameConfig . loaderAsync ) ,
50+ GetFastValue ( sceneConfig , 'user' , gameConfig . loaderUser ) ,
51+ GetFastValue ( sceneConfig , 'password' , gameConfig . loaderPassword ) ,
52+ GetFastValue ( sceneConfig , 'timeout' , gameConfig . loaderTimeout )
53+ ) ;
4554
46- this . crossOrigin = undefined ;
55+ this . crossOrigin = GetFastValue ( sceneConfig , 'crossOrigin' , gameConfig . loaderCrossOrigin ) ;
4756
4857 this . totalToLoad = 0 ;
4958 this . progress = 0 ;
@@ -59,10 +68,6 @@ var LoaderPlugin = new Class({
5968
6069 boot : function ( )
6170 {
62- // Set values from scene / game configs
63-
64-
65-
6671 var eventEmitter = this . systems . events ;
6772
6873 eventEmitter . on ( 'shutdown' , this . shutdown , this ) ;
@@ -193,7 +198,7 @@ var LoaderPlugin = new Class({
193198 file . crossOrigin = this . crossOrigin ;
194199 }
195200
196- file . load ( this . nextFile . bind ( this ) , this . baseURL ) ;
201+ file . load ( this . nextFile . bind ( this ) , this . baseURL , this . xhr ) ;
197202 } ,
198203
199204 nextFile : function ( previousFile , success )
0 commit comments