@@ -139,6 +139,7 @@ Loader.prototype.processCallback = function ()
139139 }
140140
141141 // The global Texture Manager
142+ var cache = this . state . sys . cache ;
142143 var textures = this . state . sys . textures ;
143144
144145 // Process multiatlas groups first
@@ -189,30 +190,57 @@ Loader.prototype.processCallback = function ()
189190
190191 this . storage . each ( function ( file )
191192 {
192- if ( file . type === 'image' )
193+ switch ( file . type )
193194 {
194- textures . addImage ( file . key , file . data ) ;
195- }
196- else if ( file . type === 'atlasjson' )
197- {
198- var fileA = file . fileA ;
199- var fileB = file . fileB ;
195+ case 'image' :
196+ textures . addImage ( file . key , file . data ) ;
197+ break ;
200198
201- if ( fileA . type === 'image' )
202- {
203- textures . addAtlas ( fileA . key , fileA . data , fileB . data ) ;
204- }
205- else
206- {
207- textures . addAtlas ( fileB . key , fileB . data , fileA . data ) ;
208- }
209- }
210- else if ( file . type === 'json' )
211- {
212- // console.dir(file.data);
199+ case 'atlasjson' :
200+ var fileA = file . fileA ;
201+ var fileB = file . fileB ;
202+
203+ if ( fileA . type === 'image' )
204+ {
205+ textures . addAtlas ( fileA . key , fileA . data , fileB . data ) ;
206+ }
207+ else
208+ {
209+ textures . addAtlas ( fileB . key , fileB . data , fileA . data ) ;
210+ }
211+ break ;
212+
213+ case 'json' :
214+ cache . json . add ( file . key , file . data ) ;
215+ break ;
216+
217+ case 'xml' :
218+ cache . xml . add ( file . key , file . data ) ;
219+ break ;
220+
221+ case 'text' :
222+ cache . text . add ( file . key , file . data ) ;
223+ break ;
224+
225+ case 'binary' :
226+ cache . binary . add ( file . key , file . data ) ;
227+ break ;
228+
229+ case 'sound' :
230+ cache . sound . add ( file . key , file . data ) ;
231+ break ;
232+
233+ case 'glsl' :
234+ cache . shader . add ( file . key , file . data ) ;
235+ break ;
213236 }
214237 } ) ;
215238
239+ // this.video = new BaseCache();
240+ // this.physics = new BaseCache();
241+ // this.tilemap = new BaseCache();
242+ // this.bitmapFont = new BaseCache();
243+
216244 this . storage . clear ( ) ;
217245} ;
218246
0 commit comments