private RewardedInterstitialAd(IRewardedInterstitialAdClient client)
        {
            this.rewardedInterstitialAdClient = client;

            this.rewardedInterstitialAdClient.OnAdFailedToPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdFailedToPresentFullScreenContent != null)
                {
                    AdError adError = new AdError(args.AdErrorClient);
                    this.OnAdFailedToPresentFullScreenContent(this, new AdErrorEventArgs()
                    {
                        AdError = adError,
                        Message = adError.GetMessage()
                    });
                }
            };

            this.rewardedInterstitialAdClient.OnAdDidPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdDidPresentFullScreenContent != null)
                {
                    this.OnAdDidPresentFullScreenContent(this, args);
                }
            };

            this.rewardedInterstitialAdClient.OnAdDidDismissFullScreenContent += (sender, args) =>
            {
                if (this.OnAdDidDismissFullScreenContent != null)
                {
                    this.OnAdDidDismissFullScreenContent(this, args);
                }
            };
        }
        private RewardedInterstitialAd(IRewardedInterstitialAdClient client)
        {
            this.rewardedInterstitialAdClient = client;

            this.rewardedInterstitialAdClient.OnAdFailedToPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdFailedToPresentFullScreenContent != null)
                {
                    AdError adError = new AdError(args.AdErrorClient);
                    this.OnAdFailedToPresentFullScreenContent(this, new AdErrorEventArgs()
                    {
                        AdError = adError
                    });
                }
            };

            this.rewardedInterstitialAdClient.OnAdDidPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdDidPresentFullScreenContent != null)
                {
                    this.OnAdDidPresentFullScreenContent(this, args);
                }
            };

            this.rewardedInterstitialAdClient.OnAdDidDismissFullScreenContent += (sender, args) =>
            {
                if (this.OnAdDidDismissFullScreenContent != null)
                {
                    this.OnAdDidDismissFullScreenContent(this, args);
                }
            };

            this.rewardedInterstitialAdClient.OnAdDidRecordImpression += (sender, args) =>
            {
                if (this.OnAdDidRecordImpression != null)
                {
                    this.OnAdDidRecordImpression(this, args);
                }
            };

            this.rewardedInterstitialAdClient.OnPaidEvent += (sender, args) =>
            {
                if (this.OnPaidEvent != null)
                {
                    this.OnPaidEvent(this, args);
                }
            };
        }
Exemple #3
0
        public RewardedAd(string adUnitId)
        {
            this.client   = MobileAds.GetClientFactory().BuildRewardedAdClient();
            this.adUnitId = adUnitId;
            this.isLoaded = false;
            client.CreateRewardedAd();

            this.client.OnAdLoaded += (sender, args) =>
            {
                this.isLoaded = true;
                if (this.OnAdLoaded != null)
                {
                    this.OnAdLoaded(this, args);
                }
            };

            this.client.OnAdFailedToLoad += (sender, args) =>
            {
                if (this.OnAdFailedToLoad != null)
                {
                    LoadAdError loadAdError = new LoadAdError(args.LoadAdErrorClient);
                    this.OnAdFailedToLoad(this, new AdFailedToLoadEventArgs()
                    {
                        LoadAdError = loadAdError
                    });
                }
            };

            this.client.OnAdFailedToPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdFailedToShow != null)
                {
                    AdError adError = new AdError(args.AdErrorClient);

                    this.OnAdFailedToShow(this, new AdErrorEventArgs()
                    {
                        AdError = adError
                    });
                }
            };

            this.client.OnAdDidPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdOpening != null)
                {
                    this.OnAdOpening(this, args);
                }
            };

            this.client.OnAdDidDismissFullScreenContent += (sender, args) =>
            {
                if (this.OnAdClosed != null)
                {
                    this.OnAdClosed(this, args);
                }
            };

            this.client.OnAdFailedToPresentFullScreenContent += (sender, args) =>
            {
                if (this.OnAdFailedToShow != null)
                {
                    AdError adError = new AdError(args.AdErrorClient);
                    this.OnAdFailedToShow(this, new AdErrorEventArgs()
                    {
                        AdError = adError
                    });
                }
            };

            this.client.OnAdDidRecordImpression += (sender, args) =>
            {
                if (this.OnAdDidRecordImpression != null)
                {
                    this.OnAdDidRecordImpression(this, args);
                }
            };

            this.client.OnUserEarnedReward += (sender, args) =>
            {
                if (this.OnUserEarnedReward != null)
                {
                    this.OnUserEarnedReward(this, args);
                }
            };

            this.client.OnPaidEvent += (sender, args) =>
            {
                if (this.OnPaidEvent != null)
                {
                    this.OnPaidEvent(this, args);
                }
            };
        }
        public RewardedAd(string adUnitId)
        {
            this.client = MobileAds.GetClientFactory().BuildRewardedAdClient();
            client.CreateRewardedAd(adUnitId);

            this.client.OnAdLoaded += (sender, args) =>
            {
                if (this.OnAdLoaded != null)
                {
                    this.OnAdLoaded(this, args);
                }
            };

            this.client.OnAdFailedToLoad += (sender, args) =>
            {
                if (this.OnAdFailedToLoad != null)
                {
                    LoadAdError loadAdError = new LoadAdError(args.LoadAdErrorClient);
                    this.OnAdFailedToLoad(this, new AdFailedToLoadEventArgs()
                    {
                        LoadAdError = loadAdError,
                        Message     = loadAdError.GetMessage()
                    });
                }
            };

            this.client.OnAdFailedToShow += (sender, args) =>
            {
                if (this.OnAdFailedToShow != null)
                {
                    AdError adError = new AdError(args.AdErrorClient);

                    this.OnAdFailedToShow(this, new AdErrorEventArgs()
                    {
                        AdError = adError,
                        Message = adError.GetMessage()
                    });
                }
            };

            this.client.OnAdOpening += (sender, args) =>
            {
                if (this.OnAdOpening != null)
                {
                    this.OnAdOpening(this, args);
                }
            };

            this.client.OnAdClosed += (sender, args) =>
            {
                if (this.OnAdClosed != null)
                {
                    this.OnAdClosed(this, args);
                }
            };

            this.client.OnUserEarnedReward += (sender, args) =>
            {
                if (this.OnUserEarnedReward != null)
                {
                    this.OnUserEarnedReward(this, args);
                }
            };

            this.client.OnPaidEvent += (sender, args) =>
            {
                if (this.OnPaidEvent != null)
                {
                    this.OnPaidEvent(this, args);
                }
            };
        }