Class EnumExtensions
Extensions to interact more with custom enum objects.
public static class EnumExtensions
- Inheritance
-
EnumExtensions
- Inherited Members
Methods
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.
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.
WithBackground(EnumBuilder<BackgroundType>, Sprite)
Adds a sprite for this instance.
public static EnumBuilder<CraftData.BackgroundType> WithBackground(this EnumBuilder<CraftData.BackgroundType> builder, Atlas.Sprite backgroundSprite)
Parameters
builderEnumBuilder<CraftData.BackgroundType>- The current custom enum object instance
backgroundSpriteAtlas.Sprite- The sprite to add for this instance.
Returns
- EnumBuilder<CraftData.BackgroundType>
- A reference to this instance after the operation has completed.
WithIcon(EnumBuilder<PingType>, Sprite)
Adds an icon for this instance.
public static EnumBuilder<PingType> WithIcon(this EnumBuilder<PingType> builder, Atlas.Sprite sprite)
Parameters
builderEnumBuilder<PingType>- The current custom enum object instance.
spriteAtlas.Sprite- The icon to add for this instance.
Returns
- EnumBuilder<PingType>
- A reference to this instance after the operation has completed.
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, Atlas.Sprite sprite)
Parameters
builderEnumBuilder<TechType>- The current custom enum object instance.
spriteAtlas.Sprite- The icon to add for this instance.
Returns
- EnumBuilder<TechType>
- 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.
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 = true)
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.