CosmeticRotatingSlot
A class in Root.Township, Alta.Customization.
The cosmetic preset shelf slot in the customization room: ten numbered preset slots shown one at a time, each saved to the API as a trophy. Client side; used by CosmeticPresetsManager.
- Listed in Customization and screenshots
- Inherits or implements
MonoBehaviour,ICosmeticPresetSlot
Constructors
| Member | What it is |
|---|---|
CosmeticRotatingSlot() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
10 private and internal fields
| Member | What it is |
|---|---|
private GameObject androidWaitTimer | GameObject hidden when switching to an empty index. |
private CosmeticPresetData[] data | Preset data for the 10 indices, null where empty. |
private GameObject effectParent | GameObject holding the highlight effects. |
private AltaEvent gotTrophy | Event raised when a preset is saved. |
private Coroutine haptics | The running haptics coroutine, if any. |
private float hapticStrength | Strength of the hover haptic pulse. |
private int index | Backing field for Index. |
private TextRenderer indexText | Text showing the current index. |
private Transform trophyPosition | Transform marking where the trophy sits. |
private CosmeticPresetTrophyTrigger trophySource | Trigger that detects trophies near the slot. |
Properties
| Member | What it is |
|---|---|
Vector3 TargetPosition { get; } | World position where the trophy sits. |
Quaternion TargetRotation { get; } | World rotation the trophy sits at. |
CosmeticPresetTrophy Trophy { get; private set; } | The trophy object used to show the preset of the current slot. |
1 private and internal property
Methods
| Member | What it is |
|---|---|
void Clear() | Destroys the trophy and frees all loaded preset data. |
void DecreaseIndex() | Moves to the previous slot, wrapping from 1 to 10. |
async void DeregisterTrophy(CosmeticPresetTrophy trophy) | When the shown trophy is removed from a filled slot, hides it, clears the slot and deletes that preset through the API. |
void IncreaseIndex() | Moves to the next slot, wrapping from 10 to 1. |
bool IsAllEmpty() | True when none of the ten slots holds a preset. |
async void SaveTrophy(CosmeticPresetTrophy trophy) | If the current slot is empty, stores the released trophy's cosmetics there, shows it and creates the preset through the API. |
void Setup(CosmeticPresetTrophy trophy, IEnumerable<UserPresetDataInfo> databasePresets) | Loads the user's saved presets into the slots and shows the first filled one, or hides the trophy if there are none. |
void UpdateIndex(float progress) | Switches to a slot (by index, or from a 0 to 1 progress value), dropping the trophy back into place and applying that slot's preset. |
void UpdateIndex(int newIndex) | Switches to a slot (by index, or from a 0 to 1 progress value), dropping the trophy back into place and applying that slot's preset. |
9 private and internal methods
| Member | What it is |
|---|---|
private bool ApplyTrophy(int index) | Shows the preset at an index on the trophy, if that preset has data. |
private void Awake() | Hooks the trophy trigger's release, enter and exit events. |
private void DisableEffects(CosmeticPresetTrophy trophy) | Hides the highlight effects. The overload taking a trophy only does it once no trophies are in the trigger. |
private void DisableEffects() | Hides the highlight effects. The overload taking a trophy only does it once no trophies are in the trigger. |
private void EnableEffects(CosmeticPresetTrophy trophy) | Shows the highlight effects and starts haptics while the current index is empty. |
private CosmeticPresetData GetDataFrom(UserPresetDataInfo source) | Copies preset data from an API preset or a trophy into a pooled array. |
private CosmeticPresetData GetDataFrom(CosmeticPresetTrophy source) | Copies preset data from an API preset or a trophy into a pooled array. |
private IEnumerator Haptics() (iterator) | Coroutine that buzzes the hand holding a hovering trophy. |
private void ResetTrophy() | Snaps the trophy back to the slot, makes it kinematic and enables its colliders. |
Used in
Members of other types that take, return or hold a CosmeticRotatingSlot: