phaser/src/cache/CacheManager.js

150 lines
3.1 KiB
JavaScript
Raw Normal View History

var BaseCache = require('./BaseCache');
var Class = require('../utils/Class');
2018-01-16 16:30:11 +00:00
var CacheManager = new Class({
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-10-04 23:09:12 +00:00
* @param {Phaser.Game} game - [description]
*/
2018-01-16 16:30:11 +00:00
function CacheManager (game)
{
2017-10-04 23:09:12 +00:00
/**
* [description]
*
* @property {Phaser.Game} game
* @protected
*/
this.game = game;
2017-10-04 23:09:12 +00:00
/**
* [description]
*
* @property {Phaser.Cache.BaseCache} binary
* @protected
*/
this.binary = new BaseCache();
2017-10-04 23:09:12 +00:00
/**
* [description]
*
* @property {Phaser.Cache.BaseCache} bitmapFont
* @protected
*/
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
*/
this.shader = new BaseCache();
2017-10-04 23:09:12 +00:00
/**
* [description]
*
* @property {Phaser.Cache.BaseCache} audio
2017-10-04 23:09:12 +00:00
* @protected
*/
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-10-04 23:09:12 +00:00
/**
* [description]
*
* @property {object.<Phaser.Cache.BaseCache>} custom
* @protected
*/
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-10-04 23:09:12 +00:00
* @param {string} key - [description]
*
2017-10-04 23:09:12 +00:00
* @return {Phaser.Cache.BaseCache} [description]
*/
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;