Class ModifierRegistry
- Namespace
- FishMMO.Shared.NameGeneration
- Assembly
- FishMMO.Shared.dll
Runtime index of every loaded NameModifierTemplate, keyed by its normalised modifier key. A modifier is an orthogonal flavour applied on top of any race and culture; with 30 races, 3 cultures each and 10 modifiers that is 900 name profiles from roughly the authoring cost of 30.
public static class ModifierRegistry
- Inheritance
-
ModifierRegistry
- Inherited Members
Properties
Count
Number of modifiers currently registered.
public static int Count { get; }
Property Value
SupportedModifiers
Registered modifier keys in ordinal order.
public static IReadOnlyList<string> SupportedModifiers { get; }
Property Value
Methods
Apply(RacePhonology, string)
Applies a modifier to a phonology, returning a new phonology. An unknown modifier key returns the base phonology unchanged.
public static RacePhonology Apply(RacePhonology basePhonology, string modifierKey)
Parameters
basePhonologyRacePhonologymodifierKeystring
Returns
Clear()
Removes every template.
public static void Clear()
Contains(string)
public static bool Contains(string modifierKey)
Parameters
modifierKeystring
Returns
GetDisplayName(string)
Display name for a modifier key, or the key itself when unknown.
public static string GetDisplayName(string modifierKey)
Parameters
modifierKeystring
Returns
IDOf(NameModifierTemplate)
The template's cached-object ID, derived from its type and name when the cache has not assigned one.
public static int IDOf(NameModifierTemplate template)
Parameters
templateNameModifierTemplate
Returns
Register(NameModifierTemplate)
Registers a template under its key, replacing any previous holder of that key.
public static void Register(NameModifierTemplate template)
Parameters
templateNameModifierTemplate
TryGet(string, out NameModifierTemplate)
Looks a modifier up by key; the key is normalised first.
public static bool TryGet(string modifierKey, out NameModifierTemplate template)
Parameters
modifierKeystringtemplateNameModifierTemplate
Returns
TryGetByID(int, out NameModifierTemplate)
Looks a template up by its cached-object ID. Outside play mode nothing has called
AddToCache, so a template's own ID is still zero; the ID is then derived the way
the cache would derive it, which is also what a [TemplateReference] field stores.
public static bool TryGetByID(int id, out NameModifierTemplate template)
Parameters
idinttemplateNameModifierTemplate
Returns
Unregister(NameModifierTemplate)
Removes a template, but only if it is still the holder of its key.
public static void Unregister(NameModifierTemplate template)
Parameters
templateNameModifierTemplate
Events
Changed
Raised after a template is registered or removed.
public static event Action Changed