private void handleAbilityUpdated(IAPAbility ability) { if (ability.uid == this.uid) { IAPUIUtility.UpdateLabelText(gameObject, GetText(ability, textType)); } }
private void handleInventoryUpdated(IAPInventory inventory) { if (inventory.uid == this.uid) { IAPUIUtility.UpdateLabelText(gameObject, GetText(inventory, textType)); } }
private void handleCurrencyUpdated(IAPCurrency currency) { //Debug.Log("handleCurrencyUpdated: " + currency.uid + " value: " + currency.amount); if (currency.uid == this.uid) { if ((textType == IAPTextType.price || textType == IAPTextType.amount)) { int result = 0; if (textType == IAPTextType.price) { result = currency.price; } else if (textType == IAPTextType.amount) { result = currency.amount; } if (animated && _lastNumber != result) { startCountTo(result); _lastNumber = result; } else { IAPUIUtility.UpdateLabelText(gameObject, GetText(currency, textType)); } } else { IAPUIUtility.UpdateLabelText(gameObject, GetText(currency, textType)); } } }
private void handlePackageUpdated(IAPPackage package) { if (package.uid == this.uid) { IAPUIUtility.UpdateLabelText(gameObject, GetText(package, textType)); } }
protected IEnumerator doCountTo(int target) { int start = _lastNumber; for (float timer = 0; timer <= animationTime; timer += Time.deltaTime) { float progress = timer / animationTime; int score = (int)Mathf.Lerp(start, target, progress); IAPUIUtility.UpdateLabelText(gameObject, score.ToString()); yield return(null); } _lastNumber = target; IAPUIUtility.UpdateLabelText(gameObject, _lastNumber.ToString()); }
// Helper for animated text private void startCountTo(int result) { try{ if (isActiveAndEnabled) { StopCoroutine("doCountTo"); StartCoroutine("doCountTo", result); } else { IAPUIUtility.UpdateLabelText(gameObject, result.ToString()); } } catch (Exception e) { Debug.Log(e); } }