Commit 791363ab authored by LiLiuZhou's avatar LiLiuZhou

Merge branch 'develop_mjb_cscmnq_1.0.7' of…

Merge branch 'develop_mjb_cscmnq_1.0.7' of gitlab.huolea.com:wangxuewei/wdlc_mjb_unity into develop_mjb_cscmnq_1.0.7
parents 191ec756 b350c80a
......@@ -62,7 +62,7 @@ public class CSJInterstitialUtil
var adSlot = new AdSlot.Builder()
#if UNITY_IOS
.SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(800, 1200)
.SetExpressViewAcceptedSize(Screen.width * 5 / 6f, Screen.width * 6 / 4f)
#else
.SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(350, 0)
......
......@@ -52,7 +52,7 @@ public class GDTInterstitialAdUtil
if (interstitialAdCacheList.Count > 0)
{
UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue();
interAd.SetListener(new UnifiedInterstitialAdListener(entity,interAd, listener, callback));
interAd.SetListener(new UnifiedInterstitialAdListener(entity, interAd, listener, callback));
interAd.Show();
}
else
......@@ -113,7 +113,9 @@ public class GDTInterstitialAdUtil
/// </summary>
public void OnAdExposured()
{
#if UNITY_ANDROID
callback(true);
#endif
if (listener != null)
{
listener.onInterstitialAdShow();
......@@ -141,6 +143,9 @@ public class GDTInterstitialAdUtil
/// </summary>
public void OnAdClosed()
{
//#if UNITY_IOS
// AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
//#endif
if (listener != null)
{
listener.onInterstitialClose();
......
......@@ -55,7 +55,7 @@ namespace Tencent.GDT
{
return;
}
loadListeners.Add((int)unifiedInterstitialAd, listener);
loadListeners[(int)unifiedInterstitialAd] = listener;
}
public void LoadAd()
......
......@@ -221,15 +221,49 @@ public class AdUtils
}
public static void showInterAd(ZXADInterstitialListener listener)
public static void showInterAd(string actionName, ZXADInterstitialListener listener)
{
IsShowRewardAd = true;
#if UNITY_EDITOR
listener.onInterstitialClose();
return;
#endif
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "InterstitialAd", listener);
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", actionName, new InterstitialAdListener(listener));
#if UNITY_ANDROID
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
#endif
}
/// <summary>
/// 插屏广告回调, 统一在关闭弹窗时给iOS添加加载方法
/// </summary>
private sealed class InterstitialAdListener : ZXADInterstitialListener
{
private ZXADInterstitialListener listener;
public InterstitialAdListener(ZXADInterstitialListener listener)
{
this.listener = listener;
}
public void onInterstitialAdShow()
{
this.listener.onInterstitialAdShow();
}
public void onInterstitialClose()
{
#if UNITY_IOS
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
#endif
this.listener.onInterstitialClose();
}
public void onInterstitialError(string errorMsg)
{
this.listener.onInterstitialError(errorMsg);
}
}
......
......@@ -437,8 +437,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "mrcqg", new InterstitialAdListener());
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
AdUtils.showInterAd("mrcqg", new InterstitialAdListener());
}
}
......@@ -619,8 +618,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "qtjs", new InterstitialAdListener());
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
AdUtils.showInterAd("qtjs", new InterstitialAdListener());
}
}
private void moveAllSpeedDialog()
......@@ -746,8 +744,7 @@ public class DialogControl : MonoBehaviour
// if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
// {
// AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "djhb", new InterstitialAdListener());
// AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
// AdUtils.showInterAd("djhb", new InterstitialAdListener());
// }
......@@ -952,9 +949,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{
AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "wxlw", new InterstitialAdListener());
AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
AdUtils.showInterAd("wxlw", new InterstitialAdListener());
}
}
public void closeBoxReward()
......@@ -1007,9 +1002,7 @@ public class DialogControl : MonoBehaviour
PlayerPrefs.SetInt("CLICL_RED_PACK", a + 1);
if (PlayerPrefs.GetInt("CLICL_RED_PACK") % 5 == 0)
{
AdUtils.showInterAd(new InterstitialAdListener());
// AdManager.Instance.PlayCacheInterstitialAd("Interstitial", "txtc", new InterstitialAdListener());
// AdManager.Instance.LoadCacheInterstitialAd("Interstitial");
AdUtils.showInterAd("InterstitialAd", new InterstitialAdListener());
}
}
//关闭种树提现弹窗
......@@ -1036,6 +1029,7 @@ public class DialogControl : MonoBehaviour
public void onInterstitialAdShow()
{
}
public void onInterstitialClose()
......
......@@ -45,7 +45,7 @@ public class HomeInfoControl : MonoBehaviour, HomeContract.View
private void playIntersitialAd()
{
Debug.Log("无操作播放插屏广告");
AdUtils.showInterAd( new InterstitialAdListener());
AdUtils.showInterAd("InterstitialAd", new InterstitialAdListener());
}
private sealed class InterstitialAdListener : ZXADInterstitialListener
{
......
......@@ -150,7 +150,7 @@ public class StartControl : MonoBehaviour
{
Debug.unityLogger.Log("展示插屏");
yield return new WaitForSeconds(Constant.Instance.Interstitial_time);
AdUtils.showInterAd(new InterstitialAdListener(this));
AdUtils.showInterAd("InterstitialAd", new InterstitialAdListener(this));
}
private sealed class InterstitialAdListener : ZXADInterstitialListener
......
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