Loading...
Searching...
No Matches
PixelCrushers.TextTable Class Reference

A TextTable is a 2D table of languages and fields. More...

Inheritance diagram for PixelCrushers.TextTable:
Collaboration diagram for PixelCrushers.TextTable:

Classes

struct  FieldKeyValuePair
 
struct  LanguageKeyValuePair
 

Public Member Functions

void OnBeforeSerialize ()
 
void OnAfterDeserialize ()
 
bool HasLanguage (string languageName)
 Returns true if the text table has the named language.
 
bool HasLanguage (int languageID)
 Returns true if the text table has a language with the specified ID.
 
string GetLanguageName (int languageID)
 Returns the name of the language with the specified ID.
 
int GetLanguageID (string languageName)
 Returns the ID of the named language.
 
string[] GetLanguageNames ()
 Returns the names of all languages in the text table.
 
int[] GetLanguageIDs ()
 Gets the IDs of all languages in the text table.
 
void AddLanguage (string languageName)
 Adds a language to the text table.
 
void RemoveLanguage (string languageName)
 Removes a language from the text table, including all of its fields.
 
void RemoveLanguage (int languageID)
 Removes a language from the text table, including all of its fields.
 
void RemoveAll ()
 Removes all languages and fields.
 
void SortLanguages ()
 Sort languages alphabetically, always keeping Default first.
 
bool HasField (int fieldID)
 Returns true if the text table has a field with the specified field ID.
 
bool HasField (string fieldName)
 Returns true if the text table has a field with the specified name.
 
TextTableField GetField (int fieldID)
 Looks up a field by ID.
 
TextTableField GetField (string fieldName)
 Looks up a field by name.
 
int GetFieldID (string fieldName)
 Returns the ID associated with a field name.
 
string GetFieldName (int fieldID)
 Returns the name of the field with the specified ID.
 
bool HasFieldTextForLanguage (int fieldID, int languageID)
 Returns true if the field has text for a specified language.
 
bool HasFieldTextForLanguage (int fieldID, string languageName)
 Returns true if the field has text for a specified language.
 
bool HasFieldTextForLanguage (string fieldName, int languageID)
 Returns true if the field has text for a specified language.
 
bool HasFieldTextForLanguage (string fieldName, string languageName)
 Returns true if the field has text for a specified language.
 
string GetFieldTextForLanguage (int fieldID, int languageID)
 Looks up a field's localized text for a specified language.
 
string GetFieldTextForLanguage (int fieldID, string languageName)
 Looks up a field's localized text for a specified language.
 
string GetFieldTextForLanguage (string fieldName, int languageID)
 Looks up a field's localized text for a specified language.
 
string GetFieldTextForLanguage (string fieldName, string languageName)
 Looks up a field's localized text for a specified language.
 
string GetFieldText (int fieldID)
 Looks up a fields localized text for the current language specified by TextTable.currentLanguageID.
 
string GetFieldText (string fieldName)
 Looks up a fields localized text for the current language specified by TextTable.currentLanguageID.
 
int[] GetFieldIDs ()
 Returns all field IDs in the text table.
 
string[] GetFieldNames ()
 Returns all field names in the text table.
 
void AddField (string fieldName)
 Adds a field to the text table.
 
void SetFieldTextForLanguage (int fieldID, int languageID, string text)
 Sets a field's localized text for a specified language.
 
void SetFieldTextForLanguage (string fieldName, int languageID, string text)
 Sets a field's localized text for a specified language.
 
void SetFieldTextForLanguage (int fieldID, string languageName, string text)
 Sets a field's localized text for a specified language.
 
void SetFieldTextForLanguage (string fieldName, string languageName, string text)
 Sets a field's localized text for a specified language.
 
void RemoveField (int fieldID)
 Removes a field from the text table.
 
void RemoveField (string fieldName)
 Removes a field from the text table.
 
void RemoveAllFields ()
 Removes all fields.
 
void InsertField (int index, string fieldName)
 Inserts a field to the text table.
 
void SortFields ()
 Sort fields alphabetically.
 
void ReorderFields (List< string > order)
 
void ImportOtherTextTable (TextTable other)
 

Properties

static bool useDefaultLanguageForBlankTranslations [get, set]
 If a language's field value is blank, use the default language's field value.
 
static int currentLanguageID [get, set]
 ID of the current language.
 
Dictionary< string, int > languages [get, set]
 
Dictionary< int, TextTableFieldfields [get, set]
 
int nextLanguageID [get]
 
int nextFieldID [get]
 

Detailed Description

A TextTable is a 2D table of languages and fields.

Member Function Documentation

◆ AddField()

void PixelCrushers.TextTable.AddField ( string  fieldName)
inline

Adds a field to the text table.

◆ AddLanguage()

void PixelCrushers.TextTable.AddLanguage ( string  languageName)
inline

Adds a language to the text table.

The language will be assigned a unique ID.

◆ GetField() [1/2]

TextTableField PixelCrushers.TextTable.GetField ( int  fieldID)
inline

Looks up a field by ID.

◆ GetField() [2/2]

TextTableField PixelCrushers.TextTable.GetField ( string  fieldName)
inline

Looks up a field by name.

◆ GetFieldID()

int PixelCrushers.TextTable.GetFieldID ( string  fieldName)
inline

Returns the ID associated with a field name.

◆ GetFieldIDs()

int[] PixelCrushers.TextTable.GetFieldIDs ( )
inline

Returns all field IDs in the text table.

Returns

◆ GetFieldName()

string PixelCrushers.TextTable.GetFieldName ( int  fieldID)
inline

Returns the name of the field with the specified ID.

◆ GetFieldNames()

string[] PixelCrushers.TextTable.GetFieldNames ( )
inline

Returns all field names in the text table.

Returns

◆ GetFieldText() [1/2]

string PixelCrushers.TextTable.GetFieldText ( int  fieldID)
inline

Looks up a fields localized text for the current language specified by TextTable.currentLanguageID.

◆ GetFieldText() [2/2]

string PixelCrushers.TextTable.GetFieldText ( string  fieldName)
inline

Looks up a fields localized text for the current language specified by TextTable.currentLanguageID.

◆ GetFieldTextForLanguage() [1/4]

string PixelCrushers.TextTable.GetFieldTextForLanguage ( int  fieldID,
int  languageID 
)
inline

Looks up a field's localized text for a specified language.

◆ GetFieldTextForLanguage() [2/4]

string PixelCrushers.TextTable.GetFieldTextForLanguage ( int  fieldID,
string  languageName 
)
inline

Looks up a field's localized text for a specified language.

◆ GetFieldTextForLanguage() [3/4]

string PixelCrushers.TextTable.GetFieldTextForLanguage ( string  fieldName,
int  languageID 
)
inline

Looks up a field's localized text for a specified language.

◆ GetFieldTextForLanguage() [4/4]

string PixelCrushers.TextTable.GetFieldTextForLanguage ( string  fieldName,
string  languageName 
)
inline

Looks up a field's localized text for a specified language.

◆ GetLanguageID()

int PixelCrushers.TextTable.GetLanguageID ( string  languageName)
inline

Returns the ID of the named language.

◆ GetLanguageIDs()

int[] PixelCrushers.TextTable.GetLanguageIDs ( )
inline

Gets the IDs of all languages in the text table.

◆ GetLanguageName()

string PixelCrushers.TextTable.GetLanguageName ( int  languageID)
inline

Returns the name of the language with the specified ID.

◆ GetLanguageNames()

string[] PixelCrushers.TextTable.GetLanguageNames ( )
inline

Returns the names of all languages in the text table.

◆ HasField() [1/2]

bool PixelCrushers.TextTable.HasField ( int  fieldID)
inline

Returns true if the text table has a field with the specified field ID.

◆ HasField() [2/2]

bool PixelCrushers.TextTable.HasField ( string  fieldName)
inline

Returns true if the text table has a field with the specified name.

◆ HasFieldTextForLanguage() [1/4]

bool PixelCrushers.TextTable.HasFieldTextForLanguage ( int  fieldID,
int  languageID 
)
inline

Returns true if the field has text for a specified language.

◆ HasFieldTextForLanguage() [2/4]

bool PixelCrushers.TextTable.HasFieldTextForLanguage ( int  fieldID,
string  languageName 
)
inline

Returns true if the field has text for a specified language.

◆ HasFieldTextForLanguage() [3/4]

bool PixelCrushers.TextTable.HasFieldTextForLanguage ( string  fieldName,
int  languageID 
)
inline

Returns true if the field has text for a specified language.

◆ HasFieldTextForLanguage() [4/4]

bool PixelCrushers.TextTable.HasFieldTextForLanguage ( string  fieldName,
string  languageName 
)
inline

Returns true if the field has text for a specified language.

◆ HasLanguage() [1/2]

bool PixelCrushers.TextTable.HasLanguage ( int  languageID)
inline

Returns true if the text table has a language with the specified ID.

◆ HasLanguage() [2/2]

bool PixelCrushers.TextTable.HasLanguage ( string  languageName)
inline

Returns true if the text table has the named language.

◆ ImportOtherTextTable()

void PixelCrushers.TextTable.ImportOtherTextTable ( TextTable  other)
inline

◆ InsertField()

void PixelCrushers.TextTable.InsertField ( int  index,
string  fieldName 
)
inline

Inserts a field to the text table.

◆ OnAfterDeserialize()

void PixelCrushers.TextTable.OnAfterDeserialize ( )
inline

◆ OnBeforeSerialize()

void PixelCrushers.TextTable.OnBeforeSerialize ( )
inline

◆ RemoveAll()

void PixelCrushers.TextTable.RemoveAll ( )
inline

Removes all languages and fields.

◆ RemoveAllFields()

void PixelCrushers.TextTable.RemoveAllFields ( )
inline

Removes all fields.

◆ RemoveField() [1/2]

void PixelCrushers.TextTable.RemoveField ( int  fieldID)
inline

Removes a field from the text table.

◆ RemoveField() [2/2]

void PixelCrushers.TextTable.RemoveField ( string  fieldName)
inline

Removes a field from the text table.

◆ RemoveLanguage() [1/2]

void PixelCrushers.TextTable.RemoveLanguage ( int  languageID)
inline

Removes a language from the text table, including all of its fields.

◆ RemoveLanguage() [2/2]

void PixelCrushers.TextTable.RemoveLanguage ( string  languageName)
inline

Removes a language from the text table, including all of its fields.

◆ ReorderFields()

void PixelCrushers.TextTable.ReorderFields ( List< string >  order)
inline

◆ SetFieldTextForLanguage() [1/4]

void PixelCrushers.TextTable.SetFieldTextForLanguage ( int  fieldID,
int  languageID,
string  text 
)
inline

Sets a field's localized text for a specified language.

◆ SetFieldTextForLanguage() [2/4]

void PixelCrushers.TextTable.SetFieldTextForLanguage ( int  fieldID,
string  languageName,
string  text 
)
inline

Sets a field's localized text for a specified language.

◆ SetFieldTextForLanguage() [3/4]

void PixelCrushers.TextTable.SetFieldTextForLanguage ( string  fieldName,
int  languageID,
string  text 
)
inline

Sets a field's localized text for a specified language.

◆ SetFieldTextForLanguage() [4/4]

void PixelCrushers.TextTable.SetFieldTextForLanguage ( string  fieldName,
string  languageName,
string  text 
)
inline

Sets a field's localized text for a specified language.

◆ SortFields()

void PixelCrushers.TextTable.SortFields ( )
inline

Sort fields alphabetically.

◆ SortLanguages()

void PixelCrushers.TextTable.SortLanguages ( )
inline

Sort languages alphabetically, always keeping Default first.

Property Documentation

◆ currentLanguageID

int PixelCrushers.TextTable.currentLanguageID
staticgetset

ID of the current language.

◆ fields

Dictionary<int, TextTableField> PixelCrushers.TextTable.fields
getset

◆ languages

Dictionary<string, int> PixelCrushers.TextTable.languages
getset

◆ nextFieldID

int PixelCrushers.TextTable.nextFieldID
get

◆ nextLanguageID

int PixelCrushers.TextTable.nextLanguageID
get

◆ useDefaultLanguageForBlankTranslations

bool PixelCrushers.TextTable.useDefaultLanguageForBlankTranslations
staticgetset

If a language's field value is blank, use the default language's field value.


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