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.
 

Sangemdoko

Moderator
Staff member
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

Justus

Member
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
 

Sangemdoko

Moderator
Staff member
Sure.
Code:
fileFormatVersion: 2
guid: 0f1dfb47165d43fcb383c672d51c2582
timeCreated: 1654846171

The file was added in the UI/Panels/ItemViewSlotContainers folder
 

Justus

Member
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.
 

Justus

Member
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`
 

Sangemdoko

Moderator
Staff member
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

  • ItemViewSlotsContainerCategoryItemActionSetBinding.cs
    2.8 KB · Views: 0
  • ItemViewSlotsContainerItemActionBinding.cs
    3.3 KB · Views: 0
  • ItemViewSlotsContainerItemActionBindingBase.cs
    18 KB · Views: 0
Top