Word Game Builder 2.0.1f2
Reference Manual
|
Represents a language for a word game. More...
Public Member Functions | |
void | ClearCulture () |
Clears the culture of a language, resetting it to use the invariant culture. More... | |
void | ClearRandomLetterCache () |
Clears the cache of random letters. More... | |
WordGameLanguage | Copy () |
Deep copy this language to a new language. A unique name will be assigned to the language identifier. More... | |
WordGameLanguage | Copy (string newName, string newIdentifier) |
Deep copy this language to a new language. More... | |
void | ExportLettersToCsv (Stream stream) |
Exports the letters of a language to a CSV file. More... | |
void | ExportWordsToCsv (Stream stream) |
Exports the words of a language to a CSV file. More... | |
Letter | GetLetter (string letter) |
Gets the Letter struct for the specified string (Letter.text). More... | |
Letter | GetLetter (char letterValue) |
Gets the Letter struct for the specified character value (Letter.character). More... | |
Letter | GetRandomLetter () |
Gets a random letter from the language's alphabet. More... | |
Letter | GetRandomLetter (bool weighted) |
Gets a random letter from the language's alphabet. More... | |
IList< Letter > | GetRandomLetters (int count) |
Gets a list of random letters from the language's alphabet, up to the specified count. More... | |
IList< Letter > | GetRandomLetters (int count, bool weighted) |
Gets a list of random letters from the language's alphabet, up to the specified count. More... | |
System.Random | GetRandomNumberGenerator () |
Gets the psuedo-random number generator for the language. More... | |
string | GetRandomWord () |
Gets a random word from the language. More... | |
string | GetRandomWord (int maxLetters) |
Gets a random word from the language, ensuring that it is under the maximum amount of letters. More... | |
IList< string > | GetWords () |
Gets an array of all words in the language. More... | |
void | ImportLettersFromCsv (Stream stream) |
Imports the letters of a language from a CSV stream. More... | |
void | ImportWordsFromCsv (Stream stream) |
Imports the words of a language from a CSV file. More... | |
void | ImportWordsFromCsv (Stream stream, bool append) |
Imports the words of a language from a CSV file. More... | |
Letter | NextLetter (Letter firstLetter) |
Gets the next letter in the language's alphabet. More... | |
Letter | NextLetter (Letter firstLetter, bool wrap) |
Gets the next letter in the language's alphabet. More... | |
Letter | PreviousLetter (Letter firstLetter) |
Gets the previous letter in the language's alphabet. More... | |
Letter | PreviousLetter (Letter firstLetter, bool wrap) |
Gets the previous letter in the language's alphabet. More... | |
void | SetCulture (string cultureCode) |
Sets the culture of a language. More... | |
void | SetRandomNumberGenerator (int seed) |
Sets the psuedo-random number generator for the language. The pRNG's seed is time-based by default. More... | |
override string | ToString () |
Returns a string that represents the current language. More... | |
Static Public Member Functions | |
static WordGameLanguage | Create (string name, string identifier) |
Creates a language with the given name and identifier (file name). More... | |
static WordGameLanguage | FindByIdentifier (string identifier) |
Finds a loaded language by identifier. More... | |
static WordGameLanguage | FindByName (string name) |
Finds the first occurance of a loaded language by name. More... | |
static void | LoadAllLanguages () |
Loads all language files from resources. More... | |
static WordGameLanguage | LoadLanguage (string identifier) |
Loads a language by identifier (file name). More... | |
static void | RemoveAll () |
Completely unloads all languages. More... | |
static void | RemoveByIdentifier (string identifier) |
Unloads a language by identifier. More... | |
static void | RemoveByName (string name) |
Unloads the first occurance of a language by name. More... | |
Properties | |
bool | allowBlanks [get, set] |
Gets or sets whether the language should allow blank or wildcard letters. More... | |
int | blankLetterWeight [get, set] |
Gets or sets the weight of blank letters for random distribution. More... | |
bool | caseSensitive [get, set] |
Gets or sets whether string lookups should be case-sensitive. More... | |
CultureInfo | culture [get] |
The language's culture. More... | |
string | cultureName [get] |
The language's culture code. More... | |
static WordGameLanguage | current [get, set] |
Gets or sets the current language. More... | |
static bool | decompressOnLoad [get, set] |
Should a language automatically be decompressed on load? More... | |
static string | defaultLanguage [get, set] |
Gets or sets the default language, by name. This value is saved to PlayerPrefs. More... | |
string | identifier [get, set] |
Gets or sets the language's identifier (usually the file name). More... | |
string | languageName [get, set] |
Gets or sets the language name. More... | |
IList< Letter > | letters [get] |
Gets the list of letters in the language. More... | |
int | wordCount [get] |
Gets the number of words in the language. More... | |
WordSet | wordSet [get] |
The WordSet data structure of the language. More... | |
Represents a language for a word game.
Most aspects of a language are edited through the Language Editor.
|
inline |
Clears the culture of a language, resetting it to use the invariant culture.
|
inline |
Clears the cache of random letters.
This needs to be called manually if you use a random letter method and change letter information or enable/disable blank letters at runtime.
|
inline |
Deep copy this language to a new language. A unique name will be assigned to the language identifier.
> The language's random number generator is not deep copied with this method.
|
inline |
Deep copy this language to a new language.
newName | The name of the new language. |
newIdentifier | The idenfitier of the new language. Must be unique. |
> The language's random number generator is not deep copied with this method.
|
inlinestatic |
Creates a language with the given name and identifier (file name).
name | The new language name. |
identifier | The new language identifier. Must be unique. |
|
inline |
Exports the letters of a language to a CSV file.
stream | The stream to export letters to. |
After exporting, the stream must be closed manually.
|
inline |
Exports the words of a language to a CSV file.
stream | The stream to export letters to. |
After exporting, the stream must be closed manually.
|
inlinestatic |
Finds a loaded language by identifier.
identifier | The identifier to search for. |
null
if no language was found..
|
inlinestatic |
Finds the first occurance of a loaded language by name.
name | The name to search for. |
null
if no language was found..
|
inline |
Gets the Letter struct for the specified string (Letter.text).
letter | The letter string to search for. |
|
inline |
Gets the Letter struct for the specified character value (Letter.character).
letterValue | The letter character value to search for. |
|
inline |
Gets a random letter from the language's alphabet.
Uses a weighted distribution based on score by default.
|
inline |
Gets a random letter from the language's alphabet.
Uses a weighted distribution based on score by default.
weighted | If true , a weighted distribution of letters will be used, based on score. |
|
inline |
Gets a list of random letters from the language's alphabet, up to the specified count.
Uses a weighted distribution based on score by default.
count | The amount of random letters to obtain. |
|
inline |
Gets a list of random letters from the language's alphabet, up to the specified count.
Uses a weighted distribution based on score by default.
count | The amount of random letters to obtain. |
weighted | If true , a weighted distribution of letters will be used, based on score. |
|
inline |
Gets the psuedo-random number generator for the language.
The pRNG is used for picking random letters, random words, and lossy prefix search.
|
inline |
Gets a random word from the language.
|
inline |
Gets a random word from the language, ensuring that it is under the maximum amount of letters.
This is a recursive random search and hard-capped at 10,000 iterations (it returns null on failure). It is recommended to prune unused words from the language to help ensure this search does not fail.
maxLetters | The maximum amount of letters permitted for a random word. |
|
inline |
Gets an array of all words in the language.
This is a very expensive operation and is usually not needed.
|
inline |
Imports the letters of a language from a CSV stream.
stream | The stream to import letters from. |
After importing, the stream must be closed manually.
|
inline |
Imports the words of a language from a CSV file.
stream | The stream to import words from. |
After importing, the stream must be closed manually.
|
inline |
Imports the words of a language from a CSV file.
stream | The stream to import words from. |
append | If true , append the words to the current set. |
After importing, the stream must be closed manually.
|
inlinestatic |
Loads all language files from resources.
|
inlinestatic |
Loads a language by identifier (file name).
identifier | The language identifier to load. |
Gets the next letter in the language's alphabet.
Wraps back to the first letter by default. If allowBlanks is enabled, includes a blank letter at the end of the alphabet.
firstLetter | The letter to move from. |
Gets the next letter in the language's alphabet.
If allowBlanks is enabled, includes a blank letter at the end of the alphabet.
firstLetter | The letter to move from. |
wrap | If true , wrap to the first letter if this is run on the last letter. |
Gets the previous letter in the language's alphabet.
Wraps back to the last letter by default. If allowBlanks is enabled, includes a blank letter at the end of the alphabet.
firstLetter | The letter to move from. |
Gets the previous letter in the language's alphabet.
If allowBlanks is enabled, includes a blank letter at the end of the alphabet.
firstLetter | The letter to move from. |
wrap | If true , wrap to the last letter if this is run on the first letter. |
|
inlinestatic |
Completely unloads all languages.
This method does not delete the actual language file, to prevent unintentional data loss.
|
inlinestatic |
Unloads a language by identifier.
This method does not delete the actual language file, to prevent unintentional data loss.
identifier | The identifier to search for. |
|
inlinestatic |
Unloads the first occurance of a language by name.
This method does not delete the actual language file, to prevent unintentional data loss.
name | The name to search for. |
|
inline |
Sets the culture of a language.
cultureCode | The culture code to set. |
This will trigger a re-optimization of the language.
|
inline |
Sets the psuedo-random number generator for the language. The pRNG's seed is time-based by default.
seed | The random seed to assign to the language. |
The pRNG is used for picking random letters, random words, and lossy prefix search.
|
inline |
Returns a string that represents the current language.
|
getset |
Gets or sets whether the language should allow blank or wildcard letters.
|
getset |
Gets or sets the weight of blank letters for random distribution.
Must be positive. Higher values = less occurances.
|
getset |
Gets or sets whether string lookups should be case-sensitive.
If disabled, all data is normalized to upper-case.
|
get |
The language's culture.
Returns the invariant culture by default.
|
get |
The language's culture code.
|
staticgetset |
Gets or sets the current language.
If the current language is not set, this property returns the default language (if available), or the first loaded language. If no languages are loaded, this property attempts to load all langauges with Language.LoadLanguages(). Due to how Unity compares objects, this property is not thread-safe. To get around this, cache the language first.
|
staticgetset |
Should a language automatically be decompressed on load?
Note that this only applies to languages called with Language.current. Other languages will only decompress if set to the current language.
|
staticgetset |
Gets or sets the default language, by name. This value is saved to PlayerPrefs.
This is initially set to English.
|
getset |
Gets or sets the language's identifier (usually the file name).
|
getset |
Gets or sets the language name.
|
get |
Gets the list of letters in the language.
This list is automatically sorted in alphabetical order, based on the language's culture. Modifying this list may automatically trigger word list optimization.
|
get |
Gets the number of words in the language.
|
get |
The WordSet data structure of the language.
This holds all of a language's words.