Skip to content

Commit 5100239

Browse files
committed
1.2.0
1 parent 74cc321 commit 5100239

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

dist/display-list-watcher.es.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const GetObjectDescription = (obj, precision = 1) => {
1818
count = obj.children.list.length;
1919
} else if (type === "ParticleEmitter") {
2020
count = obj.getParticleCount();
21+
} else if (type === "SpriteGPULayer") {
22+
count = obj.memberCount;
23+
} else if (type === "TilemapLayer" || type === "TilemapGPULayer") {
24+
count = obj.tilesTotal;
2125
} else if (obj.list) {
2226
count = obj.list.length;
2327
}
@@ -66,6 +70,7 @@ const WalkDisplayListObj = (obj, output = [], currentDepth = 0, maxDepth = 10, m
6670
const { POSITIVE_INFINITY } = Number;
6771
const TextureEvents = Phaser.Textures.Events;
6872
const CacheEvents = Phaser.Cache.Events;
73+
const CoreEvents = Phaser.Core.Events;
6974
const KeyboardEvents = Phaser.Input.Keyboard.Events;
7075
const SceneEvents = Phaser.Scenes.Events;
7176
const { KeyCodes } = Phaser.Input.Keyboard;
@@ -124,6 +129,7 @@ class DisplayListWatcher extends Phaser.Plugins.ScenePlugin {
124129
this.start();
125130
}
126131
start() {
132+
const { game } = this;
127133
const { cache, events, input, make, renderer } = this.systems;
128134
const fontCache = cache.bitmapFont;
129135
const keyboard = input == null ? void 0 : input.keyboard;
@@ -132,7 +138,7 @@ class DisplayListWatcher extends Phaser.Plugins.ScenePlugin {
132138
fontCache.events.on(CacheEvents.ADD, this.onFontCacheAdded, this);
133139
return;
134140
}
135-
events.on(SceneEvents.RENDER, this.render, this);
141+
game.events.on(CoreEvents.POST_RENDER, this.render, this);
136142
this.camera = new Phaser.Cameras.Scene2D.Camera(0, 0, width, height).setBounds(0, 0, POSITIVE_INFINITY, POSITIVE_INFINITY).setRoundPixels(true);
137143
if (keyboard) {
138144
events.on(SceneEvents.UPDATE, this.update, this);
@@ -142,11 +148,12 @@ class DisplayListWatcher extends Phaser.Plugins.ScenePlugin {
142148
this.renderText = renderer.type === Phaser.WEBGL ? this.text.renderWebGL : this.text.renderCanvas;
143149
}
144150
stop() {
151+
const { game } = this;
145152
const { cache, events, input, settings } = this.systems;
146153
const keyboard = input == null ? void 0 : input.keyboard;
147154
cache.bitmapFont.events.off(CacheEvents.ADD, this.onFontCacheAdded, this);
148155
events.off(SceneEvents.UPDATE, this.update, this);
149-
events.off(SceneEvents.RENDER, this.render, this);
156+
game.events.off(CoreEvents.POST_RENDER, this.render, this);
150157
if (keyboard) {
151158
keyboard.off(KeyboardEvents.ANY_KEY_DOWN, this.onAnyKeyDown, this);
152159
}

dist/display-list-watcher.umd.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
count = obj.children.list.length;
2222
} else if (type === "ParticleEmitter") {
2323
count = obj.getParticleCount();
24+
} else if (type === "SpriteGPULayer") {
25+
count = obj.memberCount;
26+
} else if (type === "TilemapLayer" || type === "TilemapGPULayer") {
27+
count = obj.tilesTotal;
2428
} else if (obj.list) {
2529
count = obj.list.length;
2630
}
@@ -69,6 +73,7 @@
6973
const { POSITIVE_INFINITY } = Number;
7074
const TextureEvents = Phaser.Textures.Events;
7175
const CacheEvents = Phaser.Cache.Events;
76+
const CoreEvents = Phaser.Core.Events;
7277
const KeyboardEvents = Phaser.Input.Keyboard.Events;
7378
const SceneEvents = Phaser.Scenes.Events;
7479
const { KeyCodes } = Phaser.Input.Keyboard;
@@ -127,6 +132,7 @@
127132
this.start();
128133
}
129134
start() {
135+
const { game } = this;
130136
const { cache, events, input, make, renderer } = this.systems;
131137
const fontCache = cache.bitmapFont;
132138
const keyboard = input == null ? void 0 : input.keyboard;
@@ -135,7 +141,7 @@
135141
fontCache.events.on(CacheEvents.ADD, this.onFontCacheAdded, this);
136142
return;
137143
}
138-
events.on(SceneEvents.RENDER, this.render, this);
144+
game.events.on(CoreEvents.POST_RENDER, this.render, this);
139145
this.camera = new Phaser.Cameras.Scene2D.Camera(0, 0, width, height).setBounds(0, 0, POSITIVE_INFINITY, POSITIVE_INFINITY).setRoundPixels(true);
140146
if (keyboard) {
141147
events.on(SceneEvents.UPDATE, this.update, this);
@@ -145,11 +151,12 @@
145151
this.renderText = renderer.type === Phaser.WEBGL ? this.text.renderWebGL : this.text.renderCanvas;
146152
}
147153
stop() {
154+
const { game } = this;
148155
const { cache, events, input, settings } = this.systems;
149156
const keyboard = input == null ? void 0 : input.keyboard;
150157
cache.bitmapFont.events.off(CacheEvents.ADD, this.onFontCacheAdded, this);
151158
events.off(SceneEvents.UPDATE, this.update, this);
152-
events.off(SceneEvents.RENDER, this.render, this);
159+
game.events.off(CoreEvents.POST_RENDER, this.render, this);
153160
if (keyboard) {
154161
keyboard.off(KeyboardEvents.ANY_KEY_DOWN, this.onAnyKeyDown, this);
155162
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "phaser-plugin-display-list-watcher",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Shows the scene display lists",
55
"keywords": [
66
"phaser",

0 commit comments

Comments
 (0)