Prevent item action panel from opening/custom code on item slot clicks

C

CursedToast

Guest
Hi!

I've created a couple of custom action scripts, and an Item Action Panel (tooltip). What I'm trying to figure out is how to prevent the action panel from showing up after using one of these custom actions from the panel. Ideally, I select the action and then can choose another item with the cursor and run some custom code.

Could you by chance give me an example of running custom code on an item click that also prevents the action panel from opening? Temporarily, I would like to run my own code on each item button, basically.

Maybe I'm approaching everything wrong and assuming I would need to be overriding something. Right now I'm at a loss and getting frustrated, but I really want this system to work out because it's excellent. I'm hoping with a nudge in the right direction, things will click and I can make this system work out for my current project. Thank you!! :)
 
Yes absolutely, we have an example of that with the "Move Item Action".

The way it works is that it finds a component on the UI and lets you unbind the Item Actions while the action is active, once it is done it rebinds the Item Actions.

This allows you to click an item to start moving, move around the slots, and click to place the item without triggering the item actions again.

Have a look at this video it explains how the Move Item Action works

You can inspire yourself from that to create your own item action
 
Yes absolutely, we have an example of that with the "Move Item Action".

The way it works is that it finds a component on the UI and lets you unbind the Item Actions while the action is active, once it is done it rebinds the Item Actions.

This allows you to click an item to start moving, move around the slots, and click to place the item without triggering the item actions again.

Have a look at this video it explains how the Move Item Action works

You can inspire yourself from that to create your own item action

EDIT: Thank you. This works okay for a regular action panel. If it's a tooltip panel, the panel still shows up even if the actions are unbound. Should I do more with the tooltip panel or is this a bug?
 
Last edited by a moderator:
Thank you for pointing that out I hadn't thought about it.

I implemented a solution for it using an interface IItemViewSlotContainerBinding which the ItemViewSlotPanelToTooltip now inherits.
And I added a field to add an "Interface" (a Game Object, I search for the interface as a component on initialize) to the ItemViewSlotMoveCursor component.

This way you may now add both the Action component and the tooltip component as things to "Unbind" while the item is being moved.

I'll attach the relevant scripts such that you won't need to wait for the next update which could take a while.
It won't compile if you simply add those files in because a few scripts inherit the ItemViewSlotContainerBinding abstract class and I changed the method names "Bind" -> "BindItemViewSlotContainer", similarly for UnBind, OnBind and OnUnBind.

If you feel comfortable renaming those methods feel free to fix the compile errors after replacing those scripts. If not you may wait for the update
 

Attachments

  • ItemViewSlotPanelToTooltip.cs
    9.5 KB · Views: 0
  • ItemViewSlotMoveCursor.cs
    6 KB · Views: 0
  • ItemViewSlotsContainerBinding.cs
    4.2 KB · Views: 0
Top