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
builder
EnumBuilder<CraftTree.Type>- The custom enum object to make a crafting tree for.
craftTreeRoot
ModCraftTreeRoot- 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
enumValue
TEnum- 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
builder
EnumBuilder<TechCategory>- The current custom enum object instance.
techGroup
TechGroup- 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
builder
EnumBuilder<CraftData.BackgroundType>- The current custom enum object instance
backgroundSprite
Atlas.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
builder
EnumBuilder<PingType>- The current custom enum object instance.
sprite
Atlas.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
builder
EnumBuilder<PingType>- The current custom enum object instance.
sprite
Sprite- 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
builder
EnumBuilder<TechType>- The current custom enum object instance.
sprite
Atlas.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
builder
EnumBuilder<TechType>- The current custom enum object instance.
sprite
Sprite- 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
builder
EnumBuilder<TechCategory>- The current enum object instance.
displayName
string- The display name of the Tech Category, can be anything. If null or empty, this will use the language line "TechCategory{enumName}" instead.
language
string- 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
builder
EnumBuilder<TechGroup>- The current custom enum object instance.
displayName
string- The display name of the Tech Group, can be anything. If null or empty, this will use the language line "Group{enumName}" instead.
language
string- 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
builder
EnumBuilder<TechType>- The current custom enum object instance.
displayName
string- The display name of this Tech Type, can be anything. If null or empty, this will use the language line "{enumName}" instead.
tooltip
string- The tooltip displayed when hovered in the PDA, can be anything. If null or empty, this will use the language line "Tooltip_{enumName}" instead.
language
string- The language for this entry. Defaults to English.
unlockAtStart
bool- 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
builder
EnumBuilder<TechType>- The current custom enum object instance.
size
Vector2int- The 2x2 vector size
Returns
- EnumBuilder<TechType>
- A reference to this instance after the operation has completed.