no more scene restarts monkaS

This commit is contained in:
ntr 2018-11-19 23:15:49 +11:00
parent d4bcaa244c
commit 7c74018dbf

View File

@ -9,16 +9,14 @@ class CrypList extends Phaser.Scene {
create() { create() {
this.registry.events.on('changedata', this.updateData, this); this.registry.events.on('changedata', this.updateData, this);
const cryps = this.registry.get('cryps');
this.graphics = this.add.graphics(); this.graphics = this.add.graphics();
this.renderCryps(cryps);
return true; return true;
} }
updateData(parent, key, data) { updateData(parent, key, data) {
if (key === 'cryps') { if (key === 'cryps') {
return this.scene.restart(); this.renderCryps(data);
} }
return true; return true;
} }
@ -32,14 +30,14 @@ class CrypList extends Phaser.Scene {
this.destroyText(); this.destroyText();
this.graphics.clear(); this.graphics.clear();
const crypRows = cryps.forEach((cryp, i) => { cryps.forEach((cryp, i) => {
crypRow(this, cryp, i); crypRow(this, cryp, i);
}); });
this.input.on('gameobjectup', this.clickHandler, this); this.input.on('gameobjectup', this.clickHandler, this);
// seal the boxes in and stop rerendering them // seal the boxes in and stop rerendering them
// this.graphics.generateTexture(); this.graphics.generateTexture();
return true; return true;
} }