Scripting API
Scripting API
StringTable
Class in Abyss.Core, from Abyss.Core.
A string table: a .strings file of a game's assets, its entries' strings in every language the game has, each entry with an identity it keeps. A built game carries each language's strings apart; see Pack.
public sealed class StringTableRemarks
The file is JSON: abyssStrings, its version; nextId, the identity the next entry made is given, so none is given twice; and entries, each by its name, with its id, its text in each language by its code, and for a string with a count, plural, the argument its forms are picked by, each language's text then being its forms by name:
"Coins": { "id": 4, "plural": "count", "text": { "en": { "one": "{count} coin", "other": "{count} coins" } } }Properties
NextId
public uint NextId { get; private set; }The identity the next entry made is given.
Entries
public List<StringEntry> Entries { get; }Its entries, in the order the table lists them.
Methods
Is
public static bool Is(string path)Whether a path is a string table's.
Parameters
path
New
public static string New()A new table's text: no entries.
IsKey
public static bool IsKey(string key)Whether a name is an entry's: a letter or _, then letters, digits and _, so code can name it as it is.
Parameters
key
ClassNames
public static IReadOnlyDictionary<string, string> ClassNames(IEnumerable<string> paths)The class each table's keys are in, by its path under the assets, as the build names them: its file's name as a word, main menu as MainMenu, a number after it where two tables have one name.
Parameters
paths
CodeOf
public static string CodeOf(string tableClass, string key)How code names an entry of a table's class: Strings.Menu.Play.
Parameters
tableClasskey
Find
public StringEntry? Find(string key)The entry of a name, or null.
Parameters
key
FindId
public StringEntry? FindId(uint id)The entry of an identity, or null.
Parameters
id
Add
public StringEntry Add(string key)Makes an entry of a name at the table's end, given the next identity.
Parameters
key
Exceptions
ArgumentException: The name is no entry's, or another entry has it.
Parse
public static StringTable Parse(string json)A table from its file's text.
Parameters
json
Exceptions
FormatException: It is not a string table this build reads, saying why.
ToJson
public string ToJson()The table as its file holds it: its entries in order, each language's text by its code in code order.
Pack
public static byte[] Pack(string language, IEnumerable<(AssetGuid Table, StringTable Strings)> tables)One language's strings of every table given, in the form the engine reads them: what a language's strings are handed to the engine as, and what a built game carries of each language.
Parameters
languagetables
Constants
Extension
public const string Extension = ".strings"A string table's file extension.
CurrentVersion
public const int CurrentVersion = 1The version of the file this build writes, and the newest it reads.
Count
public const string Count = "count"The argument an entry's plural forms are picked by where it names none.
