CustomizationVisualPart
An abstract class in Root.Township, Alta.Customization.
Base component for a cosmetic visual part. Handles show, hide and argument changes across handlers, skipping first-person handlers if the part isn't shown in first person.
- Listed in Customization and screenshots
- Inherits or implements
MonoBehaviour,ICustomizationPart - Derived types
CustomizationVisualPart<TArguments>
Constructors
| Member | What it is |
|---|---|
protected CustomizationVisualPart() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private bool isPrimary | Backing field for IsPrimary. |
private static Logger logger | NLog logger; attach, detach and argument errors per handler are logged and swallowed. |
private int priority | Backing field for Priority. |
private PlayerCustomizationSlotSet slots | Backing slot set for Slots. |
Properties
| Member | What it is |
|---|---|
bool IsPrimary { get; } | Whether this is the main part of the visual. |
CosmeticPacker.PartId PartId { get; } | Id for packing: the visual definition's hash plus the part index. |
int PartIndex { get; set; } | Index of this part within its visual. |
int Priority { get; } | Priority set on the part, probably to settle slot clashes. |
int[] Slots { get; } | Slot ids from the part's slot set. |
ICustomizationVisual Visual { get; set; } | The cosmetic visual this part belongs to. |
protected virtual bool IsShownInFirstPerson { get; } | Whether the part shows on first-person handlers. True by default. |
Methods
| Member | What it is |
|---|---|
void ChangeArguments(IEnumerable<ICustomizationHandler> handlers, CustomizationArguments arguments) | Applies new arguments per handler, logging errors instead of throwing. |
abstract CustomizationArguments CreateDefaultArguments() | Subclass: a fresh copy of the part's default arguments. |
void Hide(IEnumerable<ICustomizationHandler> handlers) | Detaches from each handler, logging errors instead of throwing. |
virtual async Task PostRandomize(PlayerCosmeticWrapper cosmeticWrapper) | Called after randomizing. Does nothing by default. |
void Show(IEnumerable<ICustomizationHandler> handlers, CustomizationArguments arguments) | Attaches to each handler, logging errors instead of throwing. |
void UpdateFirstPerson(ICustomizationHandler handler, CustomizationArguments arguments) | For parts hidden in first person: detaches from first-person handlers and attaches to others. |
protected abstract void Attach(ICustomizationHandler handler, CustomizationArguments arguments) | Subclass: attaches the part to one handler. |
protected abstract void ChangeArguments(ICustomizationHandler handler, CustomizationArguments arguments) | Applies new arguments per handler, logging errors instead of throwing. |
protected abstract void Detach(ICustomizationHandler handler) | Subclass: removes the part from one handler. |
Used in
Members of other types that take, return or hold a CustomizationVisualPart: