< Dice
Revision as of 18:08, 20 April 2017 by Skizzerz (talk | contribs) (Created page with "{{APIdoc|FunctionRegistry Class}} Stores a mapping of all functions to their appropriate callbacks. Functions registered here can specify when they should be executed in relat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FunctionRegistry Class

From DiceRoller Documentation

Stores a mapping of all functions to their appropriate callbacks. Functions registered here can specify when they should be executed in relation to built-in dice expressions.

  • Namespace: Dice
  • Assembly: DiceRoller (in DiceRoller.dll)

Inheritance Hierarchy

System.Object

Dice.FunctionRegistry

Syntax

public class FunctionRegistry

Methods

Name Description
Contains(String, FunctionScope, Boolean) Checks if the given function has already been registered.
Get(String, FunctionScope) Retrieves the registration information for the given registered function.
RegisterFunction(String, FunctionCallback) Registers the specified global callback to the given name.
RegisterFunction(String, FunctionCallback, FunctionScope) Registers the specified callback to the given name and scope.
RegisterFunction(String, FunctionCallback, FunctionScope, FunctionTiming) Registers the specified callback to the given name, scope, and timing.
Remove(String, FunctionScope) Removes the function with the given name and scope.
RegisterType(Type) Registers all public static methods marked with DiceFunctionAttribute on the type.
RegisterType<T>(T) Registers all public static and instance methods marked with the DiceFunctionAttribute on the type, using the passed-in object when calling instance methods.

Fields

Name Description
Callbacks Contains a mapping of all registered functions to their callback and other registration information.

Remarks

Constructing a new instance of this class will not automatically register all built-in functions (floor, ceil, round, abs, max, min, if). This will let you register your own versions of these functions, if desired. However, all reserved function names (dropLowest, reroll, success, critical, etc.) are not actually implemented as functions, and can never be registered.

The FunctionRegistry constructed when constructing a new RollerConfig does register all built-in functions. If you wish to wipe them, you can reassign the registry with your own constructed instance of this class, or you can use Remove() to remove specific functions while keeping the others.