I've got a question about modifying the Default Inventory Box of the Inventory Menu. I've got 7 slots and each slot has a unique inventory item. When I tap an item in a slot, the bottom of the screen displays the currently selected item with a long text description. The user can tap the buttons "Use selected" or "Cancel" to resume game play.
When I select and item I must tap the slot of the selected item again, to deselect it, before choosing a different item. I'd like to have AC automatically deselect the selected item when I choose a different item instead. I've got limited knowledge of C# but I might be able to create a custom script with a bit of help. I've posted a screen shot to help clarify.
Any suggestions on how to achieve this?
Comments
First of all, you can define Inventory item properties, which are essentially Variables that each item has its own value for. Creating a "String" property would therefore allow you to store your "long description" text. Properties can only be accessed through scripting, but the "Inventory properties" chapter of the Manual explains how.
So that you can more easily manipulate the contents of your Menu, you'll want to switch over to Unity UI. A tutorial on converting the AC-based Inventory Menu to Unity UI can be found here.
In order for clicking an item at the top to result in the bottom changing, you'll need to define a "Use interaction" for each item - since this override the default behaviour of an item becoming "selected" in the normal AC terminology (what I'm guessing your "Use selected" button is for).
Within that ActionList, you can include a custom Action that updates the lower half of the menu (larger item graphic, description etc) accordingly. Switching to Unity UI will make this a simple case of updating UI Image / Text components. If you want to add toggling (i.e. clicking again removes those changes), you can incorporate a Global Variable into your ActionList so that you can react differently if you've already clicked once.
Within your custom Action, you can retrieve the last-clicked inventory item quite easily:
InvItem invItem = AC.KickStarter.runtimeInventory.lastClickedItem;
Which you can then use to retrieve property data, texture info etc. You'll also want to store that inventory item reference in a custom script, so that you can make use of it in the "Use selected" Button's ActionList, which'll also need a custom Action to run the following:
invItem.Select ();
For more on inventory and menu scripting, see the "Inventory scripting" and "Menu scripting" chapters of the Manual, as well as the Scripting Guide.