Commit fde19213 authored by zhangzhe's avatar zhangzhe

修改iOS报错

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