Beispiel #1
0
 public static void Open(ItemTarget itemTarget, PurchaseOfferCallback onPopupClosedCallback = null)
 {
     if (Instance is null)
     {
         return;
     }
     Instance._onPopupClosedCallback = onPopupClosedCallback;
     Instance.UpdatePopup(itemTarget);
 }
Beispiel #2
0
 protected override void Purchase(PurchaseOfferCallback callback)
 {
     InAppPurchaseManager.BuyProduct(inAppProductTag, success =>
     {
         if (success)
         {
             CollectProduct(callback);
         }
         else
         {
             callback?.Invoke(false);
         }
     });
 }
Beispiel #3
0
        protected override void Purchase(PurchaseOfferCallback callback)
        {
            var success = Currency.TryToRemove(price, false);

            if (success)
            {
                CollectProduct(callback);
            }
            else
            {
                InsufficientFundsPopup.Open(Currency);
                callback?.Invoke(false);
            }
        }
    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);
        });
    }
Beispiel #5
0
 protected abstract void Purchase(PurchaseOfferCallback callback);
Beispiel #6
0
 protected void CollectProduct(PurchaseOfferCallback callback)
 {
     itemTarget.Collect(false);
     CollectItemPopup.Open(itemTarget, callback);
 }
Beispiel #7
0
 void IOffer.Purchase(PurchaseOfferCallback callback)
 {
     Purchase(callback);
 }