Class EnumExtensions
Extensions to interact more with custom enum objects.
public static class EnumExtensions
- Inheritance
-
EnumExtensions
- Inherited Members
Methods
AvoidConflicts(EnumBuilder<Button>)
Assigns this button to force its bindings to work regardless of whether another vanilla button or custom button have similar bindings.
public static EnumBuilder<GameInput.Button> AvoidConflicts(this EnumBuilder<GameInput.Button> builder)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
- See Also
AvoidConflicts(EnumBuilder<Button>, Device)
Assigns this button to force its bindings to work regardless of whether another vanilla button or custom button have similar bindings in a device.
public static EnumBuilder<GameInput.Button> AvoidConflicts(this EnumBuilder<GameInput.Button> builder, GameInput.Device device)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
deviceGameInput.Device- The devices in which this button avoids conflicts.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
- See Also
CreateCraftTreeRoot(EnumBuilder<Type>, out ModCraftTreeRoot)
Creates a custom crafting tree.
Creating a new CraftTree only makes sense if you're going to use it in a new type of GhostCrafter.
Creating a new CraftTree only makes sense if you're going to use it in a new type of GhostCrafter.
public static EnumBuilder<CraftTree.Type> CreateCraftTreeRoot(this EnumBuilder<CraftTree.Type> builder, out ModCraftTreeRoot craftTreeRoot)
Parameters
builderEnumBuilder<CraftTree.Type>- The custom enum object to make a crafting tree for.
craftTreeRootModCraftTreeRoot- The root node for your custom craft tree, as a new ModCraftTreeRoot instance.
Build up your custom crafting tree from this root node.
This tree will be automatically patched into the game. For more advanced usage, you can replace the default value of CraftTreeCreation with your own custom function.
Returns
- EnumBuilder<CraftTree.Type>
- A reference to this instance after the operation has completed.
CreateInput(EnumBuilder<Button>, string, string, string, InputActionType)
Initializes the action input for this button.
public static EnumBuilder<GameInput.Button> CreateInput(this EnumBuilder<GameInput.Button> builder, string displayName = "", string tooltip = "", string language = "English", InputActionType actionType = InputActionType.Button)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
displayNamestring- The display name of the button, can be anything. If null or empty, this will use the language line "Option{enumName}" instead.
tooltipstring- The tooltip that's shown once the button is hovered in the Mod Input tab, can be anything. If null or empty, this will use the language line "OptionDesc_{enumName}" instead.
languagestring- The language for the display name and tooltip. Defaults to English.
actionTypeInputActionType- Determines the behavior with which an UnityEngine.InputSystem.InputAction triggers.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
- See Also
IsDefinedByDefault<TEnum>(TEnum)
Checks if an enum value is defined by default or added using Nautilus.
public static bool IsDefinedByDefault<TEnum>(this TEnum enumValue) where TEnum : Enum
Parameters
enumValueTEnum- The enum value to look for.
Returns
Type Parameters
TEnum- The type of the enum.
RegisterToTechGroup(EnumBuilder<TechCategory>, TechGroup)
Registers this TechCategory instance to a TechGroup.
public static EnumBuilder<TechCategory> RegisterToTechGroup(this EnumBuilder<TechCategory> builder, TechGroup techGroup)
Parameters
builderEnumBuilder<TechCategory>- The current custom enum object instance.
techGroupTechGroup- The Tech Group to add this TechCategory to.
Returns
- EnumBuilder<TechCategory>
- A reference to this instance after the operation has completed.
SetBindable(EnumBuilder<Button>)
Assigns this button to be bindable for all devices in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetBindable(this EnumBuilder<GameInput.Button> builder)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
By default, all custom buttons are bindable, unless explicitly set as unbindable by calling SetUnbindable(EnumBuilder<Button>).
- See Also
SetBindable(EnumBuilder<Button>, Device)
Assigns this button to be bindable for a device in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetBindable(this EnumBuilder<GameInput.Button> builder, GameInput.Device device)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
deviceGameInput.Device- The device that was set to be bindable.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
By default, all custom buttons are bindable, unless explicitly set as unbindable by calling SetUnbindable(EnumBuilder<Button>, Device).
- See Also
SetUnbindable(EnumBuilder<Button>)
Removes this button from being bindable in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetUnbindable(this EnumBuilder<GameInput.Button> builder)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
- See Also
SetUnbindable(EnumBuilder<Button>, Device)
Removes this button from being bindable for a specific device in the Mod Input tab.
public static EnumBuilder<GameInput.Button> SetUnbindable(this EnumBuilder<GameInput.Button> builder, GameInput.Device device)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
deviceGameInput.Device- The device in which this button cannot be bound.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
- See Also
WithBackground(EnumBuilder<BackgroundType>, Sprite)
Adds a sprite for this instance.
public static EnumBuilder<CraftData.BackgroundType> WithBackground(this EnumBuilder<CraftData.BackgroundType> builder, Sprite backgroundSprite)
Parameters
builderEnumBuilder<CraftData.BackgroundType>- The current custom enum object instance
backgroundSpriteSprite- The sprite to add for this instance.
Returns
- EnumBuilder<CraftData.BackgroundType>
- A reference to this instance after the operation has completed.
Remarks
This overload always registers background icons with a circular background.
WithBackground(EnumBuilder<BackgroundType>, Sprite, bool)
Adds a sprite for this instance.
public static EnumBuilder<CraftData.BackgroundType> WithBackground(this EnumBuilder<CraftData.BackgroundType> builder, Sprite backgroundSprite, bool useCircularIcon)
Parameters
builderEnumBuilder<CraftData.BackgroundType>- The current custom enum object instance
backgroundSpriteSprite- The sprite to add for this instance.
useCircularIconbool- If true, the 'splice 9' setting will be applied, allowing tall rectangular sprites (usually 2x23) to become circular.
Returns
- EnumBuilder<CraftData.BackgroundType>
- A reference to this instance after the operation has completed.
WithBinding(EnumBuilder<Button>, Device, BindingSet, string)
Sets the default bindings for this button.
public static EnumBuilder<GameInput.Button> WithBinding(this EnumBuilder<GameInput.Button> builder, GameInput.Device device, GameInput.BindingSet bindingSet, string bindingPath)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
deviceGameInput.Device- The device this binding is for.
bindingSetGameInput.BindingSet- Whether this is the primary binding or the secondary binding.
bindingPathstring- The binding path to bind this button to.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
- See Also
WithBinding(EnumBuilder<Button>, Device, string, string)
Sets the default bindings for this button.
public static EnumBuilder<GameInput.Button> WithBinding(this EnumBuilder<GameInput.Button> builder, GameInput.Device device, string primaryBindingPath, string secondaryBindingPath = null)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
deviceGameInput.Device- The device this binding is for.
primaryBindingPathstring- The binding path to bind the primary hotkey of this button.
secondaryBindingPathstring- The binding path to bind the secondary hotkey of this button. If null or empty, the button will have an empty secondary binding.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
- See Also
WithCategory(EnumBuilder<Button>, string)
Defines a custom category in which this button will appear in the Mod Input tab.
public static EnumBuilder<GameInput.Button> WithCategory(this EnumBuilder<GameInput.Button> builder, string category)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
categorystring- The category name.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
If the specified category was already added by another mod, both buttons will be merged under one category.
WithControllerBinding(EnumBuilder<Button>, string, string)
Sets the default bindings for controller controls for this button.
public static EnumBuilder<GameInput.Button> WithControllerBinding(this EnumBuilder<GameInput.Button> builder, string primaryBindingPath, string secondaryBindingPath = null)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
primaryBindingPathstring- The binding path to bind the primary hotkey of this button.
secondaryBindingPathstring- The binding path to bind the secondary hotkey of this button. If null or empty, the button will have an empty secondary binding.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
- See Also
WithIcon(EnumBuilder<PingType>, Sprite)
Adds an icon for this instance.
public static EnumBuilder<PingType> WithIcon(this EnumBuilder<PingType> builder, Sprite sprite)
Parameters
builderEnumBuilder<PingType>- The current custom enum object instance.
spriteSprite- The icon to add for this instance.
Returns
- EnumBuilder<PingType>
- A reference to this instance after the operation has completed.
WithIcon(EnumBuilder<TechType>, Sprite)
Adds an icon for this instance.
public static EnumBuilder<TechType> WithIcon(this EnumBuilder<TechType> builder, Sprite sprite)
Parameters
builderEnumBuilder<TechType>- The current custom enum object instance.
spriteSprite- The icon to add for this instance.
Returns
- EnumBuilder<TechType>
- A reference to this instance after the operation has completed.
WithKeyboardBinding(EnumBuilder<Button>, string, string)
Sets the default bindings for keyboard controls for this button.
public static EnumBuilder<GameInput.Button> WithKeyboardBinding(this EnumBuilder<GameInput.Button> builder, string primaryBindingPath, string secondaryBindingPath = null)
Parameters
builderEnumBuilder<GameInput.Button>- The current custom enum object instance.
primaryBindingPathstring- The binding path to bind the primary hotkey of this button.
secondaryBindingPathstring- The binding path to bind the secondary hotkey of this button. If null or empty, the button will have an empty secondary binding.
Returns
- EnumBuilder<GameInput.Button>
- A reference to this instance after the operation has completed.
Remarks
By default, the binding will be bindable in the Mod Input tab. If you wish to make the button unbindable, consider using SetUnbindable(EnumBuilder<Button>).
- See Also
WithPdaInfo(EnumBuilder<TechCategory>, string, string)
Adds a display name to this instance.
public static EnumBuilder<TechCategory> WithPdaInfo(this EnumBuilder<TechCategory> builder, string displayName, string language = "English")
Parameters
builderEnumBuilder<TechCategory>- The current enum object instance.
displayNamestring- The display name of the Tech Category, can be anything. If null or empty, this will use the language line "TechCategory{enumName}" instead.
languagestring- The language for the display name. Defaults to English.
Returns
- EnumBuilder<TechCategory>
- A reference to this instance after the operation has completed.
WithPdaInfo(EnumBuilder<TechGroup>, string, string)
Adds a display name to this instance.
public static EnumBuilder<TechGroup> WithPdaInfo(this EnumBuilder<TechGroup> builder, string displayName, string language = "English")
Parameters
builderEnumBuilder<TechGroup>- The current custom enum object instance.
displayNamestring- The display name of the Tech Group, can be anything. If null or empty, this will use the language line "Group{enumName}" instead.
languagestring- The language for the display name. Defaults to English.
Returns
- EnumBuilder<TechGroup>
- A reference to this instance after the operation has completed.
WithPdaInfo(EnumBuilder<TechType>, string, string, string, bool)
Adds a display name, tooltip to this instance.
public static EnumBuilder<TechType> WithPdaInfo(this EnumBuilder<TechType> builder, string displayName, string tooltip, string language = "English", bool unlockAtStart = false)
Parameters
builderEnumBuilder<TechType>- The current custom enum object instance.
displayNamestring- The display name of this Tech Type, can be anything. If null or empty, this will use the language line "{enumName}" instead.
tooltipstring- The tooltip displayed when hovered in the PDA, can be anything. If null or empty, this will use the language line "Tooltip_{enumName}" instead.
languagestring- The language for this entry. Defaults to English.
unlockAtStartbool- Whether this instance should be unlocked on game start or not.
Returns
- EnumBuilder<TechType>
- A reference to this instance after the operation has completed.
WithSizeInInventory(EnumBuilder<TechType>, Vector2int)
Sets the size in inventory for this instance.
public static EnumBuilder<TechType> WithSizeInInventory(this EnumBuilder<TechType> builder, Vector2int size)
Parameters
builderEnumBuilder<TechType>- The current custom enum object instance.
sizeVector2int- The 2x2 vector size
Returns
- EnumBuilder<TechType>
- A reference to this instance after the operation has completed.