show cryp stats on main page

This commit is contained in:
ntr 2018-12-11 15:20:25 +11:00
parent 09c0a624d9
commit c8fb2a2751
2 changed files with 14 additions and 3 deletions

View File

@ -1,6 +1,6 @@
const Phaser = require('phaser'); const Phaser = require('phaser');
const { TEXT, COLOURS, POSITIONS: { CRYP_LIST, MENU } } = require('./constants'); const { TEXT, COLOURS, POSITIONS: { CRYP_LIST, MENU, STATS } } = require('./constants');
const TEXT_MARGIN = 24; const TEXT_MARGIN = 24;
@ -45,9 +45,20 @@ class CrypRows extends Phaser.GameObjects.Group {
row.cryp = cryp; row.cryp = cryp;
this.add(row); this.add(row);
const crypStat = (stat, j) => {
const STAT_X = 0;
const STAT_Y = (j * TEXT_MARGIN) + ROW_Y + TEXT_MARGIN;
const text = list.add.text(STAT_X, STAT_Y, `${stat.stat}: ${stat.base}`, TEXT.NORMAL);
this.add(text);
};
const CRYP_STATS = [cryp.stamina, cryp.phys_dmg, cryp.spell_dmg];
CRYP_STATS.forEach(crypStat);
this.add(list.add.text(ROW_WIDTH - 20, ROW_Y, i + 1, TEXT.HEADER)); this.add(list.add.text(ROW_WIDTH - 20, ROW_Y, i + 1, TEXT.HEADER));
this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER)); this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 0), cryp.name, TEXT.HEADER));
this.add(list.add.text(ROW_X, ROW_Y + (TEXT_MARGIN * 1), cryp.stamina.base, TEXT.NORMAL));
}); });
return true; return true;
} }

View File

@ -186,7 +186,7 @@ function createSocket(events) {
if (!account) events.loginPrompt(); if (!account) events.loginPrompt();
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
// send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } }); send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } });
} }
return true; return true;