Hey Devs!
I am currently working on the inventory system in my game.
It is based on 'partitions', each inventory has a static sized partition, which is an array of ItemStack, the holder for items in the game world (handles count, damaging, destruction, ...) and a unlimited amount of dynamic sized partitions in form of a Dictionary<int, InventoryPartition> where the int is just an identifier. InventoryPartition is just a struct with a List<ItemStack> and a int which determines the current maximum size.
The Inventory class is in the attachments.
I would like to hear some more opinions on my approach, so what do you think? Is it too complected? Do you have an idea for improvements?
Disclaimer: the code is a prototype and has not been tested, optimized or checked for mistakes yet