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 ...@@ -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,7 +52,7 @@ public class GDTInterstitialAdUtil ...@@ -52,7 +52,7 @@ 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.SetListener(new UnifiedInterstitialAdListener(entity, interAd, listener, callback));
interAd.Show(); interAd.Show();
} }
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();
......
...@@ -55,7 +55,7 @@ namespace Tencent.GDT ...@@ -55,7 +55,7 @@ namespace Tencent.GDT
{ {
return; return;
} }
loadListeners.Add((int)unifiedInterstitialAd, listener); loadListeners[(int)unifiedInterstitialAd] = listener;
} }
public void LoadAd() public void LoadAd()
......
...@@ -221,15 +221,49 @@ public class AdUtils ...@@ -221,15 +221,49 @@ 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, new InterstitialAdListener(listener));
#if UNITY_ANDROID
AdManager.Instance.LoadCacheInterstitialAd("Interstitial"); 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 ...@@ -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");
} }
} }
//关闭种树提现弹窗 //关闭种树提现弹窗
...@@ -1036,6 +1029,7 @@ public class DialogControl : MonoBehaviour ...@@ -1036,6 +1029,7 @@ public class DialogControl : MonoBehaviour
public void onInterstitialAdShow() public void onInterstitialAdShow()
{ {
} }
public void onInterstitialClose() public void onInterstitialClose()
......
...@@ -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
{ {
......
...@@ -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
......
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