Merge branch 'instances'
This commit is contained in:
@@ -160,7 +160,7 @@ class ItemList extends Phaser.Scene {
|
||||
.rectangle(WIDTH * 0.01, Y + HEIGHT * 0.775, ITEM_WIDTH * 1.25, ITEM_HEIGHT * 1.25, 0x222222)
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => this.registry.get('ws').sendVboxDiscard(vbox.game));
|
||||
.on('pointerdown', () => this.registry.get('ws').sendVboxDiscard(vbox.instance));
|
||||
this.add.text(reroll.getCenter().x, reroll.getCenter().y, 'Reroll', TEXT.HEADER)
|
||||
.setOrigin(0.5, 0.5);
|
||||
|
||||
@@ -169,7 +169,7 @@ class ItemList extends Phaser.Scene {
|
||||
.setInteractive()
|
||||
.setOrigin(0)
|
||||
.on('pointerdown', () => {
|
||||
ws.sendVboxCombine(vbox.game, this.combinerItems);
|
||||
ws.sendVboxCombine(vbox.instance, this.combinerItems);
|
||||
this.combinerItems = [-1, -1, -1];
|
||||
this.children.list.filter(obj => obj instanceof CombinerHitBox).forEach(cBox => cBox.deallocate());
|
||||
});
|
||||
@@ -201,7 +201,7 @@ class ItemList extends Phaser.Scene {
|
||||
itemBox
|
||||
.setInteractive()
|
||||
.on('pointerdown', () => {
|
||||
ws.sendVboxAccept(vbox.game, i);
|
||||
ws.sendVboxAccept(vbox.instance, i);
|
||||
});
|
||||
this.add.existing(itemBox);
|
||||
});
|
||||
@@ -277,8 +277,8 @@ class ItemList extends Phaser.Scene {
|
||||
return true;
|
||||
}
|
||||
// Allocate to cryp hitbox
|
||||
if (hitBox instanceof DeleteHitBox) ws.sendVboxDrop(vbox.game, item.index);
|
||||
else ws.sendVboxApply(vbox.game, hitBox.cryp.id, item.index);
|
||||
if (hitBox instanceof DeleteHitBox) ws.sendVboxDrop(vbox.instance, item.index);
|
||||
else ws.sendVboxApply(vbox.instance, hitBox.cryp.id, item.index);
|
||||
}
|
||||
// If the item hasn't been allocated deallocate the item
|
||||
// Scene will restart if there is vbox change
|
||||
|
||||
@@ -38,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').sendVboxState(NULL_UUID);
|
||||
this.registry.get('ws').sendPlayerState(NULL_UUID);
|
||||
|
||||
this.scene.manager.add('MenuCrypList', MenuCrypList, true);
|
||||
this.scene.manager.add('MenuNavigation', MenuNavigation, true);
|
||||
|
||||
+17
-18
@@ -85,29 +85,29 @@ function createSocket(events) {
|
||||
send({ method: 'cryp_unspec', params: { id, spec } });
|
||||
}
|
||||
|
||||
function sendVboxState(gameId) {
|
||||
send({ method: 'vbox_state', params: { game_id: gameId } });
|
||||
function sendPlayerState(instanceId) {
|
||||
send({ method: 'player_state', params: { instance_id: instanceId } });
|
||||
}
|
||||
|
||||
function sendVboxAccept(gameId, i) {
|
||||
send({ method: 'vbox_accept', params: { game_id: gameId, index: i } });
|
||||
function sendVboxAccept(instanceId, i) {
|
||||
send({ method: 'player_vbox_accept', params: { instance_id: instanceId, index: i } });
|
||||
}
|
||||
|
||||
function sendVboxApply(gameId, crypId, index) {
|
||||
send({ method: 'vbox_apply', params: { game_id: gameId, cryp_id: crypId, index } });
|
||||
function sendVboxApply(instanceId, crypId, index) {
|
||||
send({ method: 'player_vbox_apply', params: { instance_id: instanceId, cryp_id: crypId, index } });
|
||||
}
|
||||
|
||||
function sendVboxDiscard(gameId) {
|
||||
send({ method: 'vbox_discard', params: { game_id: gameId } });
|
||||
function sendVboxDiscard(instanceId) {
|
||||
send({ method: 'player_vbox_discard', params: { instance_id: instanceId } });
|
||||
}
|
||||
|
||||
function sendVboxCombine(gameId, indices) {
|
||||
send({ method: 'vbox_combine', params: { game_id: gameId, indices } });
|
||||
function sendVboxCombine(instanceId, indices) {
|
||||
send({ method: 'player_vbox_combine', params: { instance_id: instanceId, indices } });
|
||||
}
|
||||
|
||||
|
||||
function sendVboxDrop(gameId, index) {
|
||||
send({ method: 'vbox_drop', params: { game_id: gameId, index } });
|
||||
function sendVboxDrop(instanceId, index) {
|
||||
send({ method: 'player_vbox_drop', params: { instance_id: instanceId, index } });
|
||||
}
|
||||
|
||||
|
||||
@@ -185,10 +185,9 @@ function createSocket(events) {
|
||||
events.setZone(zone);
|
||||
}
|
||||
|
||||
function vboxState(response) {
|
||||
const [structName, vbox] = response;
|
||||
console.log(vbox);
|
||||
events.setVbox(vbox);
|
||||
function playerState(response) {
|
||||
const [structName, player] = response;
|
||||
events.setVbox(player.vbox);
|
||||
}
|
||||
|
||||
// -------------
|
||||
@@ -210,7 +209,7 @@ function createSocket(events) {
|
||||
zone_create: res => console.log(res),
|
||||
zone_state: zoneState,
|
||||
zone_close: res => console.log(res),
|
||||
vbox_state: vboxState,
|
||||
player_state: playerState,
|
||||
};
|
||||
|
||||
function errHandler(error) {
|
||||
@@ -301,7 +300,7 @@ function createSocket(events) {
|
||||
sendZoneCreate,
|
||||
sendZoneJoin,
|
||||
sendZoneClose,
|
||||
sendVboxState,
|
||||
sendPlayerState,
|
||||
sendVboxAccept,
|
||||
sendVboxApply,
|
||||
sendVboxDrop,
|
||||
|
||||
Reference in New Issue
Block a user