Statsheet and item request

This commit is contained in:
Mashy 2019-01-02 11:37:32 +10:00
parent d31c8775d6
commit b20b3422a3
3 changed files with 5 additions and 9 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -125,7 +125,6 @@ function createSocket(events) {
account = login;
events.setAccount(login);
sendAccountItems();
sendAccountCryps();
sendGameJoinableList();
}