Class TextTable
- Namespace
- TDMaker.Unity.Localization
- Assembly
- TDMaker.Unity.dll
A string table for one language: key → text. Create one with Assets/Create/2D Tower Defense Maker/Text Table, set its
LanguageCode ("en", "ko", "de", ...) and add it to textTables.
Entries with an empty text count as missing (the English text is used instead), so a partly translated table still works.
Several tables may share a language; later tables in the settings list override earlier ones.
[CreateAssetMenu(menuName = "2D Tower Defense Maker/Text Table", fileName = "TextTable", order = 41)]
public sealed class TextTable : ScriptableObject, ITextProvider
- Inheritance
-
ObjectScriptableObjectTextTable
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Constructors
TextTable()
public TextTable()
Properties
Count
Number of entries.
public int Count { get; }
Property Value
EditVersion
Incremented whenever any table changes (edited in the inspector or through Set(string, string)); resolvers rebuild on change.
public static int EditVersion { get; }
Property Value
Entries
The entries in authoring order.
public IReadOnlyList<TextTable.Entry> Entries { get; }
Property Value
LanguageCode
Language code of this table.
public string LanguageCode { get; set; }
Property Value
LanguageName
Display name of the language.
public string LanguageName { get; set; }
Property Value
Methods
Clear()
Removes every entry.
public void Clear()
Contains(string)
Whether the table has an entry (with any text) for key.
public bool Contains(string key)
Parameters
keystring
Returns
Matches(string)
Whether this table serves language (see LanguageMatches(string, string)).
public bool Matches(string language)
Parameters
languagestring
Returns
Remove(string)
Removes the entry of key; returns whether one existed.
public bool Remove(string key)
Parameters
keystring
Returns
Set(string, string)
Adds or replaces the text of key (for tools, importers and tests).
public void Set(string key, string text)
Parameters
TryGetText(string, out string)
Looks up key. Returns false (or an empty text) when the provider has no text for it, so the resolver
falls back to the English text and then to the key itself. Texts may contain rich-text tags and
Format(string, object) placeholders ({0}, {1}) where the key expects numbers or names.
public bool TryGetText(string key, out string text)