Commit 2d774dc4 authored by 王雪伟's avatar 王雪伟

更新AdManager

parent 3e40dba3
...@@ -3,7 +3,6 @@ using System.Collections.Generic; ...@@ -3,7 +3,6 @@ using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System; using System;
using Tencent.GDT; using Tencent.GDT;
using System.Runtime.InteropServices;
using ByteDance.Union; using ByteDance.Union;
using ZXHC; using ZXHC;
using LitJson; using LitJson;
...@@ -58,8 +57,8 @@ public class AdManager ...@@ -58,8 +57,8 @@ public class AdManager
private bool IsFirstLoadFSAd = false; private bool IsFirstLoadFSAd = false;
public void InitAd(Action<bool> callback) public void InitAd(Action<bool> callback)
{ {
IsFirstLoadRewardAd = true; //IsFirstLoadRewardAd = true;
IsFirstLoadFSAd = true; //IsFirstLoadFSAd = true;
//paras.Clear(); //paras.Clear();
//paras.Add("pkg", "com.ym.xynt"); //paras.Add("pkg", "com.ym.xynt");
//获取广告配置 //获取广告配置
...@@ -117,7 +116,7 @@ public class AdManager ...@@ -117,7 +116,7 @@ public class AdManager
return; return;
#endif #endif
//穿山甲 //穿山甲
if (ZXADConfig.Instance.CSJ_AD_APP_ID != null&& ZXADConfig.Instance.CSJ_AD_APP_ID!="") if (ZXADConfig.Instance.CSJ_AD_APP_ID != null && ZXADConfig.Instance.CSJ_AD_APP_ID != "")
{ {
#if UNITY_ANDROID #if UNITY_ANDROID
...@@ -153,7 +152,7 @@ public class AdManager ...@@ -153,7 +152,7 @@ public class AdManager
ZXHCADManager.Init(ZXADConfig.Instance.HC_AD_APP_ID, Constant.Instance.IsTestNet); ZXHCADManager.Init(ZXADConfig.Instance.HC_AD_APP_ID, Constant.Instance.IsTestNet);
#endif #endif
} }
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "ZXADConfig.Instance.HC_AD_APP_ID "+ ZXADConfig.Instance.HC_AD_APP_ID); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "ZXADConfig.Instance.HC_AD_APP_ID " + ZXADConfig.Instance.HC_AD_APP_ID);
//风行 //风行
#if UNITY_ANDROID #if UNITY_ANDROID
AndroidJavaClass jc3 = new AndroidJavaClass("com.ym.admodule.fs.FunShionManager"); AndroidJavaClass jc3 = new AndroidJavaClass("com.ym.admodule.fs.FunShionManager");
...@@ -195,17 +194,19 @@ public class AdManager ...@@ -195,17 +194,19 @@ public class AdManager
}), new Action<string, string>((code, errMsg) => }), new Action<string, string>((code, errMsg) =>
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "Splash 请求失败" + errMsg); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "Splash 请求失败" + errMsg);
if (defaultSplashJson != null) //if (defaultSplashJson != null)
{ //{
List<AdEntity> AdConfigList = JsonMapper.ToObject<List<AdEntity>>(defaultSplashJson); // List<AdEntity> AdConfigList = JsonMapper.ToObject<List<AdEntity>>(defaultSplashJson);
LoadSplashConfigAd(listener, AdConfigList); // LoadSplashConfigAd(listener, AdConfigList);
} //}
else //else
{ //{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "Splash 没有默认配置"); // Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "Splash 没有默认配置");
listener.onError("code" + code + "没有默认配置 errMsg" + errMsg); // listener.onError("code" + code + "没有默认配置 errMsg" + errMsg);
// listener.onLastError();
//}
listener.onError(code + "errormsg" + errMsg);
listener.onLastError(); listener.onLastError();
}
})); }));
} }
...@@ -245,6 +246,14 @@ public class AdManager ...@@ -245,6 +246,14 @@ public class AdManager
listener.onLastError(); listener.onLastError();
return; return;
} }
//adList.Reverse();
//// 首次启动时倒序加载
//if (PlayerPrefs.GetInt("isFirstLoadSplashAd") != 1)
//{
// adList.Reverse();
// PlayerPrefs.SetInt("isFirstLoadSplashAd", 1);
//}
List<AdEntity> totalEntityList = adList; List<AdEntity> totalEntityList = adList;
AdEntity entity = totalEntityList[0]; AdEntity entity = totalEntityList[0];
...@@ -296,7 +305,7 @@ public class AdManager ...@@ -296,7 +305,7 @@ public class AdManager
CSJSplshADUtils.Instance.LoadSplshAd(entity, GetActivity(), GetSplashAdManager(), listener, callback); CSJSplshADUtils.Instance.LoadSplshAd(entity, GetActivity(), GetSplashAdManager(), listener, callback);
#elif UNITY_IOS #elif UNITY_IOS
//加载穿山甲开屏广告 //加载穿山甲开屏广告
CSJSplshADUtils.Instance.LoadSplshAd(entity,null, null, listener, callback); CSJSplshADUtils.Instance.LoadSplshAd(entity, null, null, listener, callback);
#endif #endif
break; break;
...@@ -584,7 +593,7 @@ public class AdManager ...@@ -584,7 +593,7 @@ public class AdManager
if (bl) if (bl)
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "大图缓存成功 " + entity.adPlatform + " CodeID " + entity.codeId); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "大图缓存成功 " + entity.adPlatform + " CodeID " + entity.codeId);
//保存插屏缓存数据 //保存大图缓存数据
ZXADConfig.Instance.SetAdCache(sloatName, entity, ""); ZXADConfig.Instance.SetAdCache(sloatName, entity, "");
} }
else else
...@@ -655,7 +664,9 @@ public class AdManager ...@@ -655,7 +664,9 @@ public class AdManager
} }
else else
{ {
#if UNITY_ANDROID
LoadCacheFeedAd(slotName); LoadCacheFeedAd(slotName);
#endif
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "展示大图失败 缓存的信息为null"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "展示大图失败 缓存的信息为null");
} }
} }
...@@ -838,7 +849,7 @@ public class AdManager ...@@ -838,7 +849,7 @@ public class AdManager
{ {
entity.actionName = actionName; entity.actionName = actionName;
ZXADConfig.Instance.RemoveAdCache(slotName, ""); ZXADConfig.Instance.RemoveAdCache(slotName, "");
mPlayCacheInterstitialAdPlatform(entity,listener, new Action<bool>((bl) => mPlayCacheInterstitialAdPlatform(entity, listener, new Action<bool>((bl) =>
{ {
if (bl) if (bl)
{ {
...@@ -873,7 +884,7 @@ public class AdManager ...@@ -873,7 +884,7 @@ public class AdManager
#if UNITY_ANDROID #if UNITY_ANDROID
case ZXADConfig.PLANTFORM_AD_KUS: case ZXADConfig.PLANTFORM_AD_KUS:
//快手插屏广告加载 //快手插屏广告加载
KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, callback,listener); KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, callback, listener);
break; break;
#endif #endif
default: default:
...@@ -1277,6 +1288,15 @@ public class AdManager ...@@ -1277,6 +1288,15 @@ public class AdManager
if (adList == null || adList.Count == 0) if (adList == null || adList.Count == 0)
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频A组没有数据"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频A组没有数据");
ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{
ADLoading.Instance().HideADLoading();
ADLoading.Instance().loadFailCount = 0;
}
return; return;
} }
if (IsFirstLoadRewardAd) if (IsFirstLoadRewardAd)
...@@ -1321,6 +1341,7 @@ public class AdManager ...@@ -1321,6 +1341,7 @@ public class AdManager
if (ADLoading.Instance().loadFailCount == 2) if (ADLoading.Instance().loadFailCount == 2)
{ {
ADLoading.Instance().HideADLoading(); ADLoading.Instance().HideADLoading();
ADLoading.Instance().loadFailCount = 0;
} }
} }
...@@ -1341,6 +1362,15 @@ public class AdManager ...@@ -1341,6 +1362,15 @@ public class AdManager
if (adList == null || adList.Count == 0) if (adList == null || adList.Count == 0)
{ {
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频B组没有数据"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频B组没有数据");
ADLoading.Instance().loadFailCount++;
if (ADLoading.Instance().loadFailCount == 2)
{
ADLoading.Instance().HideADLoading();
ADLoading.Instance().loadFailCount = 0;
}
return; return;
} }
List<AdEntity> totalEntityList = adList; List<AdEntity> totalEntityList = adList;
...@@ -1378,6 +1408,7 @@ public class AdManager ...@@ -1378,6 +1408,7 @@ public class AdManager
if (ADLoading.Instance().loadFailCount == 2) if (ADLoading.Instance().loadFailCount == 2)
{ {
ADLoading.Instance().HideADLoading(); ADLoading.Instance().HideADLoading();
ADLoading.Instance().loadFailCount = 0;
} }
} }
......
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