Fixed varibox for new structure

This commit is contained in:
Mashy 2019-03-06 11:58:28 +10:00
parent b4cf3f4eb4
commit c8b19d2875
2 changed files with 14 additions and 13 deletions

View File

@ -197,18 +197,19 @@ class ItemList extends Phaser.Scene {
this.add.existing(itemBox); this.add.existing(itemBox);
}); });
vbox.free.forEach((item, i) => { vbox.free.forEach((type, i) => {
const ITEM_X = ITEM_WIDTH * 1.1 * (i % BOX_COLUMNS) + BOX_X + ITEM_WIDTH * 0.5; type.forEach((item, j) => {
const ITEM_Y = ITEM_HEIGHT * 1.1 * Math.floor(i / BOX_COLUMNS) + BOX_Y + ITEM_HEIGHT * 0.5; const ITEM_X = ITEM_WIDTH * 1.1 * j + BOX_X + ITEM_WIDTH * 0.5;
const ITEM_Y = ITEM_HEIGHT * 1.1 * i + BOX_Y + ITEM_HEIGHT * 0.5;
const clickFn = () => { const clickFn = () => {
this.registry.set('itemInfo', item); this.registry.set('itemInfo', item);
ws.sendVboxAccept(vbox.instance, i); ws.sendVboxAccept(vbox.instance, i, j);
}; };
const itemBox = new Item(this, item, i, ITEM_X, ITEM_Y, ITEM_WIDTH, ITEM_HEIGHT); const itemBox = new Item(this, item, i, ITEM_X, ITEM_Y, ITEM_WIDTH, ITEM_HEIGHT);
itemBox.on('pointerdown', clickFn); itemBox.on('pointerdown', clickFn);
this.add.existing(itemBox); this.add.existing(itemBox);
}); });
});
// Restore previous combiner item slots // Restore previous combiner item slots
this.combinerItems.forEach((index, i) => { this.combinerItems.forEach((index, i) => {

View File

@ -93,8 +93,8 @@ function createSocket(events) {
send({ method: 'player_state', params: { instance_id: instanceId } }); send({ method: 'player_state', params: { instance_id: instanceId } });
} }
function sendVboxAccept(instanceId, i) { function sendVboxAccept(instanceId, i, j) {
send({ method: 'player_vbox_accept', params: { instance_id: instanceId, index: i } }); send({ method: 'player_vbox_accept', params: { instance_id: instanceId, group: i, index: j } });
} }
function sendVboxApply(instanceId, crypId, index) { function sendVboxApply(instanceId, crypId, index) {