[Feature Request] Panel Contextual ItemActionHandler enhancement

Justus

Member
Considering following Input scenario(XBOX controller):
1)When the Inventory open
- A for ItemAction - UseOrEquipe
- X for ItemAction - Move
- Y for OpenItemActionPanel

we use the component `ItemViewSlotContainer ItemAction Handler` to implement this input assignment.
1651993578845.png

2) When we open the ItemAction Panel,
- D-pad for navigation between Item Action Buttons
- A for Submit
- B for Cancel
1651993895020.png

3) If we want to drop this item, we move the selection to `Drop` button and Press `A`, two thing happen
- Item has been droped
- Item has been used/equip ( exception may throw)



The problem here is that the Item Action triggered by Input which indicated by `Item View Slot container Item Action Handler` is not panel-contextual.
It should be only limited inside a certain panel context, but not be triggered when you on other panel.


My Request is to do an enhancement to meet following features:
1) fix the unbinding action throw exception issue of `Item Action Handler`
Related bug report see here: https://opsive.com/forum/index.php?...-which-invoke-move-action-during-moving.7890/
2) give `Item Action Handler` an enhancement that allow it only take effect when an indicated panel is active(or selected? please find a proper way which meet the design model of UIS Panel), and don't take effect when this mentioned panel is disabled or not the contextual one(the top one).
Example of new options.
- (bool) only take effect on certain panel
- (DisplayPanel) certain panel reference
 
The ItemViewSlotContainerItemActionHandler is a very simple script. You could easily replace it with your own custom own if you want to have more control.
I added the change to allow the action to be performed only when the panel is selected. but you could easily add more conditions if make your own
 

Attachments

  • ItemViewSlotContainerItemActionHandler.cs
    2.8 KB · Views: 3
this script could not work as expectation.
when I pressed the A, the item droped, and Item Action Panel deselected, and Inventory panel selected.
and in the next frame, A is still in pressed, this also be accepted to trigger Item action.

maybe need an mechanism for `Button Just Down`?
 
It is possible that it all happens in the same frame if the Update of the ItemActionHandler happens after the Update for the UI click

I added some Unity Events so that you can easily disable the Input while it is active. But if it all happens in the same frame that won't help you.
1652093064431.png
I'd recommend you make a custom script (override the ItemAcionHandler script) this way you can wait a frame or two if needed to handle the input
 
It is possible that it all happens in the same frame if the Update of the ItemActionHandler happens after the Update for the UI click

I added some Unity Events so that you can easily disable the Input while it is active. But if it all happens in the same frame that won't help you.
View attachment 8837
I'd recommend you make a custom script (override the ItemAcionHandler script) this way you can wait a frame or two if needed to handle the input
Could you please help to change all function of ItemActionHandler to `virtual protected`? so that I could override it freely
 
Top