Commit fde19213 authored by zhangzhe's avatar zhangzhe

修改iOS报错

parent e9460770
...@@ -57,11 +57,11 @@ public class CSJRewardUtil ...@@ -57,11 +57,11 @@ public class CSJRewardUtil
.SetCodeId(iosSlotID) .SetCodeId(iosSlotID)
#else #else
.SetCodeId(AndroidSlotID) .SetCodeId(AndroidSlotID)
.SetRewardName("金币") // 奖励的名称
.SetRewardAmount(3) // 奖励的数量
#endif #endif
.SetSupportDeepLink(true) .SetSupportDeepLink(true)
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
.SetRewardName("金币") // 奖励的名称
.SetRewardAmount(3) // 奖励的数量
.SetUserID("user123") // 用户id,必传参数 .SetUserID("user123") // 用户id,必传参数
.SetMediaExtra("media_extra") // 附加参数,可选 .SetMediaExtra("media_extra") // 附加参数,可选
.SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向 .SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向
......
...@@ -59,8 +59,15 @@ public class CSJSplshADUtils ...@@ -59,8 +59,15 @@ public class CSJSplshADUtils
/// <param name="activity"></param> /// <param name="activity"></param>
/// <param name="splashAdManager"></param> /// <param name="splashAdManager"></param>
/// <param name="listener"></param> /// <param name="listener"></param>
public void LoadSplshAd(AdEntity entity,AndroidJavaObject activity, AndroidJavaObject splashAdManager, ZXADSplashListener listener, Action<bool> callback) public void LoadSplshAd(AdEntity entity, AndroidJavaObject activity, AndroidJavaObject splashAdManager, ZXADSplashListener listener, Action<bool> callback)
{ {
#if UNITY_IOS
if (this.splashAd != null)
{
this.splashAd.Dispose();
this.splashAd = null;
}
#endif
//string iosSlotID = "800546808"; //string iosSlotID = "800546808";
//string AndroidSlotID = "801121648"; //string AndroidSlotID = "801121648";
string iosSlotID = entity.codeId; string iosSlotID = entity.codeId;
...@@ -81,7 +88,7 @@ public class CSJSplshADUtils ...@@ -81,7 +88,7 @@ public class CSJSplshADUtils
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
.Build(); .Build();
#if UNITY_IOS #if UNITY_IOS
this.AdNative.LoadSplashAd(adSlot, new SplashAdListener(entity,this,listener,callback)); splashAd = this.AdNative.LoadSplashAd_iOS(adSlot, new SplashAdListener(entity, this, listener, callback));
#else #else
this.AdNative.LoadSplashAd(adSlot, new SplashAdListener(entity,this, listener, activity, splashAdManager, callback)); this.AdNative.LoadSplashAd(adSlot, new SplashAdListener(entity,this, listener, activity, splashAdManager, callback));
#endif #endif
...@@ -99,7 +106,7 @@ public class CSJSplshADUtils ...@@ -99,7 +106,7 @@ public class CSJSplshADUtils
private AndroidJavaObject activity; private AndroidJavaObject activity;
private AndroidJavaObject splashAdManager; private AndroidJavaObject splashAdManager;
private const int INTERACTION_TYPE_DOWNLOAD = 4; private const int INTERACTION_TYPE_DOWNLOAD = 4;
public SplashAdListener(AdEntity entity,CSJSplshADUtils example, ZXADSplashListener listener, Action<bool> callback) public SplashAdListener(AdEntity entity, CSJSplshADUtils example, ZXADSplashListener listener, Action<bool> callback)
{ {
this.entity = entity; this.entity = entity;
this.csjAD = example; this.csjAD = example;
...@@ -107,7 +114,7 @@ public class CSJSplshADUtils ...@@ -107,7 +114,7 @@ public class CSJSplshADUtils
this.callback = callback; this.callback = callback;
} }
public SplashAdListener(AdEntity entity,CSJSplshADUtils example, ZXADSplashListener listener, AndroidJavaObject activity, AndroidJavaObject splashAdManager, Action<bool> callback) public SplashAdListener(AdEntity entity, CSJSplshADUtils example, ZXADSplashListener listener, AndroidJavaObject activity, AndroidJavaObject splashAdManager, Action<bool> callback)
{ {
this.entity = entity; this.entity = entity;
this.csjAD = example; this.csjAD = example;
...@@ -127,6 +134,7 @@ public class CSJSplshADUtils ...@@ -127,6 +134,7 @@ public class CSJSplshADUtils
public void OnSplashAdLoad(BUSplashAd ad) public void OnSplashAdLoad(BUSplashAd ad)
{ {
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
if (ad != null) if (ad != null)
{ {
...@@ -134,7 +142,7 @@ public class CSJSplshADUtils ...@@ -134,7 +142,7 @@ public class CSJSplshADUtils
this.csjAD.splashAd = ad; this.csjAD.splashAd = ad;
Debug.Log("splash load Onsucc:"); Debug.Log("splash load Onsucc:");
#if UNITY_IOS #if UNITY_IOS
ad.SetSplashInteractionListener(new SplashAdInteractionListener(entity,this.csjAD,listener)); ad.SetSplashInteractionListener(new SplashAdInteractionListener(entity, this.csjAD, listener));
#else #else
ad.SetSplashInteractionListener(new SplashAdInteractionListener(entity,this.csjAD, listener, this.activity, this.splashAdManager)); ad.SetSplashInteractionListener(new SplashAdInteractionListener(entity,this.csjAD, listener, this.activity, this.splashAdManager));
if (ad.GetInteractionType() == INTERACTION_TYPE_DOWNLOAD) if (ad.GetInteractionType() == INTERACTION_TYPE_DOWNLOAD)
...@@ -144,6 +152,20 @@ public class CSJSplshADUtils ...@@ -144,6 +152,20 @@ public class CSJSplshADUtils
} }
#endif #endif
} }
#if UNITY_IOS
else if (this.csjAD.splashAd != null)
{
callback(true);
ad = this.csjAD.splashAd;
Debug.Log("splash load Onsucc:");
ad.SetSplashInteractionListener(new SplashAdInteractionListener(entity, this.csjAD, listener));
}
#endif
else
{
callback(false);
}
#if UNITY_ANDROID #if UNITY_ANDROID
if (ad != null && this.splashAdManager != null && this.activity != null) if (ad != null && this.splashAdManager != null && this.activity != null)
{ {
...@@ -160,7 +182,7 @@ public class CSJSplshADUtils ...@@ -160,7 +182,7 @@ public class CSJSplshADUtils
private ZXADSplashListener listener; private ZXADSplashListener listener;
private AndroidJavaObject activity; private AndroidJavaObject activity;
private AndroidJavaObject splashAdManager; private AndroidJavaObject splashAdManager;
public SplashAdInteractionListener(AdEntity entity,CSJSplshADUtils example, ZXADSplashListener listener) public SplashAdInteractionListener(AdEntity entity, CSJSplshADUtils example, ZXADSplashListener listener)
{ {
this.entity = entity; this.entity = entity;
this.csjAD = example; this.csjAD = example;
...@@ -222,7 +244,9 @@ public class CSJSplshADUtils ...@@ -222,7 +244,9 @@ public class CSJSplshADUtils
EventUtils.onEventAdComplete(entity); EventUtils.onEventAdComplete(entity);
//listener.onAdSkip(); //listener.onAdSkip();
Debug.Log("splash Ad OnAdSkip"); Debug.Log("splash Ad OnAdSkip");
#if UNITY_ANDROID
DestorySplash(); DestorySplash();
#endif
} }
/// <summary> /// <summary>
...@@ -231,7 +255,9 @@ public class CSJSplshADUtils ...@@ -231,7 +255,9 @@ public class CSJSplshADUtils
public void OnAdTimeOver() public void OnAdTimeOver()
{ {
Debug.Log("splash Ad OnAdTimeOver"); Debug.Log("splash Ad OnAdTimeOver");
#if UNITY_ANDROID
DestorySplash(); DestorySplash();
#endif
} }
public void OnAdClose() public void OnAdClose()
......
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