Merge branch 'combos' of ssh://cryps.gg:40022/~/cryps into combos

This commit is contained in:
ntr 2019-02-17 00:13:01 +11:00
commit cf038f9626
4 changed files with 48 additions and 3 deletions

0
client/src/scenes/menu.cryps.list.js Executable file → Normal file
View File

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
client/src/scenes/vbox.js Normal file
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;

View File

@ -94,7 +94,7 @@ function createSocket(events) {
}
function sendVboxAccept(gameId, i) {
send({ method: 'vbox_discard', params: { game_id: gameId, index: i } });
send({ method: 'vbox_accept', params: { game_id: gameId, index: i } });
}
function sendPressR() {
@ -140,7 +140,7 @@ function createSocket(events) {
account = login;
events.setAccount(login);
sendAccountCryps();
sendGameJoinableList();
// sendGameJoinableList();
}
function accountCryps(response) {
@ -171,6 +171,12 @@ function createSocket(events) {
events.setZone(zone);
}
function vboxState(response) {
const [structName, vbox] = response;
console.log(vbox);
events.setVbox(vbox);
}
// -------------
// Setup
// -------------
@ -190,7 +196,7 @@ function createSocket(events) {
zone_create: res => console.log(res),
zone_state: zoneState,
zone_close: res => console.log(res),
vbox_state: res => console.log(res),
vbox_state: vboxState,
};
function errHandler(error) {