Class LegionStore

Namespace
PixelUnitStudio
Assembly
PixelUnitStudio.Runtime.dll

Saves a hero as a prefab and reads the saved list. Saving works only in the Unity Editor.

public static class LegionStore
Inheritance
LegionStore
Inherited Members

Fields

DefaultFolder

public const string DefaultFolder = "Assets/PixelUnitStudio/Units/"

Field Value

string

Exporter

Function that exports a saved hero as a frame sheet (hero, path → written PNG path). The sheet render is editor code, so Editor/LegionAnimation fills it in when the editor loads. If empty, nothing can be exported.

public static Func<LegionUnit, string> Exporter

Field Value

Func<LegionUnit, string>

PackFolders

Hero folders of the content packs as (pack title, folder), for the edit screen's hero and action lists. Set by editor code (LegionPacks); empty in builds.

public static Func<List<(string title, string folder)>> PackFolders

Field Value

Func<List<(string title, string folder)>>

Methods

Actions(string, bool)

Loads the folder's action library, creating it if create is true. Null if there is none (or outside the Unity Editor).

public static LegionActionLibrary Actions(string folder, bool create)

Parameters

folder string
create bool

Returns

LegionActionLibrary

ActionsPath(string)

Custom action library of a save folder (folder/LegionActions.asset). Saved heroes in the folder reference it.

public static string ActionsPath(string folder)

Parameters

folder string

Returns

string

Delete(string, string)

Deletes folder/code.prefab. True if deleted.

public static bool Delete(string folder, string code)

Parameters

folder string
code string

Returns

bool

Export(LegionUnit)

Exports a saved hero using the motions of its back-hand weapon type and returns the PNG path.

public static string Export(LegionUnit unit)

Parameters

unit LegionUnit

Returns

string

NewCode()

public static string NewCode()

Returns

string

OtherPackFolders(string)

Pack hero folders other than the given save folder.

public static List<(string title, string folder)> OtherPackFolders(string folder)

Parameters

folder string

Returns

List<(string title, string folder)>

Save(LegionCatalog, IReadOnlyDictionary<string, int>, string, string, IReadOnlyDictionary<string, string>, string)

Saves the option combination as folder/code.prefab and returns the path. Overwrites if the code is the same. The preview may be in a mid-motion pose, so it is reassembled fresh from the rig original and saved in the default pose.

public static string Save(LegionCatalog catalog, IReadOnlyDictionary<string, int> choice, string folder, string code, IReadOnlyDictionary<string, string> dyes = null, string skin = null)

Parameters

catalog LegionCatalog
choice IReadOnlyDictionary<string, int>
folder string
code string
dyes IReadOnlyDictionary<string, string>
skin string

Returns

string

SaveActions(LegionActionLibrary)

Writes changes to an action library to disk (Unity Editor only).

public static void SaveActions(LegionActionLibrary library)

Parameters

library LegionActionLibrary

Saved(string)

Hero prefabs in the save folder. Returned in code order (creation order).

public static List<LegionUnit> Saved(string folder)

Parameters

folder string

Returns

List<LegionUnit>