Skip to main content

MainMenuShopInterface

A class in Root.Township, Alta.Customization.

Main menu shop: shows shop items and lets the player take Talem coins out of and back into their account balance. Uses the Alta shop API; client side.

Constructors​

MemberWhat it is
MainMenuShopInterface()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

16 private and internal fields
MemberWhat it is
private ShopAccountInfo accountShop account info from the last login.
private int accountBalanceLocal count of Talem still in the account (not withdrawn).
private TextRenderer accountBalanceTextText showing the balance.
private CosmeticCustomizationManager customizationManagerCustomization manager whose session is passed to shop items.
private PickupDock depositDockDock that takes Talem back into the balance.
private bool inverseThrottleInteractionFlips the sign of throttle movement. Default true.
private static Logger loggerNLog logger for this class.
private CosmeticPresetsManager presetsManagerPresets manager told to recheck storage after purchases.
private Transform[] shopItemPositionsTransforms where shop items are placed, one per item.
private MainMenuShopItem shopItemPrefabPrefab for each shop item.
private List<MainMenuShopItem> spawnedItemsShop items spawned so far.
private uint talemHashSerialized hash for the Talem item. Not read in this file.
private Item talemItemItem asset for Talem coins.
private Pickup talemPickupTalem prefab spawned into the withdraw dock.
private Interactable throttleInteractableThrottle control for withdrawing. Not read in this file.
private PickupDock withdrawDockDock that holds withdrawn Talem.

Methods​

MemberWhat it is
void MoveToFromWithdraw(int movement)Moves an amount between the local balance and the withdraw dock's Talem stack, spawning or destroying the stack as needed. Local only, no API call.
protected override async void LoggedIn()Clears stray Talem and old items, fetches the balance and spawns an item for each shop entry.
protected override void LoggedOut()Does nothing.
5 private and internal methods
MemberWhat it is
private void Awake()Hooks the deposit dock's filter and docked events.
private void DestroyDocked(Interactor interactor, Pickup pickup, PickupDock dock)When a Talem stack is docked in the deposit dock, moves its amount back to the balance and destroys it.
private void DockFilter(Interactor interactor, Pickup pickup, ref bool result)Lets only Talem into the deposit dock.
private void ItemPurchased(uint purchasable)Asks the presets manager to recheck storage use after a purchase.
private MainMenuShopItem SpawnItem()Instantiates a shop item and listens for its purchase.