mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
Merge pull request #210 from cocoademon/skip_pixi_updates
Skip preupdate/update for PIXI hierarchies in which an ancestor doesn't exist
This commit is contained in:
+11
-4
@@ -72,24 +72,31 @@ Phaser.World.prototype.boot = function () {
|
||||
Phaser.World.prototype.update = function () {
|
||||
|
||||
this.currentRenderOrderID = 0;
|
||||
|
||||
|
||||
if (this.game.stage._stage.first._iNext)
|
||||
{
|
||||
var currentNode = this.game.stage._stage.first._iNext;
|
||||
var skipChildren = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (currentNode['preUpdate'])
|
||||
{
|
||||
currentNode.preUpdate();
|
||||
skipChildren = (currentNode.preUpdate() == false);
|
||||
}
|
||||
|
||||
if (currentNode['update'])
|
||||
{
|
||||
currentNode.update();
|
||||
skipChildren = (currentNode.update() == false) || skipChildren;
|
||||
}
|
||||
|
||||
currentNode = currentNode._iNext;
|
||||
if(skipChildren)
|
||||
{
|
||||
currentNode = currentNode.last._iNext;
|
||||
} else {
|
||||
currentNode = currentNode._iNext;
|
||||
}
|
||||
|
||||
}
|
||||
while (currentNode != this.game.stage._stage.last._iNext)
|
||||
}
|
||||
|
||||
@@ -361,7 +361,9 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
||||
if (!this.exists || (this.group && !this.group.exists))
|
||||
{
|
||||
this.renderOrderID = -1;
|
||||
return;
|
||||
|
||||
// Skip children if not exists
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.lifespan > 0)
|
||||
@@ -371,7 +373,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
||||
if (this.lifespan <= 0)
|
||||
{
|
||||
this.kill();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,6 +401,8 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
||||
this.body.preUpdate();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user