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

View File

@ -77,7 +77,7 @@ class CombatHitBox extends Phaser.Scene {
this.add.existing(new CrypHitBox(this, crypSpawn.iter, team, cback));
});
});
this.scene.sendToBack();
this.scene.moveBelow('Combat');
}
cleanUp() {

View File

@ -43,7 +43,7 @@ class Item extends Phaser.GameObjects.Container {
this.origY = y;
this.box = scene.add
.rectangle(0, 0, ITEM_WIDTH, ITEM_HEIGHT, 0x111111);
.rectangle(0, 0, ITEM_WIDTH, ITEM_HEIGHT, 0x222222);
this.text = scene.add
.text(0, 0, item.action, TEXT.HEADER)
@ -78,7 +78,7 @@ class Item extends Phaser.GameObjects.Container {
}
deselect() {
this.box.setFillStyle(0x111111);
this.box.setFillStyle(0x222222);
this.state = 'deselect';
}
}
@ -104,10 +104,11 @@ class ItemList extends Phaser.Scene {
this.registry.events.on('setdata', this.updateData, this);
if (!itemList) return false;
this.add.text(WIDTH / 4, HEIGHT / 4, 'Inventory', TEXT.HEADER);
itemList.forEach((item, i) => {
const ITEM_X = ITEM_WIDTH;
const ITEM_Y = ITEM_HEIGHT * 1.2 * (i + 1);
const ITEM_Y = ITEM_HEIGHT * 1.2 * i + HEIGHT / 2.5;
const itemBox = new Item(this, item, ITEM_X, ITEM_Y);
this.input.setDraggable(itemBox);

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;