예제 #1
0
 private void handleAbilityUpdated(IAPAbility ability)
 {
     if (ability.uid == this.uid)
     {
         IAPUIUtility.UpdateLabelText(gameObject, GetText(ability, textType));
     }
 }
예제 #2
0
 private void handleInventoryUpdated(IAPInventory inventory)
 {
     if (inventory.uid == this.uid)
     {
         IAPUIUtility.UpdateLabelText(gameObject, GetText(inventory, textType));
     }
 }
예제 #3
0
        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));
                }
            }
        }
예제 #4
0
 private void handlePackageUpdated(IAPPackage package)
 {
     if (package.uid == this.uid)
     {
         IAPUIUtility.UpdateLabelText(gameObject, GetText(package, textType));
     }
 }
예제 #5
0
        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());
        }
예제 #6
0
        // 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);
            }
        }