instance game
This commit is contained in:
@@ -42,6 +42,7 @@ function registerEvents(registry, events, tutorial) {
|
||||
}
|
||||
|
||||
function setPlayer(player) {
|
||||
registry.set('player', player);
|
||||
if (!registry.get('inMenu')) {
|
||||
setMenu();
|
||||
setCryps(player.cryps);
|
||||
|
||||
@@ -16,7 +16,8 @@ class MenuNavigation extends Phaser.Scene {
|
||||
}
|
||||
|
||||
create() {
|
||||
// const ws = this.registry.get('ws');
|
||||
const ws = this.registry.get('ws');
|
||||
const player = this.registry.get('player');
|
||||
this.cameras.main.setViewport(X, Y, WIDTH, HEIGHT);
|
||||
|
||||
const ready = this.add
|
||||
@@ -27,18 +28,19 @@ class MenuNavigation extends Phaser.Scene {
|
||||
.text(ready.getCenter().x, ready.getCenter().y, 'Ready', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
ready.on('pointerdown', () => {
|
||||
// Put player in game
|
||||
console.log(player);
|
||||
ws.sendInstanceReady(player.instance);
|
||||
});
|
||||
|
||||
const leave = this.add
|
||||
.rectangle(BTN_WIDTH * 3, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x440000)
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => this.registry.set('home', true));
|
||||
// const leave = this.add
|
||||
// .rectangle(BTN_WIDTH * 3, BTN_HEIGHT, BTN_WIDTH, BTN_HEIGHT, 0x440000)
|
||||
// .setInteractive()
|
||||
// .setOrigin(0)
|
||||
// .on('pointerdown', () => this.registry.set('home', true));
|
||||
|
||||
this.add
|
||||
.text(leave.getCenter().x, leave.getCenter().y, 'Leave', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
// this.add
|
||||
// .text(leave.getCenter().x, leave.getCenter().y, 'Leave', TEXT.HEADER)
|
||||
// .setOrigin(0.5, 0.5);
|
||||
}
|
||||
|
||||
cleanUp() {
|
||||
|
||||
@@ -141,9 +141,12 @@ function createSocket(events) {
|
||||
}
|
||||
|
||||
function sendInstanceJoin(cryps) {
|
||||
send({ method: 'instance_join', params: { cryp_ids: cryps } });
|
||||
send({ method: 'instance_join', params: { cryp_ids: cryps, pve: true } });
|
||||
}
|
||||
|
||||
function sendInstanceReady(instanceId) {
|
||||
send({ method: 'instance_ready', params: { instance_id: instanceId } });
|
||||
}
|
||||
|
||||
// -------------
|
||||
// Incoming
|
||||
@@ -295,6 +298,7 @@ function createSocket(events) {
|
||||
sendZoneJoin,
|
||||
sendZoneClose,
|
||||
sendInstanceJoin,
|
||||
sendInstanceReady,
|
||||
sendPlayerCrypsSet,
|
||||
sendPlayerState,
|
||||
sendVboxAccept,
|
||||
|
||||
Reference in New Issue
Block a user