Table of Contents

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

int

SupportedModifiers

Registered modifier keys in ordinal order.

public static IReadOnlyList<string> SupportedModifiers { get; }

Property Value

IReadOnlyList<string>

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

basePhonology RacePhonology
modifierKey string

Returns

RacePhonology

Clear()

Removes every template.

public static void Clear()

Contains(string)

public static bool Contains(string modifierKey)

Parameters

modifierKey string

Returns

bool

GetDisplayName(string)

Display name for a modifier key, or the key itself when unknown.

public static string GetDisplayName(string modifierKey)

Parameters

modifierKey string

Returns

string

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

template NameModifierTemplate

Returns

int

Register(NameModifierTemplate)

Registers a template under its key, replacing any previous holder of that key.

public static void Register(NameModifierTemplate template)

Parameters

template NameModifierTemplate

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

modifierKey string
template NameModifierTemplate

Returns

bool

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

id int
template NameModifierTemplate

Returns

bool

Unregister(NameModifierTemplate)

Removes a template, but only if it is still the holder of its key.

public static void Unregister(NameModifierTemplate template)

Parameters

template NameModifierTemplate

Events

Changed

Raised after a template is registered or removed.

public static event Action Changed

Event Type

Action