Is there a way to implement ItemAction without using Panel?

thanawat

New member
Hi there,

Is there a way to implement ItemAction without using Panel? As in the example, I have to use a panel like "Item Action Panel" for the item action and set it in ItemViewSlotsContainerCategoryItemActionSetBinding and click it to make those action buttons appear.

What if I want the ItemAction(like equip/unequip button) to be appeared in the Center Panel or Main Panel of the inventory without using the panel. Is this possible? (Imagine that player hover the mouse/cursor over the item and those equip/unequip buttons appeared below the grid or appeared in the Bottom Panel)

As I understood, It is possible but I have to create a class and inherited the "ItemViewSlotsContainerBinding Class" and implement a class like "ItemViewSlotsContainerItemActionBindingBase" but without Panel. I want to be cleared before starting an implementation.

Thank you in advance.
 
Last edited:
If you don't want to use the ItemActionPanel, you do not have to.
The ItemViewSlotContainerItemActionBindings that come built-in the system have functions to call actions at a specific index. So if you know the order of the ItemActions within the ITemActionSet you can easily have any script call these functions (You can find them in the ItemViewSlotsContainerItemActionBindingBase class):

C#:
/// <summary>
/// Use an item from the hot bar.
/// </summary>
/// <param name="itemSlotIndex">The item slot index of the item to use.</param>
/// <param name="itemActionIndex">The item action index.</param>
public virtual void UseItemAction(int itemSlotIndex, int itemActionIndex)
    
    
    or
    
    
/// <summary>
/// Use an item from the hot bar.
/// </summary>
/// <param name="itemActionIndex">The item action index.</param>
public virtual void UseItemActionOnSelectedSlot(int itemActionIndex)

Another solution is as you mentioned create your own ItemViewSlotsContainerItemActionBinding, although I do not think that is necessary.

Or if you prefer, don't use any ItemViewSlotsContainerItemActionBinding, and instead create your own custom script that has a reference to an ItemActionSet, or serializes the ItemActions directly.


I would go with option 1 since it is the easiest one, but if you want to have more customisation option 3 is probably more work but worth the trade off
 
If you don't want to use the ItemActionPanel, you do not have to.
The ItemViewSlotContainerItemActionBindings that come built-in the system have functions to call actions at a specific index. So if you know the order of the ItemActions within the ITemActionSet you can easily have any script call these functions (You can find them in the ItemViewSlotsContainerItemActionBindingBase class):

C#:
/// <summary>
/// Use an item from the hot bar.
/// </summary>
/// <param name="itemSlotIndex">The item slot index of the item to use.</param>
/// <param name="itemActionIndex">The item action index.</param>
public virtual void UseItemAction(int itemSlotIndex, int itemActionIndex)
   
   
    or
   
   
/// <summary>
/// Use an item from the hot bar.
/// </summary>
/// <param name="itemActionIndex">The item action index.</param>
public virtual void UseItemActionOnSelectedSlot(int itemActionIndex)

Another solution is as you mentioned create your own ItemViewSlotsContainerItemActionBinding, although I do not think that is necessary.

Or if you prefer, don't use any ItemViewSlotsContainerItemActionBinding, and instead create your own custom script that has a reference to an ItemActionSet, or serializes the ItemActions directly.


I would go with option 1 since it is the easiest one, but if you want to have more customisation option 3 is probably more work but worth the trade off
It is easier to use those 2 functions that you mentioned. It is working now !!!.
I think I was thinking too deep because I just started using UIS and did not quite understand the whole system. I have to try more and more.

Thank you again.
 
Top