Commit 3d88ea64 authored by zhangzhe's avatar zhangzhe

修改插屏广告

parent 3c6adb44
...@@ -62,7 +62,7 @@ public class CSJInterstitialUtil ...@@ -62,7 +62,7 @@ public class CSJInterstitialUtil
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(800, 1200) .SetExpressViewAcceptedSize(Screen.width * 5 / 6f, Screen.width * 6 / 4f)
#else #else
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(350, 0) .SetExpressViewAcceptedSize(350, 0)
......
...@@ -52,8 +52,8 @@ public class GDTInterstitialAdUtil ...@@ -52,8 +52,8 @@ public class GDTInterstitialAdUtil
if (interstitialAdCacheList.Count > 0) if (interstitialAdCacheList.Count > 0)
{ {
UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue(); UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue();
interAd.SetListener(new UnifiedInterstitialAdListener(entity,interAd, listener, callback));
interAd.Show(); interAd.Show();
interAd.SetListener(new UnifiedInterstitialAdListener(entity,interAd, listener, callback));
} }
else else
{ {
...@@ -113,7 +113,9 @@ public class GDTInterstitialAdUtil ...@@ -113,7 +113,9 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdExposured() public void OnAdExposured()
{ {
#if UNITY_ANDROID
callback(true); callback(true);
#endif
if (listener != null) if (listener != null)
{ {
listener.onInterstitialAdShow(); listener.onInterstitialAdShow();
...@@ -141,6 +143,9 @@ public class GDTInterstitialAdUtil ...@@ -141,6 +143,9 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdClosed() public void OnAdClosed()
{ {
#if UNITY_IOS
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
#endif
if (listener != null) if (listener != null)
{ {
listener.onInterstitialClose(); listener.onInterstitialClose();
......
...@@ -221,15 +221,18 @@ public class AdUtils ...@@ -221,15 +221,18 @@ public class AdUtils
} }
public static void showInterAd(ZXADInterstitialListener listener) public static void showInterAd(string actionName, ZXADInterstitialListener listener)
{ {
IsShowRewardAd = true; IsShowRewardAd = true;
#if UNITY_EDITOR #if UNITY_EDITOR
listener.onInterstitialClose(); listener.onInterstitialClose();
return; return;
#endif #endif
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "InterstitialAd", listener); AdManager.Instance.PlayCacheInterstitialAd("Interstitial", actionName, listener);
#if UNITY_ANDROID
AdManager.Instance.LoadCacheInterstitialAd("Interstitial"); AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
#endif
} }
......
...@@ -437,8 +437,7 @@ public class DialogControl : MonoBehaviour ...@@ -437,8 +437,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1); PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0) if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{ {
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "mrcqg", new InterstitialAdListener()); AdUtils.showInterAd("mrcqg", new InterstitialAdListener());
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
} }
} }
...@@ -619,8 +618,7 @@ public class DialogControl : MonoBehaviour ...@@ -619,8 +618,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1); PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0) if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{ {
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "qtjs", new InterstitialAdListener()); AdUtils.showInterAd("qtjs", new InterstitialAdListener());
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
} }
} }
private void moveAllSpeedDialog() private void moveAllSpeedDialog()
...@@ -746,8 +744,7 @@ public class DialogControl : MonoBehaviour ...@@ -746,8 +744,7 @@ public class DialogControl : MonoBehaviour
// if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0) // if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
// { // {
// AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "djhb", new InterstitialAdListener()); // AdUtils.showInterAd("djhb", new InterstitialAdListener());
// AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
// } // }
...@@ -952,9 +949,7 @@ public class DialogControl : MonoBehaviour ...@@ -952,9 +949,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1); PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0) if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{ {
AdUtils.showInterAd("wxlw", new InterstitialAdListener());
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "wxlw", new InterstitialAdListener());
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
} }
} }
public void closeBoxReward() public void closeBoxReward()
...@@ -1007,9 +1002,7 @@ public class DialogControl : MonoBehaviour ...@@ -1007,9 +1002,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1); PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0) if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{ {
AdUtils.showInterAd(new InterstitialAdListener()); AdUtils.showInterAd("InterstitialAd", new InterstitialAdListener());
// AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "txtc", new InterstitialAdListener());
// AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
} }
} }
//关闭种树提现弹窗 //关闭种树提现弹窗
...@@ -1040,7 +1033,7 @@ public class DialogControl : MonoBehaviour ...@@ -1040,7 +1033,7 @@ public class DialogControl : MonoBehaviour
public void onInterstitialClose() public void onInterstitialClose()
{ {
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
} }
public void onInterstitialError(string errorMsg) public void onInterstitialError(string errorMsg)
......
...@@ -45,7 +45,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -45,7 +45,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
private void playIntersitialAd() private void playIntersitialAd()
{ {
Debug.Log("无操作播放插屏广告"); Debug.Log("无操作播放插屏广告");
AdUtils.showInterAd( new InterstitialAdListener()); AdUtils.showInterAd("InterstitialAd", new InterstitialAdListener());
} }
private sealed class InterstitialAdListener : ZXADInterstitialListener private sealed class InterstitialAdListener : ZXADInterstitialListener
{ {
...@@ -58,6 +58,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View ...@@ -58,6 +58,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
public void onInterstitialClose() public void onInterstitialClose()
{ {
Debug.Log("close"); Debug.Log("close");
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
GameObject.Find("LongTimeNoOpen").GetComponent<LongTimeNoOperation>().OpenCheck(); GameObject.Find("LongTimeNoOpen").GetComponent<LongTimeNoOperation>().OpenCheck();
} }
......
...@@ -150,7 +150,7 @@ public class StartControl : MonoBehaviour ...@@ -150,7 +150,7 @@ public class StartControl : MonoBehaviour
{ {
Debug.unityLogger.Log("展示插屏"); Debug.unityLogger.Log("展示插屏");
yield return new WaitForSeconds(Constant.Instance.Interstitial_time); yield return new WaitForSeconds(Constant.Instance.Interstitial_time);
AdUtils.showInterAd(new InterstitialAdListener(this)); AdUtils.showInterAd("InterstitialAd", new InterstitialAdListener(this));
} }
private sealed class InterstitialAdListener : ZXADInterstitialListener private sealed class InterstitialAdListener : ZXADInterstitialListener
...@@ -166,6 +166,7 @@ public class StartControl : MonoBehaviour ...@@ -166,6 +166,7 @@ public class StartControl : MonoBehaviour
public void onInterstitialClose() public void onInterstitialClose()
{ {
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
startControl.StartCoroutine(startControl.SetInterAd()); startControl.StartCoroutine(startControl.SetInterAd());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment