Ejemplo n.º 1
0
 void OnClickBtn()
 {
     if (!IAPWrapper.IsAdDisabled)
     {
         GADWrapper.ShowInterstitialAd(GADWrapper.InterstitialAdId.ID_ALL_KIND_OF_INTERSTITIAL_ADS, false, true);
     }
 }
Ejemplo n.º 2
0
    void OnBtnClick()
    {
        if (cost <= 0)
        {
            var showed = GADWrapper.ShowRewardedAd(
                GADWrapper.RewardedAdId.ID_FREE_GOLD,
                (reward) => MainThreadDispatcher.Instance.Enqueue(() => AddGold(gold)),
                true,
                false,
                2
                );
            if (!showed)
            {
                GADWrapper.LoadRewardedAd(
                    GADWrapper.RewardedAdId.ID_FREE_GOLD,
                    2
                    );
            }
        }
        else
        {
            var id = "";

            Action onSuccess = () => { MainThreadDispatcher.Instance.Enqueue(() => AddGold(gold)); };
            switch (cost)
            {
            case 1:
                id = IAPWrapper.Const.Consumable.ID_GOLD_1;
                break;

            case 2:
                id = IAPWrapper.Const.Consumable.ID_GOLD_2;
                break;

            default:
                id = IAPWrapper.Const.Consumable.ID_GOLD_3;
                break;
            }
            IAPWrapper.Initiate(false);
            IAPWrapper.BuyProduct(id, onSuccess, disableAds: removeAds);
        }
    }