clean up text
This commit is contained in:
parent
6907cf17e0
commit
d4bcaa244c
@ -23,8 +23,14 @@ class CrypList extends Phaser.Scene {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyText() {
|
||||||
|
this.children.list.filter(c => c.type === 'Text').forEach(t => t.destroy());
|
||||||
|
}
|
||||||
|
|
||||||
renderCryps(cryps) {
|
renderCryps(cryps) {
|
||||||
if (!cryps) return true;
|
if (!cryps) return true;
|
||||||
|
this.destroyText();
|
||||||
|
this.graphics.clear();
|
||||||
|
|
||||||
const crypRows = cryps.forEach((cryp, i) => {
|
const crypRows = cryps.forEach((cryp, i) => {
|
||||||
crypRow(this, cryp, i);
|
crypRow(this, cryp, i);
|
||||||
@ -33,12 +39,13 @@ class CrypList extends Phaser.Scene {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
clickHandler(pointer, crypBox) {
|
clickHandler(pointer, crypBox) {
|
||||||
|
console.log(crypBox);
|
||||||
this.registry.set('activeCryp', crypBox.cryp);
|
this.registry.set('activeCryp', crypBox.cryp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,13 +34,18 @@ class CrypPage extends Phaser.Scene {
|
|||||||
|
|
||||||
updateData(parent, key, data) {
|
updateData(parent, key, data) {
|
||||||
if (key === 'activeCryp') {
|
if (key === 'activeCryp') {
|
||||||
return this.scene.restart();
|
this.renderCryp(data);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
destroyText() {
|
||||||
|
this.children.list.filter(c => c.type === 'Text').forEach(t => t.destroy());
|
||||||
|
}
|
||||||
|
|
||||||
renderCryp(cryp) {
|
renderCryp(cryp) {
|
||||||
if (!cryp) return true;
|
if (!cryp) return true;
|
||||||
|
this.destroyText();
|
||||||
|
|
||||||
this.add.text(500, 500, cryp.name, { fontFamily: 'Arial', fontSize: 24, color: '#ffffff', fontStyle: 'bold' });
|
this.add.text(500, 500, cryp.name, { fontFamily: 'Arial', fontSize: 24, color: '#ffffff', fontStyle: 'bold' });
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user