inv deallocate on click

This commit is contained in:
Mashy 2019-03-06 15:26:09 +10:00
parent a455b2b1f3
commit b022845ff7
2 changed files with 7 additions and 2 deletions

View File

@ -269,11 +269,13 @@ class ItemList extends Phaser.Scene {
// hitbox can only be the combinerhitbox, deletehitbox or cryp avatar
hitBox.itemDeselect();
if (hitBox instanceof CombinerHitBox) {
allocate(item, hitBox);
if (hitBox.item === item) deallocate(item);
else allocate(item, hitBox);
} else if (hitBox instanceof DeleteHitBox) {
ws.sendVboxDrop(vbox.instance, item.index);
} else {
ws.sendVboxApply(vbox.instance, hitBox.cryp.id, item.index);
deallocate(item);
} return true;
}
// If not interacting with hitbox and didn't move much try to allocate the item

View File

@ -36,12 +36,15 @@ class Menu extends Phaser.Scene {
// When we load the menu request the latest items
// Item list will restart when the data comes in
this.scene.manager.add('MenuCrypList', MenuCrypList, true);
this.scene.manager.add('MenuNavigation', MenuNavigation, true);
this.scene.manager.add('MenuScore', MenuScore, true);
this.scene.manager.add('ItemList', ItemList, true);
this.registry.set('inMenu', true);
// Request the latest player state when we load the scene
const { instance } = this.registry.get('player');
this.registry.get('ws').sendPlayerState(instance);
return true;
}