What would be the best way to proceed? From my research, it seems like I need to increment the selected index, but I’m not sure under which conditions I should do that, or how to properly update the widget to support a functioning “one-button” cycling logic.
I assume I would also need some sort of logic to set the max number of items I can carry in my quick use button?
sure, but can you explain your question a bit more i don’t quite understand what you mean?
the way i’ve organized my things are:
struct for items > data table of items > subsystem that handles inventory
inventory manager actor > inventory ui
the inventory subsystem (inventory) loads the data table, and keeps a list of items loaded. alongside other runtime (transient) properties, like locked, quantity, cooldown.
the inventory manager communicates with the inventory subsytem through delegates, and updates the ui accordingly.
the ui only manages the ui code, like creating new widgets for each item. removing widgets on consumption. animating things.
it’s a bit of an MVC pattern (which is usually practical for ui stuff)
the subsystem is like the model, as it keeps track of the actual information.
In your game you usually interact with the subsystem. telling it to modify an item, to use it, consume it, or ask whether it’s available or not, specifying the data table, etc.
the manager is sort of the controller, though the subsystem also has some logic.
and the ui is … the view, of course.
my plugin has stub code for the ui for the generic stuff (binding, creating the ui, show and hide)