vbox init

This commit is contained in:
ntr
2019-02-16 17:45:28 +11:00
parent 8f12075d52
commit d0525a56bd
11 changed files with 241 additions and 40 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ function renderCryps() {
},
},
scene: [
Background,
// Background,
Header,
],
};
+2 -1
View File
@@ -25,6 +25,7 @@ const MAIN_MENU_SCENES = [
'ItemInfo',
];
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
class Menu extends Phaser.Scene {
constructor() {
@@ -37,7 +38,7 @@ class Menu extends Phaser.Scene {
// When we load the menu request the latest items
// Item list will restart when the data comes in
this.registry.get('ws').sendAccountItems();
this.registry.get('ws').sendVboxState(NULL_UUID);
this.scene.manager.add('MenuCrypList', MenuCrypList, true);
this.scene.manager.add('MenuNavigation', MenuNavigation, true);
+6 -11
View File
@@ -1,6 +1,7 @@
const toast = require('izitoast');
const cbor = require('borc');
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://cryps.gg/ws' : 'ws://localhost:40000';
function errorToast(err) {
@@ -44,10 +45,6 @@ function createSocket(events) {
send({ method: 'account_cryps', params: {} });
}
function sendAccountItems() {
send({ method: 'account_items', params: {} });
}
function sendAccountZone() {
send({ method: 'account_zone', params: {} });
}
@@ -88,6 +85,10 @@ function createSocket(events) {
send({ method: 'cryp_unspec', params: { id, spec } });
}
function sendVboxState(gameId) {
send({ method: 'vbox_state', params: { game_id: gameId } });
}
function sendPressR() {
send({ method: 'press_r', params: { } });
@@ -162,11 +163,6 @@ function createSocket(events) {
const [structName, game] = response;
}
function accountItems(response) {
const [structName, items] = response;
events.setItems(items);
}
function zoneState(response) {
const [structName, zone] = response;
events.setZone(zone);
@@ -188,7 +184,6 @@ function createSocket(events) {
account_login: accountLogin,
account_create: accountLogin,
account_cryps: accountCryps,
account_items: accountItems,
zone_create: res => console.log(res),
zone_state: zoneState,
zone_close: res => console.log(res),
@@ -268,7 +263,6 @@ function createSocket(events) {
sendAccountCreate,
sendAccountDemo,
sendAccountCryps,
sendAccountItems,
sendAccountZone,
sendGameState,
sendGamePve,
@@ -285,6 +279,7 @@ function createSocket(events) {
sendZoneCreate,
sendZoneJoin,
sendZoneClose,
sendVboxState,
connect,
};
}