Show / Hide Table of Contents

Class Registry

Used to store a variety of features to be added to the game

Inheritance
object
Object
ScriptableObject
Registry
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance(string)
ScriptableObject.CreateInstance(Type)
ScriptableObject.CreateInstance<T>()
Namespace: WeaverCore
Assembly: WeaverCore.dll
Syntax
[CreateAssetMenu(fileName = "Registry", menuName = "WeaverCore/Registry", order = 1)]
public class Registry : ScriptableObject

Properties

| Edit this page View Source

AllRegistries

Declaration
public static IEnumerable<Registry> AllRegistries { get; }
Property Value
Type Description
IEnumerable<Registry>
| Edit this page View Source

Enabled

Is this registry currently enabled?

Declaration
public bool Enabled { get; }
Property Value
Type Description
bool
| Edit this page View Source

FeatureCount

The amount of features added to this registry

Declaration
public int FeatureCount { get; }
Property Value
Type Description
int
| Edit this page View Source

Features

Retrieves a list of all the features added to this registry

Declaration
public IEnumerable<Object> Features { get; }
Property Value
Type Description
IEnumerable<Object>
| Edit this page View Source

ModAssemblyName

The name of the assembly this registry is bound to

Declaration
public string ModAssemblyName { get; }
Property Value
Type Description
string
| Edit this page View Source

ModName

The name of the mod this registry is bound to

Declaration
public string ModName { get; }
Property Value
Type Description
string
| Edit this page View Source

ModType

The mod this registry is bound to

Declaration
public Type ModType { get; }
Property Value
Type Description
Type

Methods

| Edit this page View Source

AddFeature<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

| Edit this page View Source

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
| Edit this page View Source

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
| Edit this page View Source

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

| Edit this page View Source

DisableRegistry()

Disables the registry and its features

Declaration
public void DisableRegistry()
| Edit this page View Source

EnableRegistry()

Enables the registry and its features

Declaration
public void EnableRegistry()
| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

RemoveAllFeatures()

Removes all features from the registry

Declaration
public void RemoveAllFeatures()
| Edit this page View Source

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

| Edit this page View Source

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

Extension Methods

ReflectionUtilities.ReflectCallMethod(object, string, object[], BindingFlags)
ReflectionUtilities.ReflectGetField(object, string, BindingFlags)
ReflectionUtilities.ReflectGetMethod(object, string, BindingFlags)
ReflectionUtilities.ReflectGetProperty(object, string, BindingFlags)
ReflectionUtilities.ReflectSetField(object, string, object, BindingFlags)
ReflectionUtilities.ReflectSetProperty(object, string, object, BindingFlags)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Generated by DocFX
☀
☾