/// <summary> /// Load the reward Ad. /// </summary> public void LoadExpressRewardAd(int direction) { var rit = ""; #if UNITY_IOS if (this.expressRewardAd != null) { this.expressRewardAd.Dispose(); this.expressRewardAd = null; } // @"945113162";//竖屏 // @"945113163";//横屏 if (direction == 1) { rit = "945113163"; } else { rit = "945113162"; } #else if (this.rewardAd != null) { Debug.LogError("广告已经加载"); this.information.text = "广告已经加载"; return; } if (direction == 1) { rit = "945113161"; } else { rit = "945113160"; } #endif var adSlot = new AdSlot.Builder() .SetCodeId(rit) .SetImageAcceptedSize(1080, 1920) .SetExpressViewAcceptedSize(100,100)//模板广告需要填写,大于0的值即可 .IsExpressAd(true) //.SetRewardName("金币") // rewardname ,the data filled in by the platform shall prevail //.SetRewardAmount(3) // rewardamount ,the data filled in by the platform shall prevail .SetUserID("user123") // 用户id,必传参数 .SetMediaExtra("media_extra") // 附加参数,可选 .SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向 .Build(); #if UNITY_IOS this.AdNative.LoadExpressRewardAd( adSlot, new ExpressRewardVideoAdListener(this)); #else this.AdNative.LoadRewardVideoAd( adSlot, new RewardVideoAdListener(this)); #endif }
// iOS public void OnExpressRewardVideoAdLoad(ExpressRewardVideoAd ad) { #if UNITY_IOS Debug.Log("OnRewardExpressVideoAdLoad"); this.example.information.text = "OnRewardExpressVideoAdLoad"; ad.SetRewardAdInteractionListener( new RewardAdInteractionListener(this.example)); ad.SetDownloadListener( new AppDownloadListener(this.example)); this.example.expressRewardAd = ad; #else #endif }
public void OnExpressRewardVideoAdLoad(ExpressRewardVideoAd ad) { }
/// <summary> /// Dispose the reward Ad. /// </summary> public void DisposeAds() { #if UNITY_IOS if (this.rewardAd != null) { this.rewardAd.Dispose(); this.rewardAd = null; } if (this.fullScreenVideoAd != null) { this.fullScreenVideoAd.Dispose(); this.fullScreenVideoAd = null; } if (this.nativeFeedAd != null) { this.nativeFeedAd.Dispose(); this.nativeFeedAd = null; } if (this.mExpressFeedad != null) { this.mExpressFeedad.Dispose(); this.mExpressFeedad = null; } //if (this.intersititialAd != null) //{ // this.intersititialAd.Dispose(); // this.intersititialAd = null; //} if (this.expressRewardAd != null) { this.expressRewardAd.Dispose(); this.expressRewardAd = null; } if (this.expressFullScreenVideoAd != null) { this.expressFullScreenVideoAd.Dispose(); this.expressFullScreenVideoAd = null; } if (this.iExpressBannerAd != null) { this.iExpressBannerAd.Dispose(); this.iExpressBannerAd = null; } #else if (this.rewardAd != null) { this.rewardAd = null; } if (this.fullScreenVideoAd != null) { this.fullScreenVideoAd = null; } if (this.mNativeAd != null) { this.mNativeAd = null; } if (this.mExpressFeedad != null) { NativeAdManager.Instance().DestoryExpressAd(mExpressFeedad.handle); mExpressFeedad = null; } if (this.mExpressBannerAd != null) { NativeAdManager.Instance().DestoryExpressAd(mExpressBannerAd.handle); mExpressBannerAd = null; } if (this.mExpressInterstitialAd != null) { NativeAdManager.Instance().DestoryExpressAd(mExpressInterstitialAd.handle); mExpressInterstitialAd = null; } #endif }