Registry added.

This commit is contained in:
Richard Davey 2017-01-30 00:00:45 +00:00
parent efa5f8a012
commit 98a6d282ba
2 changed files with 13 additions and 0 deletions

View file

@ -16,6 +16,7 @@ var MainLoop = require('./MainLoop');
var CreateRenderer = require('./CreateRenderer');
var StateManager = require('../state/StateManager');
var TextureManager = require('../textures/TextureManager');
var Data = require('../components/Data');
var Game = function (config)
{
@ -44,6 +45,11 @@ var Game = function (config)
*/
// this.cache = new Cache();
/**
* @property {Phaser.Data} registry - Game wide data store.
*/
this.registry = new Data(this);
/**
* @property {Phaser.Input} input - Reference to the input manager
*/

View file

@ -4,6 +4,9 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var Event = require('../events/Event');
var EventDispatcher = require('../events/EventDispatcher');
/**
* The Data Component features a means to store pieces of data specific to a Game Object,
* search it, query it, and retrieve it.
@ -14,6 +17,8 @@ var Data = function (parent)
{
this.parent = parent;
this.events = new EventDispatcher();
this.list = {};
this._beforeCallbacks = {};
@ -82,6 +87,8 @@ Data.prototype = {
}
}
this.events.dispatch(new Event.LOADER_START_EVENT(this));
this.list[key] = data;
// If there is a 'after' callback, then check it for a result