// Creates a Singleton RewardBasedVideoAd. private RewardBasedVideoAd() { client = GoogleMobileAdsClientFactory.BuildRewardBasedVideoAdClient(); client.CreateRewardBasedVideoAd(); client.OnAdLoaded += delegate(object sender, EventArgs args) { OnAdLoaded(this, args); }; client.OnAdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) { OnAdFailedToLoad(this, args); }; client.OnAdOpening += delegate(object sender, EventArgs args) { OnAdOpening(this, args); }; client.OnAdStarted += delegate(object sender, EventArgs args) { OnAdStarted(this, args); }; client.OnAdRewarded += delegate(object sender, Reward args) { OnAdRewarded(this, args); }; client.OnAdClosed += delegate(object sender, EventArgs args) { OnAdClosed(this, args); }; client.OnAdLeavingApplication += delegate(object sender, EventArgs args) { OnAdLeavingApplication(this, args); }; }
// Creates a Singleton RewardBasedVideoAd. private RewardBasedVideoAd() { Type googleMobileAdsClientFactory = Type.GetType( "GoogleMobileAds.GoogleMobileAdsClientFactory,Assembly-CSharp"); MethodInfo method = googleMobileAdsClientFactory.GetMethod( "BuildRewardBasedVideoAdClient", BindingFlags.Static | BindingFlags.Public); this.client = (IRewardBasedVideoAdClient)method.Invoke(null, null); client.CreateRewardBasedVideoAd(); Utils.CheckInitialization(); this.client.OnAdLoaded += (sender, args) => { if (this.OnAdLoaded != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLoaded(this, args)); } }; this.client.OnAdFailedToLoad += (sender, args) => { if (this.OnAdFailedToLoad != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdFailedToLoad(this, args)); } }; this.client.OnAdOpening += (sender, args) => { if (this.OnAdOpening != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdOpening(this, args)); } }; this.client.OnAdStarted += (sender, args) => { if (this.OnAdStarted != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdStarted(this, args)); } }; this.client.OnAdClosed += (sender, args) => { if (this.OnAdClosed != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdClosed(this, args)); } }; this.client.OnAdLeavingApplication += (sender, args) => { if (this.OnAdLeavingApplication != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdLeavingApplication(this, args)); } }; this.client.OnAdRewarded += (sender, args) => { if (this.OnAdRewarded != null) { MobileAdsEventExecutor.executeInUpdate(() => this.OnAdRewarded(this, args)); } }; }
private RewardBasedVideoAd() { Type type = Type.GetType("GoogleMobileAds.GoogleMobileAdsClientFactory,Assembly-CSharp"); MethodInfo method = type.GetMethod("BuildRewardBasedVideoAdClient", BindingFlags.Static | BindingFlags.Public); client = (IRewardBasedVideoAdClient)method.Invoke(null, null); client.CreateRewardBasedVideoAd(); client.OnAdLoaded += delegate(object sender, EventArgs args) { if (this.OnAdLoaded != null) { this.OnAdLoaded(this, args); } }; client.OnAdFailedToLoad += delegate(object sender, AdFailedToLoadEventArgs args) { if (this.OnAdFailedToLoad != null) { this.OnAdFailedToLoad(this, args); } }; client.OnAdOpening += delegate(object sender, EventArgs args) { if (this.OnAdOpening != null) { this.OnAdOpening(this, args); } }; client.OnAdStarted += delegate(object sender, EventArgs args) { if (this.OnAdStarted != null) { this.OnAdStarted(this, args); } }; client.OnAdClosed += delegate(object sender, EventArgs args) { if (this.OnAdClosed != null) { this.OnAdClosed(this, args); } }; client.OnAdLeavingApplication += delegate(object sender, EventArgs args) { if (this.OnAdLeavingApplication != null) { this.OnAdLeavingApplication(this, args); } }; client.OnAdRewarded += delegate(object sender, Reward args) { if (this.OnAdRewarded != null) { this.OnAdRewarded(this, args); } }; client.OnAdCompleted += delegate(object sender, EventArgs args) { if (this.OnAdCompleted != null) { this.OnAdCompleted(this, args); } }; }
// Creates a Singleton RewardBasedVideoAd. private RewardBasedVideoAd() { this.client = GoogleMobileAdsClientFactory.BuildRewardBasedVideoAdClient(); client.CreateRewardBasedVideoAd(); this.client.OnAdLoaded += (sender, args) => { if (this.OnAdLoaded != null) { this.OnAdLoaded(this, args); } }; this.client.OnAdFailedToLoad += (sender, args) => { if (this.OnAdFailedToLoad != null) { this.OnAdFailedToLoad(this, args); } }; this.client.OnAdOpening += (sender, args) => { if (this.OnAdOpening != null) { this.OnAdOpening(this, args); } }; this.client.OnAdStarted += (sender, args) => { if (this.OnAdStarted != null) { this.OnAdStarted(this, args); } }; this.client.OnAdClosed += (sender, args) => { if (this.OnAdClosed != null) { this.OnAdClosed(this, args); } }; this.client.OnAdLeavingApplication += (sender, args) => { if (this.OnAdLeavingApplication != null) { this.OnAdLeavingApplication(this, args); } }; this.client.OnAdRewarded += (sender, args) => { if (this.OnAdRewarded != null) { this.OnAdRewarded(this, args); } }; this.client.OnAdCompleted += (sender, args) => { if (this.OnAdCompleted != null) { this.OnAdCompleted(this, args); } }; }
// Creates a Singleton RewardBasedVideoAd. public RewardBasedVideoAd(string adUnitId) { this.adUnitId = adUnitId; Type googleMobileAdsClientFactory = Type.GetType( "GoogleMobileAds.GoogleMobileAdsClientFactory,Assembly-CSharp"); MethodInfo method = googleMobileAdsClientFactory.GetMethod( "BuildRewardBasedVideoAdClient", BindingFlags.Static | BindingFlags.Public); this.client = (IRewardBasedVideoAdClient)method.Invoke(null, null); client.CreateRewardBasedVideoAd(); this.client.OnAdLoaded += (sender, args) => { if (this.OnAdLoaded != null) { this.OnAdLoaded(this, args); } }; this.client.OnAdFailedToLoad += (sender, args) => { if (this.OnAdFailedToLoad != null) { this.OnAdFailedToLoad(this, args); } }; this.client.OnAdOpening += (sender, args) => { if (this.OnAdOpening != null) { this.OnAdOpening(this, args); } }; this.client.OnAdStarted += (sender, args) => { if (this.OnAdStarted != null) { this.OnAdStarted(this, args); } }; this.client.OnAdClosed += (sender, args) => { if (this.OnAdClosed != null) { this.OnAdClosed(this, args); } }; this.client.OnAdLeavingApplication += (sender, args) => { if (this.OnAdLeavingApplication != null) { this.OnAdLeavingApplication(this, args); } }; this.client.OnAdRewarded += (sender, args) => { if (this.OnAdRewarded != null) { this.OnAdRewarded(this, args); } }; }
// Creates a Singleton RewardBasedVideoAd. private RewardBasedVideoAd() { this.client = MobileAds.GetClientFactory().BuildRewardBasedVideoAdClient(); client.CreateRewardBasedVideoAd(); this.client.OnAdLoaded += (sender, args) => { if (this.OnAdLoaded != null) { this.OnAdLoaded(this, args); } }; this.client.OnAdFailedToLoad += (sender, args) => { if (this.OnAdFailedToLoad != null) { this.OnAdFailedToLoad(this, new AdFailedToLoadEventArgs() { LoadAdError = null, Message = args.Message }); } }; this.client.OnAdOpening += (sender, args) => { if (this.OnAdOpening != null) { this.OnAdOpening(this, args); } }; this.client.OnAdStarted += (sender, args) => { if (this.OnAdStarted != null) { this.OnAdStarted(this, args); } }; this.client.OnAdClosed += (sender, args) => { if (this.OnAdClosed != null) { this.OnAdClosed(this, args); } }; this.client.OnAdLeavingApplication += (sender, args) => { if (this.OnAdLeavingApplication != null) { this.OnAdLeavingApplication(this, args); } }; this.client.OnAdRewarded += (sender, args) => { if (this.OnAdRewarded != null) { this.OnAdRewarded(this, args); } }; this.client.OnAdCompleted += (sender, args) => { if (this.OnAdCompleted != null) { this.OnAdCompleted(this, args); } }; }