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);
});
vbox.free.forEach((item, i) => {
const ITEM_X = ITEM_WIDTH * 1.1 * (i % BOX_COLUMNS) + BOX_X + ITEM_WIDTH * 0.5;
const ITEM_Y = ITEM_HEIGHT * 1.1 * Math.floor(i / BOX_COLUMNS) + BOX_Y + ITEM_HEIGHT * 0.5;
vbox.free.forEach((type, i) => {
type.forEach((item, j) => {
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 = () => {
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);
itemBox.on('pointerdown', clickFn);
this.add.existing(itemBox);
});
});
// Restore previous combiner item slots
this.combinerItems.forEach((index, i) => {

View File

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