mirror of
https://github.com/wassname/phaser.git
synced 2026-07-28 11:23:50 +08:00
Add a postUpdate function to plugins, which is called after World.postUpdate
This commit is contained in:
@@ -77,6 +77,12 @@ Phaser.PluginManager.prototype = {
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (typeof plugin['postUpdate'] === 'function')
|
||||
{
|
||||
plugin.hasPostUpdate = true;
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (typeof plugin['render'] === 'function')
|
||||
{
|
||||
plugin.hasRender = true;
|
||||
@@ -176,6 +182,30 @@ Phaser.PluginManager.prototype = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* PostUpdate is the last thing to be called before the world render.
|
||||
* In particular, it is called after the world postUpdate, which means the camera has been adjusted.
|
||||
* It only calls plugins who have active=true.
|
||||
*
|
||||
* @method Phaser.PluginManager#postUpdate
|
||||
*/
|
||||
postUpdate: function () {
|
||||
|
||||
if (this._pluginsLength == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (this._p = 0; this._p < this._pluginsLength; this._p++)
|
||||
{
|
||||
if (this.plugins[this._p].active && this.plugins[this._p].hasPostUpdate)
|
||||
{
|
||||
this.plugins[this._p].postUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Render is called right after the Game Renderer completes, but before the State.render.
|
||||
* It only calls plugins who have visible=true.
|
||||
|
||||
Reference in New Issue
Block a user