Class ContentTableModel
- Namespace
- SurvivorsMaker.Editor
- Assembly
- SurvivorsMaker.Editor.dll
Reads and writes content asset fields as text for the Content Table and its CSV import/export. Writes go through SerializedObject so every edit is undoable; multi-row edits are one Undo step.
public static class ContentTableModel
- Inheritance
-
ContentTableModel
- Inherited Members
Fields
IdKey
public const string IdKey = "Id"
Field Value
ListSeparator
public const char ListSeparator = ';'
Field Value
Methods
AssetType(ContentTableKind)
public static Type AssetType(ContentTableKind kind)
Parameters
kindContentTableKind
Returns
Columns(ContentTableKind)
public static IReadOnlyList<ContentTableColumn> Columns(ContentTableKind kind)
Parameters
kindContentTableKind
Returns
Compare(string, string)
Numeric-aware compare: numbers by value, then text case-insensitively.
public static int Compare(string a, string b)
Parameters
Returns
Editable(SerializedProperty)
Editable: numbers, booleans, strings, enums and string lists. Other fields are shown read-only.
public static bool Editable(SerializedProperty p)
Parameters
pSerializedProperty
Returns
Format(SerializedProperty)
Text of a property: invariant numbers, true/false, enum names, "a; b" for string lists, "(n)" for other lists.
public static string Format(SerializedProperty p)
Parameters
pSerializedProperty
Returns
FormatFloat(float)
public static string FormatFloat(float value)
Parameters
valuefloat
Returns
Get(Object, string)
public static string Get(Object asset, string key)
Parameters
assetObjectkeystring
Returns
IdOf(Object)
public static string IdOf(Object asset)
Parameters
assetObject
Returns
IsStringList(SerializedProperty)
public static bool IsStringList(SerializedProperty p)
Parameters
pSerializedProperty
Returns
Matches(Func<string, string>, IReadOnlyList<ContentTableColumn>, string)
Filter: space-separated terms, all must match. "key:text" matches a column whose key or title contains key (e.g. "tier:2", "tags:fire"); a bare term matches any cell. Case-insensitive substring match; "key:=text" requires an exact value.
public static bool Matches(Func<string, string> cell, IReadOnlyList<ContentTableColumn> columns, string filter)
Parameters
cellFunc<string, string>columnsIReadOnlyList<ContentTableColumn>filterstring
Returns
Rows(ContentTableKind, ContentAsset)
The content's assets of this kind (weapon tiers and wave enemies included), or every project asset when content is null.
public static List<ContentAssetBase> Rows(ContentTableKind kind, ContentAsset content)
Parameters
kindContentTableKindcontentContentAsset
Returns
Set(IList<KeyValuePair<Object, string>>, string, out string)
Per-asset values for one column, one Undo step, all-or-nothing.
public static int Set(IList<KeyValuePair<Object, string>> edits, string key, out string error)
Parameters
editsIList<KeyValuePair<Object, string>>keystringerrorstring
Returns
Set(IList<Object>, string, string, out string)
Sets key to text on every asset as one Undo step. Nothing is written
when any asset rejects the value. Returns the number of assets whose value changed.
public static int Set(IList<Object> assets, string key, string text, out string error)
Parameters
Returns
SplitList(string)
public static List<string> SplitList(string text)
Parameters
textstring
Returns
TryCanonical(SerializedProperty, string, out string, out string)
Parses text for the property; canonical is how it will read back.
public static bool TryCanonical(SerializedProperty p, string text, out string canonical, out string error)