Class Registry
Used to store a variety of features to be added to the game
Inherited Members
Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
[CreateAssetMenu(fileName = "Registry", menuName = "WeaverCore/Registry", order = 1)]
public class Registry : ScriptableObject
Properties
| Edit this page View SourceAllRegistries
Declaration
public static IEnumerable<Registry> AllRegistries { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Registry> |
Enabled
Is this registry currently enabled?
Declaration
public bool Enabled { get; }
Property Value
Type | Description |
---|---|
bool |
FeatureCount
The amount of features added to this registry
Declaration
public int FeatureCount { get; }
Property Value
Type | Description |
---|---|
int |
Features
Retrieves a list of all the features added to this registry
Declaration
public IEnumerable<Object> Features { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Object> |
ModAssemblyName
The name of the assembly this registry is bound to
Declaration
public string ModAssemblyName { get; }
Property Value
Type | Description |
---|---|
string |
ModName
The name of the mod this registry is bound to
Declaration
public string ModName { get; }
Property Value
Type | Description |
---|---|
string |
ModType
The mod this registry is bound to
Declaration
public Type ModType { get; }
Property Value
Type | Description |
---|---|
Type |
Methods
| Edit this page View SourceAddFeature<T>(T)
Adds a new feature to the registry
Declaration
public void AddFeature<T>(T feature) where T : Object
Parameters
Type | Name | Description |
---|---|---|
T | feature | The feature to be added |
Type Parameters
Name | Description |
---|---|
T | The type of feature to add |
Create(IMod)
Creates a new registry bound to the specified mod
Declaration
public static Registry Create(IMod mod)
Parameters
Type | Name | Description |
---|---|---|
IMod | mod | The mod this new registry will be bound to |
Returns
Type | Description |
---|---|
Registry |
Create(Type)
Creates a new registry bound to the specified mod
Declaration
public static Registry Create(Type modType)
Parameters
Type | Name | Description |
---|---|---|
Type | modType | The type of mod the new registry will be bound to |
Returns
Type | Description |
---|---|
Registry |
Create<TMod>()
Creates a new registry bound to the specified mod
Declaration
public static Registry Create<TMod>() where TMod : IMod
Returns
Type | Description |
---|---|
Registry |
Type Parameters
Name | Description |
---|---|
TMod | The type of mod the new registry will be bound to |
DisableRegistry()
Disables the registry and its features
Declaration
public void DisableRegistry()
EnableRegistry()
Enables the registry and its features
Declaration
public void EnableRegistry()
FindModRegistries(Type)
Finds all loaded registries pertaining to a mod
Declaration
public static IEnumerable<Registry> FindModRegistries(Type ModType)
Parameters
Type | Name | Description |
---|---|---|
Type | ModType | The mod that is associated with the registry |
Returns
Type | Description |
---|---|
IEnumerable<Registry> | Returns all the registries that are bound to the mod |
FindModRegistries<Mod>()
Finds all loaded registries pertaining to a mod
Declaration
public static IEnumerable<Registry> FindModRegistries<Mod>() where Mod : IMod
Returns
Type | Description |
---|---|
IEnumerable<Registry> | Returns all the registries that are bound to the mod |
Type Parameters
Name | Description |
---|---|
Mod | The mod type that is associated with the registry |
FindModRegistry(Type)
Find a loaded registry pertaining to a mod
Declaration
public static Registry FindModRegistry(Type ModType)
Parameters
Type | Name | Description |
---|---|---|
Type | ModType | The mod that is associated with the registry |
Returns
Type | Description |
---|---|
Registry | Returns the registry that is bound to the mod. Returns null if no registry is found |
GetAllFeatures<T>()
Goes through all of the loaded Registries, and find the specified features
Declaration
public static IEnumerable<T> GetAllFeatures<T>() where T : class
Returns
Type | Description |
---|---|
IEnumerable<T> | Returns an iterator with all the features in it |
Type Parameters
Name | Description |
---|---|
T | The type of features to look for |
GetAllFeatures<T>(Func<T, bool>)
Goes through all of the loaded Registries, and find the specified features
Declaration
public static IEnumerable<T> GetAllFeatures<T>(Func<T, bool> predicate) where T : class
Parameters
Type | Name | Description |
---|---|---|
Func<T, bool> | predicate | A predicate used to only return the features that satisfy the predicate condition |
Returns
Type | Description |
---|---|
IEnumerable<T> | Returns an iterator with all the features in it |
Type Parameters
Name | Description |
---|---|
T | The type of features to look for |
GetFeature<T>()
Looks through all the loaded registries, and finds the feature of the specified type
Declaration
public static T GetFeature<T>() where T : class
Returns
Type | Description |
---|---|
T | Returns the loaded feature (or null if it doesn't exist) |
Type Parameters
Name | Description |
---|---|
T | The type of feature to find |
GetFeatures<T>()
Searches the registry and finds the specified features
Declaration
public IEnumerable<T> GetFeatures<T>() where T : class
Returns
Type | Description |
---|---|
IEnumerable<T> | Returns an iterator with all the features in it |
Type Parameters
Name | Description |
---|---|
T | The type of features to look for |
GetFeatures<T>(Func<T, bool>)
Searches the registry and finds the specifed features
Declaration
public IEnumerable<T> GetFeatures<T>(Func<T, bool> predicate) where T : class
Parameters
Type | Name | Description |
---|---|---|
Func<T, bool> | predicate | A predicate used to only return the features that satisfy the predicate condition |
Returns
Type | Description |
---|---|
IEnumerable<T> | Returns an Itereator with all the features in it |
Type Parameters
Name | Description |
---|---|
T | The type of features to look for |
Remove(Predicate<Object>)
Removes some features from the registry
Declaration
public int Remove(Predicate<Object> predicate)
Parameters
Type | Name | Description |
---|---|---|
Predicate<Object> | predicate | A predicate used to determine which feature to remove |
Returns
Type | Description |
---|---|
int | Returns how many features where removed |
RemoveAllFeatures()
Removes all features from the registry
Declaration
public void RemoveAllFeatures()
RemoveAllFeatures<T>()
Removes all features of the specified type
Declaration
public int RemoveAllFeatures<T>()
Returns
Type | Description |
---|---|
int | Returns how many features where removed |
Type Parameters
Name | Description |
---|---|
T | The type of features to remove |
Remove<T>(T)
Removes a feature from the registry
Declaration
public bool Remove<T>(T feature) where T : Object
Parameters
Type | Name | Description |
---|---|---|
T | feature | The feature to be removed |
Returns
Type | Description |
---|---|
bool | Returns whether the feature has been removed or not |
Type Parameters
Name | Description |
---|---|
T | The type of feature to remove |