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

string

ListSeparator

public const char ListSeparator = ';'

Field Value

char

Methods

AssetType(ContentTableKind)

public static Type AssetType(ContentTableKind kind)

Parameters

kind ContentTableKind

Returns

Type

Columns(ContentTableKind)

public static IReadOnlyList<ContentTableColumn> Columns(ContentTableKind kind)

Parameters

kind ContentTableKind

Returns

IReadOnlyList<ContentTableColumn>

Compare(string, string)

Numeric-aware compare: numbers by value, then text case-insensitively.

public static int Compare(string a, string b)

Parameters

a string
b string

Returns

int

Editable(SerializedProperty)

Editable: numbers, booleans, strings, enums and string lists. Other fields are shown read-only.

public static bool Editable(SerializedProperty p)

Parameters

p SerializedProperty

Returns

bool

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

p SerializedProperty

Returns

string

FormatFloat(float)

public static string FormatFloat(float value)

Parameters

value float

Returns

string

Get(Object, string)

public static string Get(Object asset, string key)

Parameters

asset Object
key string

Returns

string

IdOf(Object)

public static string IdOf(Object asset)

Parameters

asset Object

Returns

string

IsStringList(SerializedProperty)

public static bool IsStringList(SerializedProperty p)

Parameters

p SerializedProperty

Returns

bool

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

cell Func<string, string>
columns IReadOnlyList<ContentTableColumn>
filter string

Returns

bool

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

kind ContentTableKind
content ContentAsset

Returns

List<ContentAssetBase>

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

edits IList<KeyValuePair<Object, string>>
key string
error string

Returns

int

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

assets IList<Object>
key string
text string
error string

Returns

int

SplitList(string)

public static List<string> SplitList(string text)

Parameters

text string

Returns

List<string>

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)

Parameters

p SerializedProperty
text string
canonical string
error string

Returns

bool