2017-06-30 14:47:51 +00:00
|
|
|
var BaseCache = require('./BaseCache');
|
|
|
|
var Class = require('../utils/Class');
|
|
|
|
|
2018-01-16 16:30:11 +00:00
|
|
|
var CacheManager = new Class({
|
2017-06-30 14:47:51 +00:00
|
|
|
|
|
|
|
initialize:
|
|
|
|
|
2017-10-04 23:09:12 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
2018-01-16 16:30:11 +00:00
|
|
|
* @class CacheManager
|
2017-10-04 23:09:12 +00:00
|
|
|
* @memberOf Phaser.Cache
|
|
|
|
* @constructor
|
|
|
|
* @since 3.0.0
|
2017-11-10 17:51:19 +00:00
|
|
|
*
|
2017-10-04 23:09:12 +00:00
|
|
|
* @param {Phaser.Game} game - [description]
|
|
|
|
*/
|
2018-01-16 16:30:11 +00:00
|
|
|
function CacheManager (game)
|
2017-06-30 14:47:51 +00:00
|
|
|
{
|
2017-10-04 23:09:12 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Game} game
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.game = game;
|
|
|
|
|
2017-10-04 23:09:12 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} binary
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.binary = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} bitmapFont
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.bitmapFont = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} json
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-08-10 04:17:13 +00:00
|
|
|
this.json = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} physics
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-08-10 04:17:13 +00:00
|
|
|
this.physics = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} shader
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.shader = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
2017-11-10 17:51:19 +00:00
|
|
|
* @property {Phaser.Cache.BaseCache} audio
|
2017-10-04 23:09:12 +00:00
|
|
|
* @protected
|
|
|
|
*/
|
2017-11-10 17:51:19 +00:00
|
|
|
this.audio = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} text
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-08-10 04:17:13 +00:00
|
|
|
this.text = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
2017-12-07 02:18:40 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} obj
|
|
|
|
* @protected
|
|
|
|
*/
|
|
|
|
this.obj = new BaseCache();
|
|
|
|
|
2017-10-04 23:09:12 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} tilemap
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-08-10 04:17:13 +00:00
|
|
|
this.tilemap = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} video
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-08-10 04:17:13 +00:00
|
|
|
this.video = new BaseCache();
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {Phaser.Cache.BaseCache} xml
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-08-10 04:17:13 +00:00
|
|
|
this.xml = new BaseCache();
|
2017-06-30 14:47:51 +00:00
|
|
|
|
2017-10-04 23:09:12 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @property {object.<Phaser.Cache.BaseCache>} custom
|
|
|
|
* @protected
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
this.custom = {};
|
|
|
|
},
|
|
|
|
|
|
|
|
// Add your own custom Cache entry, available under Cache.custom.key
|
2017-10-04 23:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
2018-01-16 16:30:11 +00:00
|
|
|
* @method Phaser.Cache.CacheManager#addCustom
|
2017-10-04 23:09:12 +00:00
|
|
|
* @since 3.0.0
|
2017-11-10 17:51:19 +00:00
|
|
|
*
|
2017-10-04 23:09:12 +00:00
|
|
|
* @param {string} key - [description]
|
2017-11-10 17:51:19 +00:00
|
|
|
*
|
2017-10-04 23:09:12 +00:00
|
|
|
* @return {Phaser.Cache.BaseCache} [description]
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
addCustom: function (key)
|
|
|
|
{
|
|
|
|
if (!this.custom.hasOwnProperty(key))
|
|
|
|
{
|
|
|
|
this.custom[key] = new BaseCache();
|
|
|
|
|
|
|
|
return this.custom[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2018-01-16 16:30:11 +00:00
|
|
|
module.exports = CacheManager;
|