Class ItemActionHandler
A handler class for registering custom actions when left clicking or middle clicking on an item.
public static class ItemActionHandler
- Inheritance
-
ItemActionHandler
- Inherited Members
Methods
RegisterLeftClickAction(TechType, Action<InventoryItem>, string, string, Predicate<InventoryItem>)
Registers a custom left click action for a TechType
public static void RegisterLeftClickAction(TechType targetTechType, Action<InventoryItem> callback, string tooltip, string language = "English", Predicate<InventoryItem> condition = null)
Parameters
targetTechType
TechType- The TechType to which the left click action will be assigned
callback
Action<InventoryItem>- The method which will be called when a matching InventoryItem with the specified TechType was left-clicked
tooltip
string- The secondary tooltip which will appear in the description of the item. If null or empty, this will use the language line "LeftClickAction_{
targetTechType
}" instead. language
string- The language for the tooltip. Defaults to English.
condition
Predicate<InventoryItem>- The condition which must return true for the action to be called when the item is clickedIf omitted, the action will always be called
RegisterMiddleClickAction(TechType, Action<InventoryItem>, string, string, Predicate<InventoryItem>)
Registers a custom middle click action for a TechType
public static void RegisterMiddleClickAction(TechType targetTechType, Action<InventoryItem> callback, string tooltip, string language = "English", Predicate<InventoryItem> condition = null)
Parameters
targetTechType
TechType- The TechType which the middle click action will be assigned
callback
Action<InventoryItem>- The method which will be called when a matching InventoryItem with the specified TechType was middle-clicked
tooltip
string- The secondary tooltip which will appear in the description of the item
language
string- The language for the tooltip. Defaults to English.
condition
Predicate<InventoryItem>- The condition which must return true for the action to be called when the item is clickedIf omitted, the action will always be called