CosmeticCustomizationManager
A class in Root.Township, Alta.Customization.
Runs the cosmetic customization room: attaches a player's cosmetics to the dummy, wires up the editable slots and handles undo, redo, randomize and exit. Client side, a component in the customization room.
- Listed in Customization and screenshots
- Inherits or implements
MonoBehaviour - Documented in Customization
Constructors
| Member | What it is |
|---|---|
CosmeticCustomizationManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
13 private and internal fields
| Member | What it is |
|---|---|
private bool cacheRedoPossible | Last redo state sent to redoPossibleChanged. |
private bool cacheUndoPossible | Last undo state sent to undoPossibleChanged. |
private ItemScroller categoryScroller | Scroller of cosmetic categories, shown on initialize. |
private PlayerCustomizationHandler customizationHandler | Backing field for CustomizationHandler, attached to the player's customization manager. |
private GameObject[] detachableParts | Objects destroyed with this manager. |
private EditableCosmeticSlot[] editableSlots | Cosmetic slots activated with the player's cosmetics on initialize. |
private bool isRandomizing | Stops Randomize running twice at once. |
private static Logger logger | NLog logger for this class. |
private CosmeticPresetData originalData | Cosmetics as they were when customizing started; DefaultToOriginal restores them. |
private CosmeticOwnershipManager owned | Backing field for Owned. |
private Player player | The player being customized, kept to unhook input on destroy. |
private BoolUnityEvent redoPossibleChanged | Unity event raised with whether redo is now possible. |
private BoolUnityEvent undoPossibleChanged | Unity event raised with whether undo is now possible. |
Properties
| Member | What it is |
|---|---|
PlayerCustomizationHandler CustomizationHandler { get; } | The PlayerCustomizationHandler (the character dummy) shown in the room. |
PlayerCharacterCustomizationManager Manager { get; private set; } | The player's customization manager currently attached to the room. |
CosmeticOwnershipManager Owned { get; } | The ownership manager used to decide which items can be picked or randomized. |
AddressableSession Session { get; private set; } | The addressable loading session used for cosmetic assets while the room is open. Disposed on destroy. |
Events
Methods
| Member | What it is |
|---|---|
async void DefaultToOriginal() | Reloads the cosmetics the player had when the room was opened, undoing all changes. |
void ExitCustomizationRoom(PlayerInput input) | Raises EndButtonPressed. Does not unload anything itself. |
void ExitCustomizationRoom() | Raises EndButtonPressed. Does not unload anything itself. |
static uint[] GetMoreData(uint[] oldData, ref uint wordIndex) | Returns a pooled uint buffer twice the size of the old one (128 if none), copying the old data across and releasing it. |
async void InitializeForPlayer(Player player, CosmeticOwnershipManager owned) | Attaches a player's cosmetics to the dummy and activates the slots. The Player overload also randomizes an empty outfit. |
async Task InitializeForPlayer(PlayerCharacterCustomizationManager manager, CosmeticOwnershipManager owned) | Attaches a player's cosmetics to the dummy and activates the slots. The Player overload also randomizes an empty outfit. |
bool IsUsingOnlyOwnedItems() | True if every equipped cosmetic item is in the player's purchased list. |
async void Randomize() | Randomizes the outfit using only owned items. Ignored while a randomize is already running. |
void Redo() | Redoes the last undone cosmetic change and updates the undo and redo button events. |
void Undo() | Undoes the last cosmetic change and updates the undo and redo button events. |
5 private and internal methods
| Member | What it is |
|---|---|
private void OnDestroy() | Stops the cosmetics session, destroys the handler and detachable parts, and unhooks the debug inputs. |
private void OnItemPushed() | Called when the cosmetic history gets a new entry; refreshes the undo and redo state. |
private void Randomize(PlayerInput input) | Randomizes the outfit using only owned items. Ignored while a randomize is already running. |
private async Task StartSession(PlayerCharacterCustomizationManager manager) | Starts an addressable session on the player's cosmetics if one isn't running. |
private void UpdateCache() | Fires undoPossibleChanged and redoPossibleChanged when the history's undo or redo state changes. |
Used in
Members of other types that take, return or hold a CosmeticCustomizationManager:
CategoryScrollManager.customizationManager, CategoryScrollManager.CustomizationManager, CosmeticPresetsManager.customizationManager, MainMenuCustomizationInterface.customizationInterface, MainMenuShopInterface.customizationManager, ScrollManager.customizationManager, ScrollManager.CustomizationManager, CustomizationState.customizationRoom, CustomizationStateSettings.customizationRoomPrefab, CustomizationStateSettings.CustomizationRoomPrefab, PaintBrush.manager.