create a `Item Action Handler` which call item action by name instead of by index.

Justus

Member
different items will has different action list.
sometimes we want to invoke an action only if it's existing.

Could you please add a new or enhance Item Action Handler to support following feature?
- all us assign multiple inputs to different item actions with different name, if the target name is not existing, then ignore it
- one input could be assign to multiple action names, when this input was pressed, all actions will be invoked.
 
This was fairly easy to add and I can see how it can be useful.

Please find the new script attached:
ItemViewSlotContainerNamedItemActionHandler

It required some changes in
ItemViewSlotsContainerItemActionBindingBase

And I added this in the SimpleInput.cs script:
Code:
/// <summary>
/// input organized by name.
/// </summary>
[Serializable]
public class NamedInput : SimpleInput
{
    public string Name;
    /// <summary>
    /// Constructor.
    /// </summary>
    /// <param name="index">The hot bar slot index affected by this input.</param>
    public NamedInput(string name, string inputName, InputType inputType) : base(inputName,inputType)
    {
        Name = name;
    }
}

I hope that helps
 

Attachments

  • ItemViewSlotContainerNamedItemActionHandler.cs
    2.7 KB · Views: 1
  • ItemViewSlotsContainerItemActionBindingBase.cs
    17.3 KB · Views: 1
could you please share the .meta info of new script so that I could make sure it will be compatible with future update of UIS
 
Sure.
Code:
fileFormatVersion: 2
guid: 0f1dfb47165d43fcb383c672d51c2582
timeCreated: 1654846171

The file was added in the UI/Panels/ItemViewSlotContainers folder
 
It seems not work as expectation. In my case , only Consumable could be use, But when I press target key, my weapon also be used.
 
that a part of `one input could be assign to multiple action names, when this input was pressed, all actions will be invoked.`
 
that's a part of `one input could be assign to multiple action names, when this input was pressed, all actions will be invoked.`

I think it should always check whether this action is valid for current item right? or it could has an option like `ignore action if it's not exsiting for selected item`
 
Ok I think I know what you are talking about now.
I changed a few things in the base component which required me to change the subcalsses too. Hopefully that allows it to be more robust and consistant
 

Attachments

  • ItemViewSlotsContainerItemActionBindingBase.cs
    18 KB · Views: 3
  • ItemViewSlotsContainerItemActionBinding.cs
    3.3 KB · Views: 3
  • ItemViewSlotsContainerCategoryItemActionSetBinding.cs
    2.8 KB · Views: 4
It seems I was refreshing the item actions later than I should have.
I added a null check too just in case.

Could you give this a try.
 

Attachments

  • ItemViewSlotsContainerItemActionBindingBase.cs
    18.1 KB · Views: 1
It seems I was refreshing the item actions later than I should have.
I added a null check too just in case.

Could you give this a try.
I could equip a weapon one time and unequip it one time. When I press target name button third time, nothing will happen anymore.
 
Sorry I must have missed your previous message.

I have looked into it and I can't seem to replicate the issue. Are you sure it isn't related to something else?
I would recommend you try debugging to really see at what point it stops working.

Have you updated to V1.2.10 that was released last week?

If you are able to replicate the issue in one of the feature scenes do let me know the exact reproduction steps and I'll see what I can do.
 
Top