Commit 6fa33815 authored by 王雪伟's avatar 王雪伟

修复激励视频加载问题

parent 66af472f
This diff is collapsed.
...@@ -13,5 +13,5 @@ public interface ZXADRewardVideoListener ...@@ -13,5 +13,5 @@ public interface ZXADRewardVideoListener
//广告点击 //广告点击
void onAdVideoBarClick(); void onAdVideoBarClick();
//关闭广告 //关闭广告
void onAdClose(); void onAdClose(AdEntity entity);
} }
...@@ -10,4 +10,6 @@ public interface ZXADSplashListener ...@@ -10,4 +10,6 @@ public interface ZXADSplashListener
void onAdSkip(); void onAdSkip();
//获取广告 错误 广告 //获取广告 错误 广告
void onError(string errorMsg); void onError(string errorMsg);
//最后的开屏也没有展示成功
void onLastError();
} }
...@@ -68,7 +68,7 @@ public class ZXADConfig ...@@ -68,7 +68,7 @@ public class ZXADConfig
} }
private Dictionary<string, Queue<AdEntity>> AdCacheMap = new Dictionary<string, Queue<AdEntity>>(); private Dictionary<string, List<AdEntity>> AdCacheMap = new Dictionary<string, List<AdEntity>>();
/// <summary> /// <summary>
/// 保存缓存的广告数据 /// 保存缓存的广告数据
...@@ -78,16 +78,17 @@ public class ZXADConfig ...@@ -78,16 +78,17 @@ public class ZXADConfig
/// <param name="type">广告组</param> /// <param name="type">广告组</param>
public void SetAdCache(string slotName, AdEntity entity,string type) public void SetAdCache(string slotName, AdEntity entity,string type)
{ {
Queue<AdEntity> mAdCacheQueue; Debug.unityLogger.Log("Reward", "Admanger Settype"+ entity.adPlatform+" " + type);
List<AdEntity> mAdCacheQueue;
if (AdCacheMap.ContainsKey(type + slotName)) if (AdCacheMap.ContainsKey(type + slotName))
{ {
mAdCacheQueue = AdCacheMap[type + slotName]; mAdCacheQueue = AdCacheMap[type + slotName];
} }
else else
{ {
mAdCacheQueue = new Queue<AdEntity>(); mAdCacheQueue = new List<AdEntity>();
} }
mAdCacheQueue.Enqueue(entity); mAdCacheQueue.Add(entity);
AdCacheMap[type+slotName] = mAdCacheQueue; AdCacheMap[type+slotName] = mAdCacheQueue;
} }
...@@ -101,14 +102,14 @@ public class ZXADConfig ...@@ -101,14 +102,14 @@ public class ZXADConfig
{ {
if (AdCacheMap.ContainsKey(type+slotName)) if (AdCacheMap.ContainsKey(type+slotName))
{ {
Queue<AdEntity> mAdCacheQueue = AdCacheMap[type + slotName]; List<AdEntity> mAdCacheQueue = AdCacheMap[type + slotName];
if (mAdCacheQueue != null && mAdCacheQueue.Count > 0) if (mAdCacheQueue != null && mAdCacheQueue.Count > 0)
{ {
return mAdCacheQueue.Dequeue(); return mAdCacheQueue[0];
} }
else else
{ {
AdCacheMap.Remove(type + slotName); //AdCacheMap.Remove(type + slotName);
} }
} }
return null; return null;
...@@ -116,10 +117,15 @@ public class ZXADConfig ...@@ -116,10 +117,15 @@ public class ZXADConfig
public void RemoveAdCache(string slotName, string type) public void RemoveAdCache(string slotName, string type)
{ {
//if (AdCacheMap.ContainsKey(type + slotName)) if (AdCacheMap.ContainsKey(type + slotName))
//{ {
// AdCacheMap.Remove(type + slotName); List<AdEntity> mAdCacheQueue = AdCacheMap[type + slotName];
//} if (mAdCacheQueue != null && mAdCacheQueue.Count > 0)
{
mAdCacheQueue.RemoveAt(0);
}
//AdCacheMap.Remove(type + slotName);
}
} }
......
...@@ -41,7 +41,7 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -41,7 +41,7 @@ public class CSJFullScreenUtil : MonoBehaviour
public void LoadCacheFullScreeVideoAd(AdEntity entity, Action<bool> callback) public void LoadCacheFullScreeVideoAd(AdEntity entity, Action<AdEntity> callback)
{ {
//string iosSlotID = "945113164"; //string iosSlotID = "945113164";
string iosSlotID = entity.codeId; string iosSlotID = entity.codeId;
...@@ -68,7 +68,7 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -68,7 +68,7 @@ public class CSJFullScreenUtil : MonoBehaviour
public void PlayCacheFullScreeVideoAd(AdEntity entity, ZXADFullScreenVideoListener listener, Action<bool> callback) public void PlayCacheFullScreeVideoAd(AdEntity entity, ZXADFullScreenVideoListener listener, Action<bool> callback)
{ {
#if UNITY_IOS #if UNITY_IOS
ExpressFullScreenVideoAd fsAd = GetFSVideoAdForIOS(entity.codeGroup+entity.codeId); ExpressFullScreenVideoAd fsAd = GetFSVideoAdForIOS(entity.codeGroup + entity.slotName);
if (fsAd!=null) if (fsAd!=null)
{ {
fsAd.SetFullScreenVideoAdInteractionListener(new FullScreenAdInteractionListener(entity,listener, callback)); fsAd.SetFullScreenVideoAdInteractionListener(new FullScreenAdInteractionListener(entity,listener, callback));
...@@ -82,7 +82,7 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -82,7 +82,7 @@ public class CSJFullScreenUtil : MonoBehaviour
#elif UNITY_ANDROID #elif UNITY_ANDROID
FullScreenVideoAd fsAd = GetFSVideoAdForAndroid(entity.codeGroup + entity.codeId); FullScreenVideoAd fsAd = GetFSVideoAdForAndroid(entity.codeGroup + entity.slotName);
if (fsAd != null) if (fsAd != null)
{ {
fsAd.SetFullScreenVideoAdInteractionListener(new FullScreenAdInteractionListener(entity, listener, callback)); fsAd.SetFullScreenVideoAdInteractionListener(new FullScreenAdInteractionListener(entity, listener, callback));
...@@ -103,8 +103,8 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -103,8 +103,8 @@ public class CSJFullScreenUtil : MonoBehaviour
{ {
private CSJFullScreenUtil example; private CSJFullScreenUtil example;
private AdEntity entity; private AdEntity entity;
private Action<bool> callback; private Action<AdEntity> callback;
public FullScreenVideoAdListener(CSJFullScreenUtil example, AdEntity entity, Action<bool> callback) public FullScreenVideoAdListener(CSJFullScreenUtil example, AdEntity entity, Action<AdEntity> callback)
{ {
this.example = example; this.example = example;
this.entity = entity; this.entity = entity;
...@@ -114,7 +114,7 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -114,7 +114,7 @@ public class CSJFullScreenUtil : MonoBehaviour
public void OnError(int code, string message) public void OnError(int code, string message)
{ {
EventUtils.onEventPullFail(entity,code.ToString(),message); EventUtils.onEventPullFail(entity,code.ToString(),message);
callback(false); callback(null);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "CSJ 全屏视频 Error " + code + " meg " + message); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "CSJ 全屏视频 Error " + code + " meg " + message);
} }
...@@ -122,8 +122,8 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -122,8 +122,8 @@ public class CSJFullScreenUtil : MonoBehaviour
{ {
#if UNITY_IOS #if UNITY_IOS
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
callback(true); callback(entity);
example.SetFSVideoAdForIOS(entity.codeGroup+entity.codeId, ad); example.SetFSVideoAdForIOS(entity.codeGroup + entity.slotName, ad);
#endif #endif
} }
...@@ -131,8 +131,8 @@ public class CSJFullScreenUtil : MonoBehaviour ...@@ -131,8 +131,8 @@ public class CSJFullScreenUtil : MonoBehaviour
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
callback(true); callback(entity);
example.SetFSVideoAdForAndroid(entity.codeGroup + entity.codeId, ad); example.SetFSVideoAdForAndroid(entity.codeGroup + entity.slotName, ad);
#endif #endif
} }
......
...@@ -45,7 +45,7 @@ public class CSJRewardUtil ...@@ -45,7 +45,7 @@ public class CSJRewardUtil
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
/// <param name="callback"></param> /// <param name="callback"></param>
public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback) public void LoadCacheRewardAd(AdEntity entity, Action<AdEntity> callback)
{ {
//string iosSlotID = "945113162"; //string iosSlotID = "945113162";
...@@ -86,9 +86,9 @@ public class CSJRewardUtil ...@@ -86,9 +86,9 @@ public class CSJRewardUtil
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
RewardVideoAd rewardAd = GetRewardVideoAdForAndroid(entity.codeGroup+entity.codeId); RewardVideoAd rewardAd = GetRewardVideoAdForAndroid(entity.codeGroup + entity.slotName);
#elif UNITY_IOS #elif UNITY_IOS
ExpressRewardVideoAd rewardAd = GetRewardVideoAdForIOS(entity.codeGroup+entity.codeId); ExpressRewardVideoAd rewardAd = GetRewardVideoAdForIOS(entity.codeGroup + entity.slotName);
#endif #endif
if (rewardAd != null) if (rewardAd != null)
{ {
...@@ -109,9 +109,9 @@ public class CSJRewardUtil ...@@ -109,9 +109,9 @@ public class CSJRewardUtil
{ {
private CSJRewardUtil csjAD; private CSJRewardUtil csjAD;
private AdEntity entity; private AdEntity entity;
private Action<bool> callback; private Action<AdEntity> callback;
public RewardVideoAdListener(CSJRewardUtil example, AdEntity entity, Action<bool> callback) public RewardVideoAdListener(CSJRewardUtil example, AdEntity entity, Action<AdEntity> callback)
{ {
this.csjAD = example; this.csjAD = example;
this.entity = entity; this.entity = entity;
...@@ -122,8 +122,8 @@ public class CSJRewardUtil ...@@ -122,8 +122,8 @@ public class CSJRewardUtil
{ {
EventUtils.onEventPullFail(entity, code.ToString(),message); EventUtils.onEventPullFail(entity, code.ToString(),message);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + code + " msg" + message); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + code + " msg" + message);
callback(false); callback(null);
} }
public void OnRewardVideoAdLoad(RewardVideoAd ad) public void OnRewardVideoAdLoad(RewardVideoAd ad)
{ {
...@@ -135,8 +135,8 @@ public class CSJRewardUtil ...@@ -135,8 +135,8 @@ public class CSJRewardUtil
//this.csjAD.rewardAd = ad; //this.csjAD.rewardAd = ad;
#if UNITY_ANDROID #if UNITY_ANDROID
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
this.csjAD.SetRewardVideoAdForAndroid(entity.codeGroup + entity.codeId, ad); this.csjAD.SetRewardVideoAdForAndroid(entity.codeGroup + entity.slotName, ad);
callback(true); callback(entity);
#endif #endif
} }
...@@ -144,7 +144,7 @@ public class CSJRewardUtil ...@@ -144,7 +144,7 @@ public class CSJRewardUtil
{ {
#if UNITY_IOS #if UNITY_IOS
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
this.csjAD.SetRewardVideoAdForIOS(entity.codeGroup+entity.codeId, ad); this.csjAD.SetRewardVideoAdForIOS(entity.codeGroup + entity.slotName, ad);
callback(true); callback(true);
#endif #endif
} }
...@@ -197,7 +197,7 @@ public class CSJRewardUtil ...@@ -197,7 +197,7 @@ public class CSJRewardUtil
public void OnAdClose() public void OnAdClose()
{ {
Debug.Log("rewardVideoAd close"); Debug.Log("rewardVideoAd close");
listener.onAdClose(); listener.onAdClose(entity);
//this.cjsAd.rewardAd = null; //this.cjsAd.rewardAd = null;
#if UNITY_IOS #if UNITY_IOS
...@@ -271,6 +271,8 @@ public class CSJRewardUtil ...@@ -271,6 +271,8 @@ public class CSJRewardUtil
{ {
return mRewardQueue.Dequeue(); return mRewardQueue.Dequeue();
} }
} }
return null; return null;
} }
...@@ -318,6 +320,7 @@ public class CSJRewardUtil ...@@ -318,6 +320,7 @@ public class CSJRewardUtil
{ {
return mRewardQueue.Dequeue(); return mRewardQueue.Dequeue();
} }
} }
return null; return null;
} }
......
...@@ -219,7 +219,7 @@ public class CSJSplshADUtils ...@@ -219,7 +219,7 @@ public class CSJSplshADUtils
public void OnAdSkip() public void OnAdSkip()
{ {
EventUtils.onEventAdComplete(entity); EventUtils.onEventAdComplete(entity);
listener.onAdSkip(); //listener.onAdSkip();
Debug.Log("splash Ad OnAdSkip"); Debug.Log("splash Ad OnAdSkip");
DestorySplash(); DestorySplash();
} }
......
...@@ -42,11 +42,10 @@ public class AdDemo : MonoBehaviour ...@@ -42,11 +42,10 @@ public class AdDemo : MonoBehaviour
this.demo = demo; this.demo = demo;
} }
public void onAdClose(AdEntity entity)
public void onAdClose()
{ {
this.demo.RewardAdResult.text = "Reward onAdClose"; this.demo.RewardAdResult.text = "Reward onAdClose";
AdManager.Instance.LoadCacheRewardVideoAd("video"); //AdManager.Instance.LoadCacheRewardVideoAd("video");
//YLBRewardAdUtil.Instance.LoadYLBAd(); //YLBRewardAdUtil.Instance.LoadYLBAd();
} }
...@@ -114,6 +113,11 @@ public class AdDemo : MonoBehaviour ...@@ -114,6 +113,11 @@ public class AdDemo : MonoBehaviour
{ {
this.demo.RewardAdResult.text = "开屏错误" + errorMsg; this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
} }
public void onLastError()
{
}
} }
......
...@@ -3028,7 +3028,7 @@ PrefabInstance: ...@@ -3028,7 +3028,7 @@ PrefabInstance:
- target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6, - target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3} type: 3}
propertyPath: IS_TEST propertyPath: IS_TEST
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6, - target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3} type: 3}
......
...@@ -28,7 +28,7 @@ public class GDTFullScreenAdUtil ...@@ -28,7 +28,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
/// <param name="callback"></param> /// <param name="callback"></param>
public void LoadCacheFullScreeVideoAd(AdEntity entity, Action<bool> callback) public void LoadCacheFullScreeVideoAd(AdEntity entity, Action<AdEntity> callback)
{ {
//string posId = Constants.intersititialFullScreenVideoPosId;//全屏视频测试ID //string posId = Constants.intersititialFullScreenVideoPosId;//全屏视频测试ID
...@@ -68,22 +68,23 @@ public class GDTFullScreenAdUtil ...@@ -68,22 +68,23 @@ public class GDTFullScreenAdUtil
private GDTFullScreenAdUtil example; private GDTFullScreenAdUtil example;
private UnifiedInterstitialAd ad; private UnifiedInterstitialAd ad;
private ZXADFullScreenVideoListener listener; private ZXADFullScreenVideoListener listener;
private Action<bool> callback; private Action<AdEntity> loadcallback;
private Action<bool> showcallback;
private bool isSkipAd; private bool isSkipAd;
public UnifiedInterstitialAdListener(AdEntity entity,GDTFullScreenAdUtil example, UnifiedInterstitialAd ad, Action<bool> callback) public UnifiedInterstitialAdListener(AdEntity entity,GDTFullScreenAdUtil example, UnifiedInterstitialAd ad, Action<AdEntity> loadcallback)
{ {
this.entity = entity; this.entity = entity;
this.example = example; this.example = example;
this.ad = ad; this.ad = ad;
this.callback = callback; this.loadcallback = loadcallback;
} }
public UnifiedInterstitialAdListener(AdEntity entity, ZXADFullScreenVideoListener listener, Action<bool> callback) public UnifiedInterstitialAdListener(AdEntity entity, ZXADFullScreenVideoListener listener, Action<bool> showcallback)
{ {
isSkipAd = true; isSkipAd = true;
this.entity = entity; this.entity = entity;
this.listener = listener; this.listener = listener;
this.callback = callback; this.showcallback = showcallback;
} }
/// <summary> /// <summary>
...@@ -94,8 +95,8 @@ public class GDTFullScreenAdUtil ...@@ -94,8 +95,8 @@ public class GDTFullScreenAdUtil
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
if (ad != null) if (ad != null)
{ {
callback(true);
example.SetFSVideoAd(entity.codeGroup+entity.codeId, ad); example.SetFSVideoAd(entity.codeGroup+entity.codeId, ad);
loadcallback(entity);
} }
} }
...@@ -105,7 +106,11 @@ public class GDTFullScreenAdUtil ...@@ -105,7 +106,11 @@ public class GDTFullScreenAdUtil
public void OnError(AdError error) public void OnError(AdError error)
{ {
EventUtils.onEventPullFail(entity, error.GetErrorCode().ToString(), error.GetErrorMsg()); EventUtils.onEventPullFail(entity, error.GetErrorCode().ToString(), error.GetErrorMsg());
callback(false); if (ad != null)
{
loadcallback(null);
}
showcallback(false);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "GDT 全屏视频 Error " + error.GetErrorCode() + " meg " + error.GetErrorMsg()); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "GDT 全屏视频 Error " + error.GetErrorCode() + " meg " + error.GetErrorMsg());
} }
...@@ -229,7 +234,7 @@ public class GDTFullScreenAdUtil ...@@ -229,7 +234,7 @@ public class GDTFullScreenAdUtil
{ {
listener.onError("GDT 全屏视频播放失败"); listener.onError("GDT 全屏视频播放失败");
} }
callback(false); showcallback(false);
} }
/// <summary> /// <summary>
......
...@@ -26,11 +26,11 @@ public class GDTRewardAdUtil ...@@ -26,11 +26,11 @@ public class GDTRewardAdUtil
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
/// <param name="callback"></param> /// <param name="callback"></param>
public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback) public void LoadCacheRewardAd(AdEntity entity, Action<AdEntity> callback)
{ {
RewardVideoAd rewardVideoAd = new RewardVideoAd(entity.codeId); RewardVideoAd rewardVideoAd = new RewardVideoAd(entity.codeId);
rewardVideoAd.SetListener(new RewardVideoAdListener(this, entity, rewardVideoAd, callback, true)); rewardVideoAd.SetListener(new RewardVideoAdListener(this, entity, rewardVideoAd, callback, true));
rewardVideoAd.SetVideoMuted(false);//设置声音 rewardVideoAd.SetVideoMuted(false);//设置静音声音
rewardVideoAd.LoadAd(); rewardVideoAd.LoadAd();
} }
...@@ -42,7 +42,7 @@ public class GDTRewardAdUtil ...@@ -42,7 +42,7 @@ public class GDTRewardAdUtil
/// <param name="callback"></param> /// <param name="callback"></param>
public void playCacheRewardAd(AdEntity entity, ZXADRewardVideoListener listener, Action<bool> callback) public void playCacheRewardAd(AdEntity entity, ZXADRewardVideoListener listener, Action<bool> callback)
{ {
RewardVideoAd rewardAd = GetRewardVideoAd(entity.codeGroup + entity.codeId); RewardVideoAd rewardAd = GetRewardVideoAd(entity.codeGroup + entity.slotName);
if (rewardAd != null) if (rewardAd != null)
{ {
...@@ -50,7 +50,7 @@ public class GDTRewardAdUtil ...@@ -50,7 +50,7 @@ public class GDTRewardAdUtil
#if UNITY_IOS #if UNITY_IOS
rewardAd.SetEnableDefaultAudioSessionSetting(false); rewardAd.SetEnableDefaultAudioSessionSetting(false);
#endif #endif
rewardAd.SetVideoMuted(false);//设置是否打开声音 rewardAd.SetVideoMuted(false);//设置静音声音
rewardAd.ShowAD(); rewardAd.ShowAD();
} }
else else
...@@ -69,23 +69,24 @@ public class GDTRewardAdUtil ...@@ -69,23 +69,24 @@ public class GDTRewardAdUtil
private GDTRewardAdUtil gdtAdUtils; private GDTRewardAdUtil gdtAdUtils;
private AdEntity entity; private AdEntity entity;
private RewardVideoAd rewardVideo; private RewardVideoAd rewardVideo;
private Action<bool> callback; private Action<AdEntity> loadcallback;
private Action<bool> showcallback;
private ZXADRewardVideoListener listener; private ZXADRewardVideoListener listener;
public RewardVideoAdListener(GDTRewardAdUtil gdtAdUtils, AdEntity entity, RewardVideoAd reward, Action<bool> callback, bool isLoad) public RewardVideoAdListener(GDTRewardAdUtil gdtAdUtils, AdEntity entity, RewardVideoAd reward, Action<AdEntity> loadcallback, bool isLoad)
{ {
this.isLoad = isLoad; this.isLoad = isLoad;
this.entity = entity; this.entity = entity;
this.gdtAdUtils = gdtAdUtils; this.gdtAdUtils = gdtAdUtils;
this.rewardVideo = reward; this.rewardVideo = reward;
this.callback = callback; this.loadcallback = loadcallback;
} }
public RewardVideoAdListener(ZXADRewardVideoListener listener, AdEntity entity, Action<bool> callback, bool isLoad) public RewardVideoAdListener(ZXADRewardVideoListener listener, AdEntity entity, Action<bool> showcallback, bool isLoad)
{ {
this.isLoad = isLoad; this.isLoad = isLoad;
this.entity = entity; this.entity = entity;
this.listener = listener; this.listener = listener;
this.callback = callback; this.showcallback = showcallback;
} }
public void OnAdClicked() public void OnAdClicked()
...@@ -101,7 +102,7 @@ public class GDTRewardAdUtil ...@@ -101,7 +102,7 @@ public class GDTRewardAdUtil
{ {
if (listener != null) if (listener != null)
{ {
listener.onAdClose(); listener.onAdClose(entity);
} }
} }
...@@ -124,7 +125,7 @@ public class GDTRewardAdUtil ...@@ -124,7 +125,7 @@ public class GDTRewardAdUtil
if (listener != null) if (listener != null)
{ {
listener.onAdShow(); listener.onAdShow();
callback(true); showcallback(true);
} }
} }
...@@ -133,16 +134,17 @@ public class GDTRewardAdUtil ...@@ -133,16 +134,17 @@ public class GDTRewardAdUtil
if (isLoad) if (isLoad)
{ {
EventUtils.onEventPullFail(entity, error.GetErrorCode().ToString(), error.GetErrorMsg()); EventUtils.onEventPullFail(entity, error.GetErrorCode().ToString(), error.GetErrorMsg());
loadcallback(null);
} }
else else
{ {
EventUtils.onEventShowFail(entity); EventUtils.onEventShowFail(entity);
showcallback(false);
} }
if (listener != null) if (listener != null)
{ {
listener.onError("GDT RewardVideo ErrorCode" + error.GetErrorCode() + " Msg:" + error.GetErrorMsg()); listener.onError("GDT RewardVideo ErrorCode" + error.GetErrorCode() + " Msg:" + error.GetErrorMsg());
} }
callback(false);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + error.GetErrorCode() + " msg" + error.GetErrorMsg()); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + error.GetErrorCode() + " msg" + error.GetErrorMsg());
} }
...@@ -156,8 +158,8 @@ public class GDTRewardAdUtil ...@@ -156,8 +158,8 @@ public class GDTRewardAdUtil
if (isLoad) if (isLoad)
{ {
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
this.gdtAdUtils.SetRewardVideoAd(entity.codeGroup + entity.codeId, this.rewardVideo); this.gdtAdUtils.SetRewardVideoAd(entity.codeGroup + entity.slotName, this.rewardVideo);
callback(true); loadcallback(entity);
} }
} }
......
...@@ -28,7 +28,7 @@ public class YLBRewardAdUtil ...@@ -28,7 +28,7 @@ public class YLBRewardAdUtil
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
/// <param name="callback"></param> /// <param name="callback"></param>
public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback) public void LoadCacheRewardAd(AdEntity entity, Action<AdEntity> callback)
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
YLBRewardAD rewardVideoAd = new YLBRewardAD(); YLBRewardAD rewardVideoAd = new YLBRewardAD();
...@@ -47,7 +47,7 @@ public class YLBRewardAdUtil ...@@ -47,7 +47,7 @@ public class YLBRewardAdUtil
/// <param name="callback"></param> /// <param name="callback"></param>
public void playCacheRewardAd(AdEntity entity, ZXADRewardVideoListener listener, Action<bool> callback) public void playCacheRewardAd(AdEntity entity, ZXADRewardVideoListener listener, Action<bool> callback)
{ {
YLBRewardAD rewardVideoAd = GetRewardVideoAd(entity.codeGroup + entity.codeId); YLBRewardAD rewardVideoAd = GetRewardVideoAd(entity.codeGroup + entity.slotName);
if (rewardVideoAd != null) if (rewardVideoAd != null)
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.codeGroup+"YLB Not NUll"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.codeGroup+"YLB Not NUll");
...@@ -71,8 +71,8 @@ public class YLBRewardAdUtil ...@@ -71,8 +71,8 @@ public class YLBRewardAdUtil
private YLBRewardAdUtil adUtil; private YLBRewardAdUtil adUtil;
private AdEntity entity; private AdEntity entity;
private YLBRewardAD rewardVideo; private YLBRewardAD rewardVideo;
private Action<bool> callback; private Action<AdEntity> callback;
public RewardVideoAdLoadListener(YLBRewardAdUtil adUtil,AdEntity entity, YLBRewardAD rewardVideo, Action<bool> callback) public RewardVideoAdLoadListener(YLBRewardAdUtil adUtil,AdEntity entity, YLBRewardAD rewardVideo, Action<AdEntity> callback)
{ {
this.adUtil = adUtil; this.adUtil = adUtil;
this.entity = entity; this.entity = entity;
...@@ -84,14 +84,14 @@ public class YLBRewardAdUtil ...@@ -84,14 +84,14 @@ public class YLBRewardAdUtil
{ {
Debug.unityLogger.Log(entity.codeGroup+" codeID " +entity.codeId+"YLB Error code" +code+"message"+message); Debug.unityLogger.Log(entity.codeGroup+" codeID " +entity.codeId+"YLB Error code" +code+"message"+message);
EventUtils.onEventPullFail(entity, code.ToString(),message); EventUtils.onEventPullFail(entity, code.ToString(),message);
callback(false); callback(null);
} }
public void onLoad() public void onLoad()
{ {
EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
adUtil.SetRewardVideoAd(entity.codeGroup + entity.codeId, this.rewardVideo); adUtil.SetRewardVideoAd(entity.codeGroup + entity.slotName, this.rewardVideo);
callback(true); callback(entity);
} }
} }
...@@ -115,7 +115,7 @@ public class YLBRewardAdUtil ...@@ -115,7 +115,7 @@ public class YLBRewardAdUtil
public void onAdClose() public void onAdClose()
{ {
listener.onAdClose(); listener.onAdClose(entity);
} }
public void onAdShow() public void onAdShow()
......
...@@ -9,8 +9,7 @@ namespace ZXHC ...@@ -9,8 +9,7 @@ namespace ZXHC
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
ZXHCADManager.Init("1000127"); ZXHCADManager.Init("1000127",true);
ZXHCUtils.SetDeviceOaid("1231wsd3242f");
} }
// Update is called once per frame // Update is called once per frame
...@@ -64,6 +63,11 @@ namespace ZXHC ...@@ -64,6 +63,11 @@ namespace ZXHC
{ {
Debug.unityLogger.Log("开屏错误"+ errorMsg); Debug.unityLogger.Log("开屏错误"+ errorMsg);
} }
public void onLastError()
{
}
} }
public void OnClickOaid() public void OnClickOaid()
......
...@@ -92,29 +92,29 @@ public class ZXHCFeedUtil ...@@ -92,29 +92,29 @@ public class ZXHCFeedUtil
} }
public void OnAdClicked() public void OnAdClicked()
{ {
//EventUtils.onEventAdClick(entity); EventUtils.onEventAdClick(entity);
} }
public void OnAdClosed() public void OnAdClosed()
{ {
//EventUtils.onEventAdComplete(entity); EventUtils.onEventAdComplete(entity);
} }
public void OnAdLoaded() public void OnAdLoaded()
{ {
//EventUtils.onEventPullSuccess(entity); EventUtils.onEventPullSuccess(entity);
feedAdCacheList.Enqueue(feedAd); feedAdCacheList.Enqueue(feedAd);
callback(true); callback(true);
} }
public void OnAdShow() public void OnAdShow()
{ {
//EventUtils.onEventShowSuccess(entity); EventUtils.onEventShowSuccess(entity);
} }
public void OnError(string code, string error) public void OnError(string code, string error)
{ {
//EventUtils.onEventPullFail(entity, code, error); EventUtils.onEventPullFail(entity, code, error);
callback(false); callback(false);
} }
} }
......
...@@ -63,12 +63,12 @@ public class ZXHCSplashUtil ...@@ -63,12 +63,12 @@ public class ZXHCSplashUtil
public void OnAdClicked() public void OnAdClicked()
{ {
//EventUtils.onEventAdClick(entity); EventUtils.onEventAdClick(entity);
} }
public void OnAdClosed() public void OnAdClosed()
{ {
//EventUtils.onEventAdComplete(entity); EventUtils.onEventAdComplete(entity);
this.listener.onAdSkip(); this.listener.onAdSkip();
} }
...@@ -88,13 +88,13 @@ public class ZXHCSplashUtil ...@@ -88,13 +88,13 @@ public class ZXHCSplashUtil
public void OnAdShow() public void OnAdShow()
{ {
//EventUtils.onEventShowSuccess(entity); EventUtils.onEventShowSuccess(entity);
this.listener.onAdShow(); this.listener.onAdShow();
} }
public void OnError(string code, string error) public void OnError(string code, string error)
{ {
//EventUtils.onEventPullFail(entity, code, error); EventUtils.onEventPullFail(entity, code, error);
this.listener.onError("ZXHC Splsh Error Code" + code + " Msg " + error); this.listener.onError("ZXHC Splsh Error Code" + code + " Msg " + error);
callback(false); callback(false);
} }
......
...@@ -9,11 +9,11 @@ namespace ZXHC ...@@ -9,11 +9,11 @@ namespace ZXHC
public class ZXHCADManager public class ZXHCADManager
{ {
private static bool hasInit = false; private static bool hasInit = false;
public static bool Init(string appId) public static bool Init(string appId,bool IsDebug)
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
AndroidJavaObject hcAdManager = new AndroidJavaClass("com.ym.zxhcsdk.manager.ZXHCADManager").CallStatic<AndroidJavaObject>("getInstance"); AndroidJavaObject hcAdManager = new AndroidJavaClass("com.ym.zxhcsdk.manager.ZXHCADManager").CallStatic<AndroidJavaObject>("getInstance");
hasInit = hcAdManager.Call<bool>("InitAd",ZXHCUtils.GetActivity(),appId); hasInit = hcAdManager.Call<bool>("InitAd",ZXHCUtils.GetActivity(),appId, IsDebug);
OaidUtil.GetOaid(new Action<string>((oaid) => { OaidUtil.GetOaid(new Action<string>((oaid) => {
ZXHCUtils.SetDeviceOaid(oaid); ZXHCUtils.SetDeviceOaid(oaid);
})); }));
......
...@@ -118,6 +118,11 @@ public class Splash : MonoBehaviour ...@@ -118,6 +118,11 @@ public class Splash : MonoBehaviour
{ {
SceneManager.LoadSceneAsync("AdDemo"); SceneManager.LoadSceneAsync("AdDemo");
} }
public void onLastError()
{
}
} }
......
...@@ -14,13 +14,13 @@ EditorBuildSettings: ...@@ -14,13 +14,13 @@ EditorBuildSettings:
- enabled: 0 - enabled: 0
path: Assets/AdSDK/SplashDemo/Splash.unity path: Assets/AdSDK/SplashDemo/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 0 - enabled: 1
path: Assets/AdSDK/AD/Demo/AdDemo.unity path: Assets/AdSDK/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2 guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 0 - enabled: 0
path: Assets/AdSDK/NetWork/Demo/HttpDemo.unity path: Assets/AdSDK/NetWork/Demo/HttpDemo.unity
guid: 1d254830c8b62484bb74d303cbb2cc3d guid: 1d254830c8b62484bb74d303cbb2cc3d
- enabled: 1 - enabled: 0
path: Assets/AdSDK/AD/ZXHC/ZXHCDemo/ZXHCDemo.unity path: Assets/AdSDK/AD/ZXHC/ZXHCDemo/ZXHCDemo.unity
guid: cb50b98bfef171a4ea884c941dd43fa3 guid: cb50b98bfef171a4ea884c941dd43fa3
m_configObjects: {} m_configObjects: {}
...@@ -175,7 +175,7 @@ PlayerSettings: ...@@ -175,7 +175,7 @@ PlayerSettings:
androidSupportedAspectRatio: 1 androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
applicationIdentifier: applicationIdentifier:
Android: com.ym.yzqj Android: com.ym.awpdd
Lumin: com.DefaultCompany.com.unity.template.mobile2D Lumin: com.DefaultCompany.com.unity.template.mobile2D
Standalone: com.DefaultCompany.com.unity.template.mobile2D Standalone: com.DefaultCompany.com.unity.template.mobile2D
iPhone: com.DefaultCompany.com.unity.template.mobile2D iPhone: com.DefaultCompany.com.unity.template.mobile2D
......
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