Class LegionEditor

Namespace
PixelUnitStudio
Assembly
PixelUnitStudio.Runtime.dll

Edit screen. It does not use the existing maker screen; the whole screen is built in code. The left is the slot list (current part art and name), the center is the preview and motions, and the right is the option grid of the chosen slot. UI text is in English. An option is applied with one click, and the first cell "None" removes it. Randomize, undo, hero list and save are in the top bar. For dyeable parts, a row of dye swatches appears above the options (the first cell is the original color). The preview is rendered 1:1 in pixels by a separate camera and shown scaled up by an integer factor.

public sealed class LegionEditor : MonoBehaviour
Inheritance
LegionEditor

Constructors

LegionEditor()

public LegionEditor()

Fields

catalog

public LegionCatalog catalog

Field Value

LegionCatalog

unitFolder

public string unitFolder

Field Value

string

Properties

ActionLibrary

Action library of the save folder. Created on the first saved action.

public LegionActionLibrary ActionLibrary { get; }

Property Value

LegionActionLibrary

ActionsOpen

public bool ActionsOpen { get; }

Property Value

bool

Builder

public LegionBuilder Builder { get; }

Property Value

LegionBuilder

Dirty

public bool Dirty { get; }

Property Value

bool

Draft

Action being built in the Actions panel.

public LegionAction Draft { get; }

Property Value

LegionAction

LibraryOpen

public bool LibraryOpen { get; }

Property Value

bool

LoadedCode

public string LoadedCode { get; }

Property Value

string

SelectedSlot

public string SelectedSlot { get; }

Property Value

string

Methods

AddStep(string)

Adds a motion as the draft's last step. The same motion twice in a row counts up the repeat instead.

public void AddStep(string motion)

Parameters

motion string

Choose(string, int)

Applies a slot option (-1 clears it). Records an undo step.

public void Choose(string slotName, int index)

Parameters

slotName string
index int

ClearDraft()

Starts a new, empty action.

public void ClearDraft()

CopyRecipe()

Copies the current combination to the clipboard as text (LegionRecipe) and returns that text. Read it in game code with LegionRecipe.Parse.

public string CopyRecipe()

Returns

string

CycleBackdrop()

public void CycleBackdrop()

Delete(string)

Deletes a saved hero. If it is the currently open hero, it remains as an unsaved new hero.

public void Delete(string code)

Parameters

code string

DeleteAction(string)

public void DeleteAction(string actionName)

Parameters

actionName string

Dye(string, string)

Dyes a slot (null restores the original color). Records an undo step.

public void Dye(string slotName, string paletteName)

Parameters

slotName string
paletteName string

EditAction(LegionAction)

Loads any action (such as one from a content pack) into the draft. Saving puts it in the save folder's library.

public void EditAction(LegionAction action)

Parameters

action LegionAction

EditAction(string)

Loads a saved action into the draft to change it. Saving it under the same name replaces it.

public void EditAction(string actionName)

Parameters

actionName string

Export()

Saves the current hero, then exports a frame sheet using the motions of its back-hand weapon type and returns the PNG path.

public string Export()

Returns

string

Flip()

public void Flip()

Load(LegionUnit)

public void Load(LegionUnit unit)

Parameters

unit LegionUnit

MotionTitle(string)

public static string MotionTitle(string motion)

Parameters

motion string

Returns

string

NewHero()

public void NewHero()

OpenActions()

public void OpenActions()

OpenLibrary()

public void OpenLibrary()

OptionTitle(string)

Card name of an option. Options with no name given show the file name tidied (axe_frost → Axe frost).

public static string OptionTitle(string option)

Parameters

option string

Returns

string

PackActions()

Actions of the content packs' hero folders, as (pack title, actions). Played and copied from the edit screen; they are not changed here.

public List<(string title, List<LegionAction> actions)> PackActions()

Returns

List<(string title, List<LegionAction> actions)>

PasteRecipe(string)

Applies a combination written as text (can be undone). False if unreadable. Names not in the catalog are shown in the notice and skipped.

public bool PasteRecipe(string text)

Parameters

text string

Returns

bool

Play(Motion)

public void Play(LegionCatalog.Motion motion)

Parameters

motion LegionCatalog.Motion

PlayAction(LegionAction)

Plays an action on the preview hero with its weapon type (the draft if none is given).

public void PlayAction(LegionAction action = null)

Parameters

action LegionAction

Randomize()

Shuffles all slots at once. Slots that can be cleared are sometimes cleared.

public void Randomize()

RemoveStep(int)

public void RemoveStep(int index)

Parameters

index int

Save()

public string Save()

Returns

string

SaveAction()

Saves the draft into the folder's action library and returns the saved name. An empty name gets "Action N"; the same name replaces.

public string SaveAction()

Returns

string

Seek(float)

Moves to a point (0 to 1) of the motion and pauses.

public void Seek(float t)

Parameters

t float

SelectSlot(string)

public void SelectSlot(string slotName)

Parameters

slotName string

SetPaused(bool)

public void SetPaused(bool value)

Parameters

value bool

SetRepeat(int, int)

public void SetRepeat(int index, int repeat)

Parameters

index int
repeat int

SetSkin(string)

Changes the skin color (null for the default skin). Records an undo step.

public void SetSkin(string skinName)

Parameters

skinName string

SetZoom(int)

public void SetZoom(int value)

Parameters

value int

SlotTitle(string)

public static string SlotTitle(string slot)

Parameters

slot string

Returns

string

Undo()

public void Undo()

WeaponKind(string)

public static string WeaponKind(string option)

Parameters

option string

Returns

string