Ejemplo n.º 1
0
    void IOffer.Purchase(PurchaseOfferCallback callback)
    {
        var data = Data;

        if (data.stock <= 0)
        {
            callback.Invoke(false);
            return;
        }

        _offer.Purchase((success) =>
        {
            if (success)
            {
                data.stock--;
                DataManager.SaveData();
            }

            callback.Invoke(success);
        });
    }
Ejemplo n.º 2
0
        private void Awake()
        {
            _audioSource = GetComponent <AudioSource>();

            collectButton.onClick.AddListener(() =>
            {
                gameObject.SetActive(false);
                _onPopupClosedCallback?.Invoke(true);
                if (_itemContainer?.Item != null)
                {
                    _itemContainer.Item.WasCollected();
                }
            });
        }
Ejemplo n.º 3
0
 protected override void Purchase(PurchaseOfferCallback callback)
 {
     InAppPurchaseManager.BuyProduct(inAppProductTag, success =>
     {
         if (success)
         {
             CollectProduct(callback);
         }
         else
         {
             callback?.Invoke(false);
         }
     });
 }
Ejemplo n.º 4
0
        protected override void Purchase(PurchaseOfferCallback callback)
        {
            var success = Currency.TryToRemove(price, false);

            if (success)
            {
                CollectProduct(callback);
            }
            else
            {
                InsufficientFundsPopup.Open(Currency);
                callback?.Invoke(false);
            }
        }