addex vbox scene

This commit is contained in:
Mashy
2019-02-16 20:32:18 +10:00
parent 08e48d983e
commit 71d317c985
4 changed files with 48 additions and 3 deletions
View File
+3
View File
@@ -10,6 +10,7 @@ const GameList = require('./game.list');
const StatSheet = require('./statsheet');
const SpecSheet = require('./specsheet');
const ItemInfo = require('./item.info');
const Vbox = require('./vbox');
const FIXED_MENU_SCENES = [
'MenuCrypList',
@@ -23,6 +24,7 @@ const MAIN_MENU_SCENES = [
'StatSheet',
'SpecSheet',
'ItemInfo',
'Vbox',
];
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
@@ -57,6 +59,7 @@ class Menu extends Phaser.Scene {
case 'crypStats': return this.newMainScene('StatSheet', StatSheet, data);
case 'crypSpec': return this.newMainScene('SpecSheet', SpecSheet, data);
case 'itemInfo': return this.newMainScene('ItemInfo', ItemInfo, data);
case 'vbox': return this.newMainScene('Vbox', Vbox, data);
default: return false;
}
}
+36
View File
@@ -0,0 +1,36 @@
const Phaser = require('phaser');
const { POSITIONS: { MENU_MAIN }, TEXT } = require('./constants');
const X = MENU_MAIN.x();
const Y = MENU_MAIN.y();
const WIDTH = MENU_MAIN.width();
const HEIGHT = MENU_MAIN.height();
class Vbox extends Phaser.Scene {
constructor() {
super({ key: 'Vbox' });
}
create(vbox) {
this.cameras.main.setViewport(X, Y, WIDTH, HEIGHT);
this.add.text(WIDTH / 10, 0, 'VariBox', TEXT.HEADER)
const drawItem = (item, i) => {
this.add
.text(WIDTH / 10, 25 * (i + 2), item, TEXT.NORMAL)
.setInteractive()
.on('pointerdown', () => {
this.registry.get('ws').sendVboxAccept(vbox.game, i);
console.log(item);
});
;
};
vbox.free.forEach(drawItem);
}
cleanUp() {
this.scene.remove();
}
}
module.exports = Vbox;