PixelCrushers.DialogueSystem.Field Class Reference

Assets are composed primarily of data elements called fields. More...

Public Member Functions

 Field ()
 Initializes a new Field. More...
 
 Field (ChatMapper.Field chatMapperField)
 Initializes a new Field copied from a Chat Mapper field. More...
 
 Field (string title, string value, FieldType type)
 Initializes a new Field. More...
 
 Field (string title, string value, FieldType type, string typeString)
 Initializes a new Field. More...
 
 Field (Field sourceField)
 Copy constructor. More...
 
void Assign (ChatMapper.Field chatMapperField)
 Copies the contents of a Chat Mapper field. More...
 

Static Public Member Functions

static FieldType StringToFieldType (string chatMapperType)
 A static utility method that converts a Chat Mapper type string into a FieldType. More...
 
static List< FieldCreateListFromChatMapperFields (List< ChatMapper.Field > chatMapperFields)
 A static utility method that creates a list of fields from a list of Chat Mapper fields. More...
 
static List< FieldCopyFields (List< Field > sourceFields)
 Copies a field list. More...
 
static bool FieldExists (List< Field > fields, string title)
 A static utility method that checks whether a field exists in a list of fields. More...
 
static Field Lookup (List< Field > fields, string title)
 A static utility method that looks up a field by title in a list of fields. More...
 
static string LookupValue (List< Field > fields, string title)
 A static utility method that looks up a field in a list and returns its string value. More...
 
static string LookupLocalizedValue (List< Field > fields, string title)
 A static utility method that looks up a localized version of a field and returns its string value. More...
 
static int LookupInt (List< Field > fields, string title)
 A static utility method that looks up a field in a list and returns its int value. More...
 
static float LookupFloat (List< Field > fields, string title)
 A static utility method that looks up a field in a list and returns its float value. More...
 
static bool LookupBool (List< Field > fields, string title)
 A static utility method that looks up a field in a list and returns its bool value. More...
 
static void SetValue (List< Field > fields, string title, string value, FieldType type)
 A static utility method that sets the string value of a field. More...
 
static void SetValue (List< Field > fields, string title, string value)
 A static utility method that sets the string value of a field. More...
 
static void SetValue (List< Field > fields, string title, float value)
 A static utility method that sets the float value of a field. More...
 
static void SetValue (List< Field > fields, string title, int value)
 A static utility method that sets the int value of a field. More...
 
static void SetValue (List< Field > fields, string title, bool value)
 A static utility method that sets the string bool of a field, if the field exists. More...
 
static bool IsFieldAssigned (List< Field > fields, string title)
 A static utility method that checks whether a field exists and has non-empty text. More...
 
static Field AssignedField (List< Field > fields, string title)
 A static utility method that returns a field if it exists and has non-empty text. More...
 
static string FieldValue (Field field)
 Returns the value of a field. More...
 
static string LocalizedTitle (string title)
 Returns the localized field title. More...
 
static string GetTypeString (FieldType type)
 

Public Attributes

string title = null
 The title of the field, such as Name or Age. More...
 
string value = null
 The value of the field, such as Fred or 42. More...
 
FieldType type = FieldType.Text
 The data type of the field, such as Text or Number. More...
 
string typeString = string.Empty
 The name of a field drawer class. More...
 

Detailed Description

Assets are composed primarily of data elements called fields.

This class represents a field, which is a <title, value, type> tuple such as <Name, Fred, Text>. This class also contains several static utility functions to work with fields.

Constructor & Destructor Documentation

◆ Field() [1/5]

PixelCrushers.DialogueSystem.Field.Field ( )

Initializes a new Field.

◆ Field() [2/5]

PixelCrushers.DialogueSystem.Field.Field ( ChatMapper.Field  chatMapperField)

Initializes a new Field copied from a Chat Mapper field.

Parameters
chatMapperFieldThe Chat Mapper field to copy.

◆ Field() [3/5]

PixelCrushers.DialogueSystem.Field.Field ( string  title,
string  value,
FieldType  type 
)

Initializes a new Field.

Parameters
titleTitle of the field.
valueValue of the field.
typeField type.

◆ Field() [4/5]

PixelCrushers.DialogueSystem.Field.Field ( string  title,
string  value,
FieldType  type,
string  typeString 
)

Initializes a new Field.

Parameters
titleTitle of the field.
valueValue of the field.
typeField type.
typeStringCustom type string.

◆ Field() [5/5]

PixelCrushers.DialogueSystem.Field.Field ( Field  sourceField)

Copy constructor.

Parameters
sourceFieldSource field.

Member Function Documentation

◆ Assign()

void PixelCrushers.DialogueSystem.Field.Assign ( ChatMapper.Field  chatMapperField)

Copies the contents of a Chat Mapper field.

Parameters
chatMapperFieldThe Chat Mapper field to copy.

◆ AssignedField()

static Field PixelCrushers.DialogueSystem.Field.AssignedField ( List< Field fields,
string  title 
)
static

A static utility method that returns a field if it exists and has non-empty text.

Returns
The field, or null if it doesn't exist or has empty text.
Parameters
fieldsA list of fields.
titleTitle of the field.

◆ CopyFields()

static List<Field> PixelCrushers.DialogueSystem.Field.CopyFields ( List< Field sourceFields)
static

Copies a field list.

Returns
A new copy of the field list.
Parameters
sourceFieldsSource fields.

◆ CreateListFromChatMapperFields()

static List<Field> PixelCrushers.DialogueSystem.Field.CreateListFromChatMapperFields ( List< ChatMapper.Field chatMapperFields)
static

A static utility method that creates a list of fields from a list of Chat Mapper fields.

Parameters
chatMapperFieldsThe Chat Mapper fields.
Returns
A list of fields copied from the Chat Mapper fields.

◆ FieldExists()

static bool PixelCrushers.DialogueSystem.Field.FieldExists ( List< Field fields,
string  title 
)
static

A static utility method that checks whether a field exists in a list of fields.

Returns
true if the field exists; otherwise false.
Parameters
fieldsA list of fields.
titleTitle of the field.

◆ FieldValue()

static string PixelCrushers.DialogueSystem.Field.FieldValue ( Field  field)
static

Returns the value of a field.

Returns
The value of the field, or null if field is null.
Parameters
fieldThe field.

◆ GetTypeString()

static string PixelCrushers.DialogueSystem.Field.GetTypeString ( FieldType  type)
static

◆ IsFieldAssigned()

static bool PixelCrushers.DialogueSystem.Field.IsFieldAssigned ( List< Field fields,
string  title 
)
static

A static utility method that checks whether a field exists and has non-empty text.

Returns
true if the field is assigned; otherwise, false.
Parameters
fieldsA list of fields.
titleTitle of the field.

◆ LocalizedTitle()

static string PixelCrushers.DialogueSystem.Field.LocalizedTitle ( string  title)
static

Returns the localized field title.

Returns
The localized title. If localization is currently using the default language, then the default title is returned.
Parameters
titleThe default title.

◆ Lookup()

static Field PixelCrushers.DialogueSystem.Field.Lookup ( List< Field fields,
string  title 
)
static

A static utility method that looks up a field by title in a list of fields.

Parameters
fieldsA list of fields.
titleTitle of the field.
Returns
The first field that matches the title, or null if no field matches.

◆ LookupBool()

static bool PixelCrushers.DialogueSystem.Field.LookupBool ( List< Field fields,
string  title 
)
static

A static utility method that looks up a field in a list and returns its bool value.

Parameters
fieldsA list of fields.
titleTitle of the field.
Returns
The value of the field, or false if the field doesn't exist or isn't a bool.

◆ LookupFloat()

static float PixelCrushers.DialogueSystem.Field.LookupFloat ( List< Field fields,
string  title 
)
static

A static utility method that looks up a field in a list and returns its float value.

Parameters
fieldsA list of fields.
titleTitle of the field.
Returns
The value of the field, or 0 if the field doesn't exist or isn't a float.

◆ LookupInt()

static int PixelCrushers.DialogueSystem.Field.LookupInt ( List< Field fields,
string  title 
)
static

A static utility method that looks up a field in a list and returns its int value.

Parameters
fieldsA list of fields.
titleTitle of the field.
Returns
The value of the field, or 0 if the field doesn't exist or isn't an int.

◆ LookupLocalizedValue()

static string PixelCrushers.DialogueSystem.Field.LookupLocalizedValue ( List< Field fields,
string  title 
)
static

A static utility method that looks up a localized version of a field and returns its string value.

Given a title, this method looks for a field appended with a blank space character or underscore and then the current language code.

Returns
The localized value.
Parameters
fieldsA list of fields.
titleThe title of the field.

◆ LookupValue()

static string PixelCrushers.DialogueSystem.Field.LookupValue ( List< Field fields,
string  title 
)
static

A static utility method that looks up a field in a list and returns its string value.

Parameters
fieldsA list of fields.
titleTitle of the field.
Returns
The value of the field, or null if the field doesn't exist in the list.

◆ SetValue() [1/5]

static void PixelCrushers.DialogueSystem.Field.SetValue ( List< Field fields,
string  title,
bool  value 
)
static

A static utility method that sets the string bool of a field, if the field exists.

Parameters
fieldsA list of fields.
titleThe title of the field to set.
valueThe new value of the field.

◆ SetValue() [2/5]

static void PixelCrushers.DialogueSystem.Field.SetValue ( List< Field fields,
string  title,
float  value 
)
static

A static utility method that sets the float value of a field.

Parameters
fieldsA list of fields.
titleThe title of the field to set.
valueThe new value of the field.

◆ SetValue() [3/5]

static void PixelCrushers.DialogueSystem.Field.SetValue ( List< Field fields,
string  title,
int  value 
)
static

A static utility method that sets the int value of a field.

Parameters
fieldsA list of fields.
titleThe title of the field to set.
valueThe new value of the field.

◆ SetValue() [4/5]

static void PixelCrushers.DialogueSystem.Field.SetValue ( List< Field fields,
string  title,
string  value 
)
static

A static utility method that sets the string value of a field.

Parameters
fieldsA list of fields.
titleThe title of the field to set.
valueThe new value of the field.

◆ SetValue() [5/5]

static void PixelCrushers.DialogueSystem.Field.SetValue ( List< Field fields,
string  title,
string  value,
FieldType  type 
)
static

A static utility method that sets the string value of a field.

Parameters
fieldsA list of fields.
titleThe title of the field to set.
valueThe new value of the field.
typeThe type of the field.

◆ StringToFieldType()

static FieldType PixelCrushers.DialogueSystem.Field.StringToFieldType ( string  chatMapperType)
static

A static utility method that converts a Chat Mapper type string into a FieldType.

Parameters
chatMapperTypeThe Chat Mapper type string.
Returns
The field type associated with the Chat Mapper type string.

Member Data Documentation

◆ title

string PixelCrushers.DialogueSystem.Field.title = null

The title of the field, such as Name or Age.

◆ type

FieldType PixelCrushers.DialogueSystem.Field.type = FieldType.Text

The data type of the field, such as Text or Number.

◆ typeString

string PixelCrushers.DialogueSystem.Field.typeString = string.Empty

The name of a field drawer class.

◆ value

string PixelCrushers.DialogueSystem.Field.value = null

The value of the field, such as Fred or 42.


The documentation for this class was generated from the following file: