Misc frontend fixes

This commit is contained in:
Mashy
2019-01-03 10:48:26 +10:00
parent af29d1c959
commit d9645b7a1d
3 changed files with 23 additions and 14 deletions
+17 -9
View File
@@ -36,16 +36,9 @@ class StatSheet extends Phaser.Scene {
this.registry.events.on('changedata', this.updateData, this);
this.cryp = cryp;
this.forget = false;
const crypStat = (stat, i) => {
const STAT_X = WIDTH / 10;
const STAT_Y = (i + 1) * TEXT_MARGIN;
this.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL);
};
const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg];
this.add.text(WIDTH / 10, 0, cryp.name, TEXT.HEADER);
CRYP_STATS.forEach(crypStat);
this.addStats(cryp);
this.addKnownSkills(cryp);
this.addLearnableSkills(cryp);
this.addControls();
@@ -56,9 +49,24 @@ class StatSheet extends Phaser.Scene {
const cryp = data.find(c => c.id === this.cryp.id);
this.cryp = cryp;
this.addKnownSkills(cryp);
this.addStats(cryp);
}
}
addStats(cryp) {
if (this.stats) this.stats.destroy(true);
this.stats = this.add.group();
const crypStat = (stat, i) => {
const STAT_X = WIDTH / 10;
const STAT_Y = (i + 1) * TEXT_MARGIN;
this.stats.add(this.add
.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL));
};
const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg];
CRYP_STATS.forEach(crypStat);
}
addControls() {
const infoCback = () => {
this.forget = false;