Unity Ver: 2018.2.2f1
AC Ver: 1.66.2
Hello folks,
I've been having a further think about how I'd like my inventory to work. I've got a lot of the functionality (such as item combining and background pausing) all up and running but I need some advice on a remaining thing.
Basically, the player should be able to do the following in my inventory:
The last one is the bit of functionality I'm not sure how to hook up. On double left click I want the inventory to close and be able to tell the game that the item which was double clicked is now the 'active' item. I already have scripts which access the runtimeInventory.localItems side of things so I have a bit of familiarity with that, but first steps:
How would I trigger a script or action list on a double left click of a inventory item?
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
You'll need to hook into the OnMenuElementClick event - see the Manual's "Custom events" and "Menu scripting" chapters.
This event is triggered whenever the user (single) clicks on a menu, and includes parameters for the menu, element, slot index, and mouse button - which you can read to determine if its the inventory being clicked on.
To check for double-clicking, you'd have to either write a timer to check for repeated calls, or you may be able to read AC's built-in mouse state:
AC.KickStarter.playerInput.GetMouseState ();
To avoid intefering with the inventory's regular behaviour, you may have to set the element's Inventory box type field to Custom Script and use the same hook for the other click handling as well.