public void OnSelected(int var1, string var2) { Debug.LogError("express dislike OnSelected:" + var2); this.example.information.text = "ExpressAdDislikeCallback OnSelected:" + type; #if UNITY_IOS #else //释放广告资源 switch (type) { case 0: if (this.example.mExpressFeedad != null) { NativeAdManager.Instance().DestoryExpressAd(this.example.mExpressFeedad.handle); this.example.mExpressFeedad = null; } break; case 1: if (this.example.mExpressBannerAd != null) { NativeAdManager.Instance().DestoryExpressAd(this.example.mExpressBannerAd.handle); this.example.mExpressBannerAd = null; } break; } #endif }
public void ShowExpressBannerAd() { if (this.mExpressBannerAd == null) { return; } //设置轮播间隔 30s--120s;不设置则不开启轮播 this.mExpressBannerAd.SetSlideIntervalTime(30 * 1000); this.mExpressBannerAd.SetDownloadListener(AdHelper.GetDownListener()); NativeAdManager.Instance().ShowExpressBannerAd(AdHelper.GetActivity(), mExpressBannerAd.handle, expressAdInteractionListener, dislikeCallback); }
//public void StartCountDown() //{ // add = 0; // isRun = useReShow; //} //public void StopCountDown() //{ // isRun = false; //} public void Hide() { //StopCountDown(); onHide?.Invoke(); #if !UNITY_EDITOR if (this.mExpressBannerAd != null) { NativeAdManager.Instance().DestoryExpressAd(this.mExpressBannerAd.handle); this.mExpressBannerAd = null; } LoadExpressBannerAd(); #endif }
public void OnSelected(int var1, string var2) { example.onClose?.Invoke(2); Debug.Log("express dislike OnSelected:" + var2); //释放广告资源 switch (type) { case 1: if (this.example.mExpressBannerAd != null) { NativeAdManager.Instance().DestoryExpressAd(this.example.mExpressBannerAd.handle); this.example.mExpressBannerAd = null; } break; } }
/// <summary> /// Show the Banner Ad. /// </summary> public void ShowBannerAd() { #if UNITY_IOS if (this.iExpressBannerAd == null) { Debug.LogError("请先加载广告"); this.information.text = "请先加载广告"; return; } this.inputX = GameObject.Find("Canvas/InputFieldX").GetComponent<InputField>(); this.inputY = GameObject.Find("Canvas/InputFieldY").GetComponent<InputField>(); int x; int y; int.TryParse(this.inputX.text, out x); int.TryParse(this.inputY.text, out y); Debug.Log("ShowExpressAd x坐标---" + x); Debug.Log("ShowExpressAd y坐标---" + y); Debug.Log("ShowExpressAd WindowSafeAreaInsetsTop---" + PangleTools.getWindowSafeAreaInsetsTop()); Debug.Log("ShowExpressAd WindowSafeAreaInsetsLeft---" + PangleTools.getWindowSafeAreaInsetsLeft()); Debug.Log("ShowExpressAd WindowSafeAreaInsetsBottom---" + PangleTools.getWindowSafeAreaInsetsBottom()); Debug.Log("ShowExpressAd WindowSafeAreaInsetsRight---" + PangleTools.getWindowSafeAreaInsetsRight()); Debug.Log("ShowExpressAd ScreenWidth---" + PangleTools.getScreenWidth()); Debug.Log("ShowExpressAd ScreenHeight---" + PangleTools.getScreenHeight()); if (y < 20) { y = (int)PangleTools.getScreenHeight() - 750 - (int)PangleTools.getWindowSafeAreaInsetsBottom(); } this.iExpressBannerAd.ShowExpressAd(x, y); #else if (this.mExpressBannerAd == null) { Debug.LogError("请先加载广告"); this.information.text = "请先加载广告"; return; } //设置轮播间隔 30s--120s;不设置则不开启轮播 this.mExpressBannerAd.SetSlideIntervalTime(30 * 1000); ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 1); ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this, 1); NativeAdManager.Instance().ShowExpressBannerAd(GetActivity(), mExpressBannerAd.handle, expressAdInteractionListener, dislikeCallback); #endif }
/// <summary> /// Show the reward Ad. /// </summary> public void ShowExpressInterstitialAd() { #if UNITY_IOS if (this.iExpressInterstitialAd == null) { Debug.LogError("请先加载广告"); this.information.text = "请先加载广告"; return; } this.iExpressInterstitialAd.ShowExpressAd(0, 0); #else if (this.mExpressInterstitialAd == null) { Debug.LogError("请先加载广告"); this.information.text = "请先加载广告"; return; } ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 1); NativeAdManager.Instance().ShowExpressInterstitialAd(GetActivity(), mExpressInterstitialAd.handle, expressAdInteractionListener); #endif }
/// <summary> /// Show the expressFeed Ad. /// </summary> public void ShowExpressFeedAd() { #if UNITY_IOS if (this.mExpressFeedad == null) { Debug.LogError("请先加载广告"); this.information.text = "请先加载广告"; return; } this.mExpressFeedad.ShowExpressAd(5,100); #else if (this.mExpressFeedad == null) { Debug.LogError("请先加载广告"); this.information.text = "请先加载广告"; return; } ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 0); ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this,0); this.mExpressFeedad.SetExpressInteractionListener( expressAdInteractionListener); NativeAdManager.Instance().ShowExpressFeedAd(GetActivity(),mExpressFeedad.handle,expressAdInteractionListener,dislikeCallback); #endif }
/// <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 }