From b20b3422a3394042abfea94391bb4932c7ddebca Mon Sep 17 00:00:00 2001 From: Mashy Date: Wed, 2 Jan 2019 11:37:32 +1000 Subject: [PATCH] Statsheet and item request --- client/src/scenes/menu.js | 4 ++++ client/src/scenes/statsheet.js | 9 +-------- client/src/socket.js | 1 - 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/client/src/scenes/menu.js b/client/src/scenes/menu.js index 316a12fa..2456f98d 100644 --- a/client/src/scenes/menu.js +++ b/client/src/scenes/menu.js @@ -13,6 +13,10 @@ class Menu extends Phaser.Scene { this.registry.events.on('changedata', this.updateData, this); this.registry.events.on('setdata', this.updateData, this); + // When we load the menu request the latest items + // Item list will restart when the data comes in + this.registry.get('ws').sendAccountItems(); + this.scene.manager.add('MenuCrypList', MenuCrypList, true); this.scene.manager.add('MenuNavigation', MenuNavigation, true); this.scene.manager.add('ItemList', ItemList, true); diff --git a/client/src/scenes/statsheet.js b/client/src/scenes/statsheet.js index d8a97944..cfdb0fbe 100644 --- a/client/src/scenes/statsheet.js +++ b/client/src/scenes/statsheet.js @@ -6,7 +6,6 @@ const Y = MENU_MAIN.y(); const WIDTH = MENU_MAIN.width(); const HEIGHT = MENU_MAIN.height(); const TEXT_MARGIN = 24; -const LEARN_MAGIN = 12; const menuX = WIDTH / 10; const menuY = HEIGHT * 0.8; @@ -48,6 +47,7 @@ class StatSheet extends Phaser.Scene { this.add.text(WIDTH / 10, 0, cryp.name, TEXT.HEADER); CRYP_STATS.forEach(crypStat); this.addKnownSkills(cryp); + this.addLearnableSkills(cryp); this.addControls(); } @@ -63,20 +63,13 @@ class StatSheet extends Phaser.Scene { const infoCback = () => { this.forget = false; this.addKnownSkills(this.cryp); - if (this.learnSkills) this.learnSkills.destroy(true); }; const forgetCback = () => { this.forget = true; this.addKnownSkills(this.cryp); }; - const learnCback = () => { - this.forget = false; - this.addKnownSkills(this.cryp); - this.addLearnableSkills(this.cryp); - }; addButton(this, menuX, menuY, infoCback, 'Skill\nInfo'); addButton(this, menuX + menuWidth * 1.1, menuY, forgetCback, 'Forget\nSkills'); - addButton(this, menuX + menuWidth * 2.2, menuY, learnCback, 'Learn\nSkills'); } addKnownSkills(cryp) { diff --git a/client/src/socket.js b/client/src/socket.js index bdeb9ce4..313966f6 100644 --- a/client/src/socket.js +++ b/client/src/socket.js @@ -125,7 +125,6 @@ function createSocket(events) { account = login; events.setAccount(login); - sendAccountItems(); sendAccountCryps(); sendGameJoinableList(); }