From d9645b7a1d3f96964bc60b18e9759c7c63f6e14f Mon Sep 17 00:00:00 2001 From: Mashy Date: Thu, 3 Jan 2019 10:48:26 +1000 Subject: [PATCH] Misc frontend fixes --- client/src/scenes/combat.hitbox.js | 2 +- client/src/scenes/item.list.js | 9 +++++---- client/src/scenes/statsheet.js | 26 +++++++++++++++++--------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/client/src/scenes/combat.hitbox.js b/client/src/scenes/combat.hitbox.js index f099c96b..7a2e9b7f 100644 --- a/client/src/scenes/combat.hitbox.js +++ b/client/src/scenes/combat.hitbox.js @@ -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() { diff --git a/client/src/scenes/item.list.js b/client/src/scenes/item.list.js index 80d17f2b..2cdd78ae 100644 --- a/client/src/scenes/item.list.js +++ b/client/src/scenes/item.list.js @@ -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); diff --git a/client/src/scenes/statsheet.js b/client/src/scenes/statsheet.js index cfdb0fbe..485af1d1 100644 --- a/client/src/scenes/statsheet.js +++ b/client/src/scenes/statsheet.js @@ -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;