addex vbox scene
This commit is contained in:
parent
08e48d983e
commit
71d317c985
0
client/src/scenes/menu.cryps.list.js
Executable file → Normal file
0
client/src/scenes/menu.cryps.list.js
Executable file → Normal file
@ -10,6 +10,7 @@ const GameList = require('./game.list');
|
|||||||
const StatSheet = require('./statsheet');
|
const StatSheet = require('./statsheet');
|
||||||
const SpecSheet = require('./specsheet');
|
const SpecSheet = require('./specsheet');
|
||||||
const ItemInfo = require('./item.info');
|
const ItemInfo = require('./item.info');
|
||||||
|
const Vbox = require('./vbox');
|
||||||
|
|
||||||
const FIXED_MENU_SCENES = [
|
const FIXED_MENU_SCENES = [
|
||||||
'MenuCrypList',
|
'MenuCrypList',
|
||||||
@ -23,6 +24,7 @@ const MAIN_MENU_SCENES = [
|
|||||||
'StatSheet',
|
'StatSheet',
|
||||||
'SpecSheet',
|
'SpecSheet',
|
||||||
'ItemInfo',
|
'ItemInfo',
|
||||||
|
'Vbox',
|
||||||
];
|
];
|
||||||
|
|
||||||
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
|
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 'crypStats': return this.newMainScene('StatSheet', StatSheet, data);
|
||||||
case 'crypSpec': return this.newMainScene('SpecSheet', SpecSheet, data);
|
case 'crypSpec': return this.newMainScene('SpecSheet', SpecSheet, data);
|
||||||
case 'itemInfo': return this.newMainScene('ItemInfo', ItemInfo, data);
|
case 'itemInfo': return this.newMainScene('ItemInfo', ItemInfo, data);
|
||||||
|
case 'vbox': return this.newMainScene('Vbox', Vbox, data);
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
client/src/scenes/vbox.js
Normal file
36
client/src/scenes/vbox.js
Normal 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;
|
||||||
@ -94,7 +94,7 @@ function createSocket(events) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxAccept(gameId, i) {
|
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() {
|
function sendPressR() {
|
||||||
@ -140,7 +140,7 @@ function createSocket(events) {
|
|||||||
account = login;
|
account = login;
|
||||||
events.setAccount(login);
|
events.setAccount(login);
|
||||||
sendAccountCryps();
|
sendAccountCryps();
|
||||||
sendGameJoinableList();
|
// sendGameJoinableList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function accountCryps(response) {
|
function accountCryps(response) {
|
||||||
@ -171,6 +171,12 @@ function createSocket(events) {
|
|||||||
events.setZone(zone);
|
events.setZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vboxState(response) {
|
||||||
|
const [structName, vbox] = response;
|
||||||
|
console.log(vbox);
|
||||||
|
events.setVbox(vbox);
|
||||||
|
}
|
||||||
|
|
||||||
// -------------
|
// -------------
|
||||||
// Setup
|
// Setup
|
||||||
// -------------
|
// -------------
|
||||||
@ -190,7 +196,7 @@ function createSocket(events) {
|
|||||||
zone_create: res => console.log(res),
|
zone_create: res => console.log(res),
|
||||||
zone_state: zoneState,
|
zone_state: zoneState,
|
||||||
zone_close: res => console.log(res),
|
zone_close: res => console.log(res),
|
||||||
vbox_state: res => console.log(res),
|
vbox_state: vboxState,
|
||||||
};
|
};
|
||||||
|
|
||||||
function errHandler(error) {
|
function errHandler(error) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user