IAPViewModel
A class in Root.Township, Features.Main_Menu.Scripts.TalemShop.
Client talem shop panel for Quest: shows the talem balance and buys talem packs through InterfaceResolver.IShopController. Hidden on Windows and Pico, and when logged out.
- Listed in ATT, Features and other game namespaces
- Inherits or implements
LoggedInTool
Constructors
| Member | What it is |
|---|---|
IAPViewModel() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private TextRenderer currentTalemsText | Text showing the talem balance. |
private TextRenderer errorOutput | Text showing purchase errors. |
private bool isProcessing | True while a purchase is in progress. |
private GameObject loadingMarker | Object shown while a purchase is in progress. |
private static readonly Logger logger | NLog logger for this class. |
private UnityEvent onPurchaseSucceeded | Event fired after a purchase is made and consumed. |
Methods
6 private and internal methods
| Member | What it is |
|---|---|
private void HandleError(PurchaseError error) | Shows a purchase error's message. |
private async Task MakePurchase(string sku) | Buys the SKU, consumes it if that worked, shows any error, then asks for a fresh balance. |
private void OutputError(string error, bool isLoggingInGame = true) | Logs the error and, by default, shows it in red on the panel. |
private void PurchaseMade(bool wasSuccessful) | Fires onPurchaseSucceeded if the purchase was consumed, otherwise shows an error. |
private void Setup() | Shows the current balance and keeps it updated from CurrentTalemBalance. |
private void UpdateBalance(int newBalance) | Writes the balance into currentTalemsText. |