phaser/src/cache/GlobalCache.js

150 lines
3.1 KiB
JavaScript
Raw Normal View History

var BaseCache = require('./BaseCache');
var Class = require('../utils/Class');
var GlobalCache = new Class({
initialize:
2017-10-04 23:09:12 +00:00
/**
* [description]
*
* @class GlobalCache
* @memberOf Phaser.Cache
* @constructor
* @since 3.0.0
*
2017-10-04 23:09:12 +00:00
* @param {Phaser.Game} game - [description]
*/
function GlobalCache (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]
*
* @method Phaser.Cache.GlobalCache#addCustom
* @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];
}
}
});
module.exports = GlobalCache;