Hi there,
I encounter a problem I can’t solve easily.
It happens that my UI looks like that:
So it is very tempting, during shopping, to interact with the Equipment panel.
It becomes a real headache when you are in selling mode.
In fact, the shop list doesn’t updated correctly, because I don’t have an event that traps the inventory changes.
I tried to subscribe to the equipmentUpdated event, but it still doesn’t work fine:
- When you drag and drop an item from the inventory to the equipment, its ok (the quantities in shop list in selling mode update as expected)
- But when you drag and item from your equipment to your inventory, it doesn’t work (ie the list doesn’t update until next UI refresh…)
That’s because, in the DragItem.cs, the source is always processed (addItem or removeItem) before the destination (and the equipmentUpdated event is -indirectly- invoked by addItem and removeItem of the EquipmentSlotUI).
I can’t see any “good” solution there…
Should I go on and implement an “inventoryUpdated” event? I feel that it wouldn’t be very efficient when it comes to confirm a selling transaction with a lot of items in it…
Should I implement a coroutine that waits for a small amount of time in the method that I subscribe to the equipmentUpdated?
Any other suggestion?
Thanks!
PS: Honestly, it looks like the problem is more on the UI side, for me.
If it had to start from a blank page, I would go on and design a UI shop inspired from Diablo II: a panel for the player’s inventory, a panel for the shop keeper’s inventory and the drag an drop mechanism between those two panels does the transaction. But I don’t feel like restarting from scratch for the moment…