2017-06-30 14:47:51 +00:00
|
|
|
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-11-10 17:51:19 +00:00
|
|
|
*
|
2017-10-04 23:09:12 +00:00
|
|
|
* @param {Phaser.Game} game - [description]
|
|
|
|
*/
|
2017-06-30 14:47:51 +00:00
|
|
|
function GlobalCache (game)
|
|
|
|
{
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* [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]
|
|
|
|
*
|
|
|
|
* @method Phaser.Cache.GlobalCache#addCustom
|
|
|
|
* @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];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = GlobalCache;
|