Changed click handlers

This commit is contained in:
Mashy 2018-11-20 16:22:28 +10:00
parent 6c04a03145
commit d0292f8f05
2 changed files with 4 additions and 7 deletions

View File

@ -10,7 +10,6 @@ class CrypList extends Phaser.Scene {
create() {
this.registry.events.on('changedata', this.updateData, this);
this.input.on('gameobjectup', this.clickHandler, this);
return true;
}
@ -33,12 +32,7 @@ class CrypList extends Phaser.Scene {
}
this.CrypPage = new CrypPage(this, cryp);
}
}
clickHandler(pointer, crypBox) {
this.displaySkills(crypBox.cryp);
return true;
// this.registry.get('ws').sendGamePve(crypBox.cryp.id);
}
}

View File

@ -16,14 +16,17 @@ const yPos = i => (i * ROW_HEIGHT + ROW_MARGIN) + TOP_MARGIN;
class CrypRow extends Phaser.GameObjects.Group {
constructor(list, cryps) {
super(list);
this.cryps = cryps;
cryps.forEach((cryp, i) => {
const X_ORIGIN = xPos(i);
const Y_ORIGIN = yPos(i);
const row = list.add.rectangle(X_ORIGIN, Y_ORIGIN, ROW_WIDTH, ROW_HEIGHT, ROW_FILL * Math.random())
.setInteractive()
.setOrigin(0);
row.cryp = cryp;
row.on('pointerdown', () => {
list.displaySkills(cryp);
});
this.add(row);
this.add(list.add.text(X_ORIGIN, Y_ORIGIN + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER));
this.add(list.add.text(X_ORIGIN, Y_ORIGIN + (TEXT_MARGIN * 1), cryp.stamina.base, TEXT.NORMAL));