From 161db2dc517297bfc90fd14771bad41ad1bb1be8 Mon Sep 17 00:00:00 2001 From: Mashy Date: Fri, 22 Feb 2019 15:25:36 +1000 Subject: [PATCH] testing instance join --- client/src/scenes/menu.navigation.js | 6 ++++++ client/src/socket.js | 10 ++++++++++ 2 files changed, 16 insertions(+) mode change 100644 => 100755 client/src/scenes/menu.navigation.js mode change 100644 => 100755 client/src/socket.js diff --git a/client/src/scenes/menu.navigation.js b/client/src/scenes/menu.navigation.js old mode 100644 new mode 100755 index 234cc270..7c57fda5 --- a/client/src/scenes/menu.navigation.js +++ b/client/src/scenes/menu.navigation.js @@ -27,6 +27,12 @@ class MenuNavigation extends Phaser.Scene { .text(play.getCenter().x, play.getCenter().y, 'Play Cryps', TEXT.HEADER) .setOrigin(0.5, 0.5); play.on('pointerdown', () => { + const cryps = this.registry.get('cryps'); + const crypJoinList = [0, 0, 0]; + for (let i = 0; i <= 2; i += 1) { + crypJoinList[i] = cryps[i].id; + } + ws.sendInstanceJoin(crypJoinList); this.selectMode(ws); play.destroy(); playText.destroy(); diff --git a/client/src/socket.js b/client/src/socket.js old mode 100644 new mode 100755 index 249a183f..fb1a0bb0 --- a/client/src/socket.js +++ b/client/src/socket.js @@ -81,6 +81,10 @@ function createSocket(events) { send({ method: 'cryp_unspec', params: { id, spec } }); } + function sendPlayerCrypsSet(instanceId) { + send({ method: 'player_cryps_set', params: { instance_id: instanceId } }); + } + function sendPlayerState(instanceId) { send({ method: 'player_state', params: { instance_id: instanceId } }); } @@ -132,6 +136,10 @@ function createSocket(events) { send({ method: 'zone_close', params: { zone_id: zoneId } }); } + function sendInstanceJoin(cryps) { + send({ method: 'instance_join', params: { cryp_ids: cryps } }); + } + // ------------- // Incoming @@ -280,6 +288,8 @@ function createSocket(events) { sendZoneCreate, sendZoneJoin, sendZoneClose, + sendInstanceJoin, + sendPlayerCrypsSet, sendPlayerState, sendVboxAccept, sendVboxApply,