Commit 881cbf7e authored by 王雪伟's avatar 王雪伟

Unity广告SDK 1.0.0

parent 0677490a
This diff is collapsed.
...@@ -95,5 +95,13 @@ public class ZXADConfig ...@@ -95,5 +95,13 @@ public class ZXADConfig
return null; return null;
} }
public void RemoveAdCache(string slotName, string type)
{
if (AdCacheMap.ContainsKey(type + slotName))
{
AdCacheMap.Remove(type + slotName);
}
}
} }
...@@ -80,4 +80,8 @@ public class AdEntity ...@@ -80,4 +80,8 @@ public class AdEntity
/// ///
/// </summary> /// </summary>
public List<string> playcomplete_trackings { get; set; } public List<string> playcomplete_trackings { get; set; }
/// <summary>
///
/// </summary>
public AdEntity bgroup { get; set; }
} }
...@@ -6,5 +6,5 @@ public class AdIdConfig ...@@ -6,5 +6,5 @@ public class AdIdConfig
{ {
public string adPlatform; public string adPlatform;
public string codeAppId; public string codeAppId;
public string codeAppKey; //public string codeAppKey;
} }
...@@ -58,23 +58,24 @@ public class CSJBannerUtil ...@@ -58,23 +58,24 @@ public class CSJBannerUtil
{ {
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId("900546269") .SetCodeId(entity.codeId)
#else #else
.SetCodeId("901121246") .SetCodeId(entity.codeId)
////期望模板广告view的size,单位dp,//高度按照实际rit对应宽高传入 ////期望模板广告view的size,单位dp,//高度按照实际rit对应宽高传入
#endif #endif
.SetExpressViewAcceptedSize(Screen.width, float.Parse(Screen.width.ToString()) / 600 * 90) //.SetExpressViewAcceptedSize(Screen.width, float.Parse(Screen.width.ToString()) / 600 * 90)
.SetExpressViewAcceptedSize(Screen.width, float.Parse(Screen.width.ToString()) /4)
.SetSupportDeepLink(true) .SetSupportDeepLink(true)
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
.SetAdCount(1) .SetAdCount(1)
.SetOrientation(AdOrientation.Horizontal) .SetOrientation(AdOrientation.Horizontal)
.Build(); .Build();
Debug.LogError("SetExpressViewAcceptedSize:" + float.Parse(Screen.width.ToString()) / 600 * 90); //Debug.LogError("SetExpressViewAcceptedSize:" + float.Parse(Screen.width.ToString()) / 600 * 90);
this.AdNative.LoadExpressBannerAd(adSlot, new BannerAdListener(callback)); this.AdNative.LoadExpressBannerAd(adSlot, new BannerAdListener(callback));
} }
public void ShowCacheBannerAd() public void ShowCacheBannerAd(AdEntity entity,Action<bool> callback)
{ {
#if UNITY_IOS #if UNITY_IOS
if (bannerAdCacheListIOS.Count > 0) if (bannerAdCacheListIOS.Count > 0)
...@@ -86,7 +87,7 @@ public class CSJBannerUtil ...@@ -86,7 +87,7 @@ public class CSJBannerUtil
//{ //{
// y = 100; // 防止Demo里刘海遮挡 // y = 100; // 防止Demo里刘海遮挡
//} //}
mBanneAd.SetExpressInteractionListener(new ExpressAdInteractionListener(this, entity, callback, 1));
mBanneAd.ShowExpressAd(x, y); mBanneAd.ShowExpressAd(x, y);
} }
else else
...@@ -100,12 +101,14 @@ public class CSJBannerUtil ...@@ -100,12 +101,14 @@ public class CSJBannerUtil
//设置轮播间隔 30s--120s;不设置则不开启轮播 //设置轮播间隔 30s--120s;不设置则不开启轮播
mBanneAd.SetSlideIntervalTime(30 * 1000); mBanneAd.SetSlideIntervalTime(30 * 1000);
ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 1); ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this,entity,callback,1);
ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this, 1); ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this, 1);
NativeAdManager.Instance().ShowExpressBannerAd(GetActivity(), mBanneAd.handle, expressAdInteractionListener, dislikeCallback); NativeAdManager.Instance().ShowExpressBannerAd(GetActivity(), mBanneAd.handle, expressAdInteractionListener, dislikeCallback);
} }
else else
{ {
callback(false);
Debug.Log("CSJ Banner广告没有缓存数据了"); Debug.Log("CSJ Banner广告没有缓存数据了");
} }
...@@ -159,11 +162,15 @@ public class CSJBannerUtil ...@@ -159,11 +162,15 @@ public class CSJBannerUtil
private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener
{ {
private CSJBannerUtil example; private CSJBannerUtil example;
private AdEntity entity;
private Action<bool> callback;
int type;//0:feed 1:banner 2:interstitial int type;//0:feed 1:banner 2:interstitial
public ExpressAdInteractionListener(CSJBannerUtil example, int type) public ExpressAdInteractionListener(CSJBannerUtil example, AdEntity entity,Action<bool> callback, int type)
{ {
this.example = example; this.example = example;
this.entity = entity;
this.callback = callback;
this.type = type; this.type = type;
} }
public void OnAdClicked(ExpressAd ad) public void OnAdClicked(ExpressAd ad)
...@@ -173,11 +180,13 @@ public class CSJBannerUtil ...@@ -173,11 +180,13 @@ public class CSJBannerUtil
public void OnAdShow(ExpressAd ad) public void OnAdShow(ExpressAd ad)
{ {
callback(true);
Debug.Log("express OnAdShow,type:" + type); Debug.Log("express OnAdShow,type:" + type);
} }
public void OnAdViewRenderError(ExpressAd ad, int code, string message) public void OnAdViewRenderError(ExpressAd ad, int code, string message)
{ {
callback(false);
Debug.Log("express OnAdViewRenderError,type:" + type); Debug.Log("express OnAdViewRenderError,type:" + type);
} }
......
...@@ -53,9 +53,9 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -53,9 +53,9 @@ public class CSJFeedUtil : MonoBehaviour
{ {
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId("900546131") .SetCodeId(entity.codeId)
#else #else
.SetCodeId("901121253") .SetCodeId(entity.codeId)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
.SetExpressViewAcceptedSize(350, 0) .SetExpressViewAcceptedSize(350, 0)
#endif #endif
...@@ -73,7 +73,7 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -73,7 +73,7 @@ public class CSJFeedUtil : MonoBehaviour
/// 展示缓存的FeedAd /// 展示缓存的FeedAd
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
public void ShowCacheFeedAd(AdEntity entity) public void ShowCacheFeedAd(AdEntity entity,Action<bool> callback)
{ {
if (feedAdCacheList.Count > 0) if (feedAdCacheList.Count > 0)
{ {
...@@ -85,15 +85,17 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -85,15 +85,17 @@ public class CSJFeedUtil : MonoBehaviour
//{ //{
// y = 100; // 防止Demo里刘海遮挡 // y = 100; // 防止Demo里刘海遮挡
//} //}
feedAd.SetExpressInteractionListener(new ExpressAdInteractionListener(this, entity, callback, 0));
feedAd.ShowExpressAd(x, y); feedAd.ShowExpressAd(x, y);
#else #else
ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 0); ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this,entity,callback, 0);
ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this, 0); ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this, 0);
NativeAdManager.Instance().ShowExpressFeedAd(GetActivity(), feedAd.handle, expressAdInteractionListener, dislikeCallback); NativeAdManager.Instance().ShowExpressFeedAd(GetActivity(), feedAd.handle, expressAdInteractionListener, dislikeCallback);
#endif #endif
} }
else else
{ {
callback(false);
Debug.Log("CSJ Feed广告没有缓存数据了"); Debug.Log("CSJ Feed广告没有缓存数据了");
} }
} }
...@@ -143,11 +145,15 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -143,11 +145,15 @@ public class CSJFeedUtil : MonoBehaviour
private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener
{ {
private CSJFeedUtil example; private CSJFeedUtil example;
private AdEntity entity;
private Action<bool> callback;
int type;//0:feed 1:banner 2:interstitial int type;//0:feed 1:banner 2:interstitial
public ExpressAdInteractionListener(CSJFeedUtil example, int type) public ExpressAdInteractionListener(CSJFeedUtil example, AdEntity entity, Action<bool> callback, int type)
{ {
this.example = example; this.example = example;
this.entity = entity;
this.callback = callback;
this.type = type; this.type = type;
} }
public void OnAdClicked(ExpressAd ad) public void OnAdClicked(ExpressAd ad)
...@@ -157,11 +163,13 @@ public class CSJFeedUtil : MonoBehaviour ...@@ -157,11 +163,13 @@ public class CSJFeedUtil : MonoBehaviour
public void OnAdShow(ExpressAd ad) public void OnAdShow(ExpressAd ad)
{ {
callback(true);
Debug.Log("express OnAdShow,type:" + type); Debug.Log("express OnAdShow,type:" + type);
} }
public void OnAdViewRenderError(ExpressAd ad, int code, string message) public void OnAdViewRenderError(ExpressAd ad, int code, string message)
{ {
callback(false);
Debug.Log("express OnAdViewRenderError,type:" + type); Debug.Log("express OnAdViewRenderError,type:" + type);
} }
......
...@@ -61,10 +61,10 @@ public class CSJInterstitialUtil ...@@ -61,10 +61,10 @@ public class CSJInterstitialUtil
{ {
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId("900546270") .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(200, 300) .SetExpressViewAcceptedSize(200, 300)
#else #else
.SetCodeId("901121133") .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(350, 0) .SetExpressViewAcceptedSize(350, 0)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
#endif #endif
...@@ -75,7 +75,7 @@ public class CSJInterstitialUtil ...@@ -75,7 +75,7 @@ public class CSJInterstitialUtil
this.AdNative.LoadExpressInterstitialAd(adSlot, new InterstitialAdListener(callback)); this.AdNative.LoadExpressInterstitialAd(adSlot, new InterstitialAdListener(callback));
} }
public void PlayCacheInterstitialAd(AdEntity entity) public void PlayCacheInterstitialAd(AdEntity entity,Action<bool> callback)
{ {
#if UNITY_IOS #if UNITY_IOS
if (interstitialAdCacheListIOS.Count > 0) if (interstitialAdCacheListIOS.Count > 0)
...@@ -87,10 +87,12 @@ public class CSJInterstitialUtil ...@@ -87,10 +87,12 @@ public class CSJInterstitialUtil
//{ //{
// y = 100; // 防止Demo里刘海遮挡 // y = 100; // 防止Demo里刘海遮挡
//} //}
mInterstitialAd.SetExpressInteractionListener(new ExpressAdInteractionListener(this, callback, entity, 1));
mInterstitialAd.ShowExpressAd(x, y); mInterstitialAd.ShowExpressAd(x, y);
} }
else else
{ {
callback(false);
Debug.Log("CSJ 插屏广告没有缓存数据了"); Debug.Log("CSJ 插屏广告没有缓存数据了");
} }
...@@ -98,11 +100,12 @@ public class CSJInterstitialUtil ...@@ -98,11 +100,12 @@ public class CSJInterstitialUtil
if (interstitialAdCacheListAndroid.Count > 0) if (interstitialAdCacheListAndroid.Count > 0)
{ {
mInterstitialAd = interstitialAdCacheListAndroid.Dequeue(); mInterstitialAd = interstitialAdCacheListAndroid.Dequeue();
ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 1); ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, callback,entity, 1);
NativeAdManager.Instance().ShowExpressInterstitialAd(GetActivity(), mInterstitialAd.handle, expressAdInteractionListener); NativeAdManager.Instance().ShowExpressInterstitialAd(GetActivity(), mInterstitialAd.handle, expressAdInteractionListener);
} }
else else
{ {
callback(false);
Debug.Log("CSJ 插屏广告没有缓存数据了"); Debug.Log("CSJ 插屏广告没有缓存数据了");
} }
#endif #endif
...@@ -155,11 +158,15 @@ public class CSJInterstitialUtil ...@@ -155,11 +158,15 @@ public class CSJInterstitialUtil
private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener
{ {
private CSJInterstitialUtil example; private CSJInterstitialUtil example;
private Action<bool> callback;
private AdEntity entity;
int type;//0:feed 1:banner 2:interstitial int type;//0:feed 1:banner 2:interstitial
public ExpressAdInteractionListener(CSJInterstitialUtil example, int type) public ExpressAdInteractionListener(CSJInterstitialUtil example,Action<bool> callback,AdEntity entity, int type)
{ {
this.example = example; this.example = example;
this.callback = callback;
this.entity = entity;
this.type = type; this.type = type;
} }
public void OnAdClicked(ExpressAd ad) public void OnAdClicked(ExpressAd ad)
......
...@@ -48,17 +48,10 @@ public class CSJRewardUtil ...@@ -48,17 +48,10 @@ public class CSJRewardUtil
public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback) public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback)
{ {
//if (this.rewardAd != null)
//{
// Debug.Log("广告已经加载");
// return;
//}
//string iosSlotID = "945113162"; //string iosSlotID = "945113162";
string iosSlotID = entity.codeId; string iosSlotID = entity.codeId;
//string AndroidSlotID = "901121593"; //string AndroidSlotID = "901121593";
string AndroidSlotID = entity.codeId; string AndroidSlotID = entity.codeId;
var adSlot = new AdSlot.Builder() var adSlot = new AdSlot.Builder()
#if UNITY_IOS #if UNITY_IOS
.SetCodeId(iosSlotID) .SetCodeId(iosSlotID)
...@@ -69,20 +62,18 @@ public class CSJRewardUtil ...@@ -69,20 +62,18 @@ public class CSJRewardUtil
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
.SetRewardName("金币") // 奖励的名称 .SetRewardName("金币") // 奖励的名称
.SetRewardAmount(3) // 奖励的数量 .SetRewardAmount(3) // 奖励的数量
.SetUserID("") // 用户id,必传参数 .SetUserID("user123") // 用户id,必传参数
.SetMediaExtra("media_extra") // 附加参数,可选 .SetMediaExtra("media_extra") // 附加参数,可选
.SetOrientation(AdOrientation.Vertical) // 必填参数,期望视频的播放方向 .SetOrientation(AdOrientation.Horizontal) // 必填参数,期望视频的播放方向
.Build(); .Build();
#if UNITY_IOS #if UNITY_IOS
this.AdNative.LoadExpressRewardAd( this.AdNative.LoadExpressRewardAd(
adSlot, new RewardVideoAdListener(this,entity, callback)); adSlot, new RewardVideoAdListener(this,entity, callback));
#else #else
this.AdNative.LoadExpressRewardAd( this.AdNative.LoadRewardVideoAd(
adSlot, new RewardVideoAdListener(this, entity, callback)); adSlot, new RewardVideoAdListener(this, entity, callback));
#endif #endif
} }
/// <summary> /// <summary>
...@@ -97,7 +88,7 @@ public class CSJRewardUtil ...@@ -97,7 +88,7 @@ public class CSJRewardUtil
#if UNITY_ANDROID #if UNITY_ANDROID
RewardVideoAd rewardAd = GetRewardVideoAdForAndroid(entity.codeGroup+entity.codeId); RewardVideoAd rewardAd = GetRewardVideoAdForAndroid(entity.codeGroup+entity.codeId);
#elif UNITY_IOS #elif UNITY_IOS
ExpressRewardVideoAd rewardAd = GetRewardVideoAdForIOS(""); ExpressRewardVideoAd rewardAd = GetRewardVideoAdForIOS(entity.codeGroup+entity.codeId);
#endif #endif
if (rewardAd != null) if (rewardAd != null)
{ {
...@@ -107,7 +98,7 @@ public class CSJRewardUtil ...@@ -107,7 +98,7 @@ public class CSJRewardUtil
else else
{ {
callback(false); callback(false);
Debug.Log("CSJ 激励视频 缓存不存在"); Debug.unityLogger.Log(ZXADConfig.ADManagerTAG,"CSJ 激励视频 缓存不存在");
} }
} }
...@@ -129,14 +120,12 @@ public class CSJRewardUtil ...@@ -129,14 +120,12 @@ public class CSJRewardUtil
public void OnError(int code, string message) public void OnError(int code, string message)
{ {
Debug.Log("OnRewardError: " + message);
callback(false); callback(false);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + code + " msg" + message);
} }
public void OnRewardVideoAdLoad(RewardVideoAd ad) public void OnRewardVideoAdLoad(RewardVideoAd ad)
{ {
Debug.Log("OnRewardVideoAdLoad");
//ad.SetRewardAdInteractionListener( //ad.SetRewardAdInteractionListener(
// new RewardAdInteractionListener(this.csjAD)); // new RewardAdInteractionListener(this.csjAD));
//ad.SetDownloadListener( //ad.SetDownloadListener(
...@@ -151,7 +140,6 @@ public class CSJRewardUtil ...@@ -151,7 +140,6 @@ public class CSJRewardUtil
public void OnExpressRewardVideoAdLoad(ExpressRewardVideoAd ad) public void OnExpressRewardVideoAdLoad(ExpressRewardVideoAd ad)
{ {
#if UNITY_IOS #if UNITY_IOS
this.csjAD.SetRewardVideoAdForIOS(entity.codeGroup+entity.codeId, ad); this.csjAD.SetRewardVideoAdForIOS(entity.codeGroup+entity.codeId, ad);
callback(true); callback(true);
...@@ -160,7 +148,6 @@ public class CSJRewardUtil ...@@ -160,7 +148,6 @@ public class CSJRewardUtil
public void OnRewardVideoCached() public void OnRewardVideoCached()
{ {
Debug.Log("OnRewardVideoCached");
//if (this.csjAD.rewardAd != null) //if (this.csjAD.rewardAd != null)
//{ //{
// this.csjAD.rewardAd.IsDownloaded = true; // this.csjAD.rewardAd.IsDownloaded = true;
...@@ -313,7 +300,6 @@ public class CSJRewardUtil ...@@ -313,7 +300,6 @@ public class CSJRewardUtil
/// <returns></returns> /// <returns></returns>
private ExpressRewardVideoAd GetRewardVideoAdForIOS(string codeId) private ExpressRewardVideoAd GetRewardVideoAdForIOS(string codeId)
{ {
codeId = "IOS";
if (mRewardCacheMapIOS.ContainsKey(codeId)) if (mRewardCacheMapIOS.ContainsKey(codeId))
{ {
Queue<ExpressRewardVideoAd> mRewardQueue = mRewardCacheMapIOS[codeId]; Queue<ExpressRewardVideoAd> mRewardQueue = mRewardCacheMapIOS[codeId];
......
...@@ -61,8 +61,10 @@ public class CSJSplshADUtils ...@@ -61,8 +61,10 @@ public class CSJSplshADUtils
/// <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)
{ {
string iosSlotID = "800546808"; //string iosSlotID = "800546808";
string AndroidSlotID = "801121648"; //string AndroidSlotID = "801121648";
string iosSlotID = entity.codeId;
string AndroidSlotID = entity.codeId;
//// 横屏 开屏的横屏配置需要在服务端针对广告位进行设置 //// 横屏 开屏的横屏配置需要在服务端针对广告位进行设置
//if (this.getScreenOrientationConfig() == 1) //if (this.getScreenOrientationConfig() == 1)
//{ //{
......
...@@ -23,22 +23,22 @@ public final class UnionApplication extends Application { ...@@ -23,22 +23,22 @@ public final class UnionApplication extends Application {
AppliContext.init(this); AppliContext.init(this);
TTAdConfig config = new TTAdConfig.Builder() // TTAdConfig config = new TTAdConfig.Builder()
//.appId("5001121") // //.appId("5001121")
.appId("5145269") // .appId("5145269")
.useTextureView(false) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView // .useTextureView(false) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
.appName("APP测试媒体") // .appName("APP测试媒体")
.titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK) // .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
.allowShowNotify(true) //是否允许sdk展示通知栏提示 // .allowShowNotify(true) //是否允许sdk展示通知栏提示
.allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页 // .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
.debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 // .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
.directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合 // .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI, TTAdConstant.NETWORK_STATE_3G) //允许直接下载的网络状态集合
.supportMultiProcess(false) //是否支持多进程,true支持 // .supportMultiProcess(false) //是否支持多进程,true支持
.customController(getController())//控制隐私数据 // .customController(getController())//控制隐私数据
.build(); // .build();
// 强烈建议在应用对应的Application#onCreate()方法中调用,避免出现content为null的异常 // // 强烈建议在应用对应的Application#onCreate()方法中调用,避免出现content为null的异常
TTAdSdk.init(this, config); // TTAdSdk.init(this, config);
//如果明确某个进程不会使用到广告SDK,可以只针对特定进程初始化广告SDK的content //如果明确某个进程不会使用到广告SDK,可以只针对特定进程初始化广告SDK的content
//if (PROCESS_NAME_XXXX.equals(processName)) { //if (PROCESS_NAME_XXXX.equals(processName)) {
...@@ -46,45 +46,45 @@ public final class UnionApplication extends Application { ...@@ -46,45 +46,45 @@ public final class UnionApplication extends Application {
//} //}
} }
private static TTCustomController getController() { // private static TTCustomController getController() {
MyTTCustomController customController = new MyTTCustomController(); // MyTTCustomController customController = new MyTTCustomController();
return customController; // return customController;
} // }
private static class MyTTCustomController extends TTCustomController{ // private static class MyTTCustomController extends TTCustomController{
@Override // @Override
public boolean isCanUseLocation() { // public boolean isCanUseLocation() {
return super.isCanUseLocation(); // return super.isCanUseLocation();
} // }
@Override // @Override
public TTLocation getTTLocation() { // public TTLocation getTTLocation() {
return super.getTTLocation(); // return super.getTTLocation();
} // }
@Override // @Override
public boolean alist() { // public boolean alist() {
return super.alist(); // return super.alist();
} // }
@Override // @Override
public boolean isCanUsePhoneState() { // public boolean isCanUsePhoneState() {
return super.isCanUsePhoneState(); // return super.isCanUsePhoneState();
} // }
@Override // @Override
public String getDevImei() { // public String getDevImei() {
return super.getDevImei(); // return super.getDevImei();
} // }
@Override // @Override
public boolean isCanUseWifiState() { // public boolean isCanUseWifiState() {
return super.isCanUseWifiState(); // return super.isCanUseWifiState();
} // }
@Override // @Override
public boolean isCanUseWriteExternal() { // public boolean isCanUseWriteExternal() {
return super.isCanUseWriteExternal(); // return super.isCanUseWriteExternal();
} // }
} // }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -1508,7 +1508,7 @@ Camera: ...@@ -1508,7 +1508,7 @@ Camera:
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 1 m_ClearFlags: 1
m_BackGroundColor: {r: 0.42986825, g: 0.7849259, b: 0.8679245, a: 0} m_BackGroundColor: {r: 0.17702031, g: 0.8137047, b: 0.9622642, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2 m_GateFitMode: 2
m_FOVAxisMode: 0 m_FOVAxisMode: 0
...@@ -2869,80 +2869,6 @@ CanvasRenderer: ...@@ -2869,80 +2869,6 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2017943968} m_GameObject: {fileID: 2017943968}
m_CullTransparentMesh: 0 m_CullTransparentMesh: 0
--- !u!1001 &2110713141
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2853166085728200632, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_Name
value: HTTP
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200634, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: IS_TGYZ
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2853166085728200635, guid: 1053be02c113a7a45adf322c929b0cb6,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1053be02c113a7a45adf322c929b0cb6, type: 3}
--- !u!1 &2116183217 --- !u!1 &2116183217
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
=======
//AdManager.Instance.LoadCacheFSVideoAd();
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
public void OnClickPlayFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
=======
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
=======
//AdManager.Instance.LoadCacheFSVideoAd();
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
public void OnClickPlayFullScreeVideoAd()
{
<<<<<<< HEAD
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
=======
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
>>>>>>> c9dc7224cab183311983fe752879dab5c389d597
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
AdManager.Instance.LoadCacheFSVideoAd("fullvideo");
}
public void OnClickPlayFullScreeVideoAd()
{
AdManager.Instance.PlayCacheFSVideoAd("fullvideo", "test", new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
//AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AdDemo : MonoBehaviour
{
public Text RewardAdResult;
public void OnClickLoadRewardAd()
{
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void OnClickPlayRewardAd()
{
AdManager.Instance.PlayCacheRewardVideoAd("video", "test", new RewardAdListener(this));
}
public sealed class RewardAdListener : ZXADRewardVideoListener
{
private AdDemo demo;
public RewardAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "Reward onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "Reward onError" + errorMsg;
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "Reward onSuccess";
}
}
public void OnClickInitAd()
{
//AdManager.Instance.LoadSplshAd(new SplshAdListener(this));
AdManager.Instance.InitAd();
}
public void OnClickPlaySplshAd()
{
AdManager.Instance.LoadSplashAd(new SplshAdListener(this));
}
private sealed class SplshAdListener : ZXADSplashListener
{
private AdDemo demo;
public SplshAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "开屏展示";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "开屏跳过";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "开屏错误" + errorMsg;
}
}
public void OnClickLoadBannerAd()
{
AdManager.Instance.LoadCacheBannerAd();
}
public void OnClickShowBannerAd()
{
AdManager.Instance.ShowCacheBannerAd();
}
public void OnClickLoadFeed()
{
AdManager.Instance.LoadCacheFeedAd();
}
public void OnClickShowFeed()
{
AdManager.Instance.ShowCacheFeedAd();
}
public void OnClickLoadInterAd()
{
AdManager.Instance.LoadCacheInterstitialAd();
}
public void OnClickPlayInterAd()
{
AdManager.Instance.PlayCacheInterstitialAd();
}
public void OnClickLoadFullScreeVideoAd()
{
//AdManager.Instance.LoadCacheFSVideoAd();
}
public void OnClickPlayFullScreeVideoAd()
{
//AdManager.Instance.PlayCacheFSVideoAd(new FullScreenAdListener(this));
}
private sealed class FullScreenAdListener : ZXADFullScreenVideoListener
{
private AdDemo demo;
public FullScreenAdListener(AdDemo demo)
{
this.demo = demo;
}
public void onAdClose()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdClose";
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdShow";
}
public void onAdSkip()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdSkip";
}
public void onAdVideoBarClick()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onAdVideoBarClick";
}
public void onError(string errorMsg)
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onError";
}
public void onSuccess()
{
this.demo.RewardAdResult.text = "FullScreenVideoAD onSuccess";
}
}
}
...@@ -28,8 +28,8 @@ public class GDTBannerAdUtil ...@@ -28,8 +28,8 @@ public class GDTBannerAdUtil
/// </summary> /// </summary>
public void LoadCacheBannerAd(AdEntity entity, Action<bool> callback) public void LoadCacheBannerAd(AdEntity entity, Action<bool> callback)
{ {
UnifiedBannerAd ad = new UnifiedBannerAd(Constants.bannerPosId, new AdSize(375, 60)); UnifiedBannerAd ad = new UnifiedBannerAd(entity.codeId, new AdSize(375, 60));
ad.SetListener(new BannerListener(ad, callback)); ad.SetListener(new BannerListener(ad, entity, callback));
ad.LoadAndShowAd(); ad.LoadAndShowAd();
} }
...@@ -38,7 +38,7 @@ public class GDTBannerAdUtil ...@@ -38,7 +38,7 @@ public class GDTBannerAdUtil
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
private UnifiedBannerAd gdtBannerAd; private UnifiedBannerAd gdtBannerAd;
public void ShowCacheBannerAd(AdEntity entity) public void ShowCacheBannerAd(AdEntity entity,Action<bool> callback)
{ {
if (bannerCacheList.Count > 0) if (bannerCacheList.Count > 0)
{ {
...@@ -47,6 +47,7 @@ public class GDTBannerAdUtil ...@@ -47,6 +47,7 @@ public class GDTBannerAdUtil
gdtBannerAd.CloseAd(); gdtBannerAd.CloseAd();
} }
gdtBannerAd = bannerCacheList.Dequeue(); gdtBannerAd = bannerCacheList.Dequeue();
gdtBannerAd.SetListener(new BannerListener(gdtBannerAd,entity,callback));
#if UNITY_ANDROID #if UNITY_ANDROID
AndroidDemoUtils.ShowView(gdtBannerAd.GetAndroidNativeView(), true); AndroidDemoUtils.ShowView(gdtBannerAd.GetAndroidNativeView(), true);
#elif UNITY_IOS #elif UNITY_IOS
...@@ -55,6 +56,7 @@ public class GDTBannerAdUtil ...@@ -55,6 +56,7 @@ public class GDTBannerAdUtil
} }
else else
{ {
callback(false);
Debug.Log("GDT Banner广告没有缓存数据了"); Debug.Log("GDT Banner广告没有缓存数据了");
} }
} }
...@@ -63,10 +65,12 @@ public class GDTBannerAdUtil ...@@ -63,10 +65,12 @@ public class GDTBannerAdUtil
/// </summary> /// </summary>
private sealed class BannerListener : IUnifiedBannerAdListener private sealed class BannerListener : IUnifiedBannerAdListener
{ {
private AdEntity entity;
private Action<bool> callback; private Action<bool> callback;
private UnifiedBannerAd bannerAD; private UnifiedBannerAd bannerAD;
public BannerListener(UnifiedBannerAd bannerAD, Action<bool> callback) public BannerListener(UnifiedBannerAd bannerAD, AdEntity entity,Action<bool> callback)
{ {
this.entity = entity;
this.bannerAD = bannerAD; this.bannerAD = bannerAD;
this.callback = callback; this.callback = callback;
} }
...@@ -97,6 +101,7 @@ public class GDTBannerAdUtil ...@@ -97,6 +101,7 @@ public class GDTBannerAdUtil
/// </summary> /// </summary>
public void OnAdExposured() public void OnAdExposured()
{ {
callback(true);
string msg = "OnAdExposured"; string msg = "OnAdExposured";
Debug.unityLogger.Log(Constants.tagForLog, msg); Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
......
...@@ -37,10 +37,10 @@ public class GDTFeedAdUtil ...@@ -37,10 +37,10 @@ public class GDTFeedAdUtil
public void LoadCacheFeedAd(AdEntity entity, Action<bool> callback) public void LoadCacheFeedAd(AdEntity entity, Action<bool> callback)
{ {
//string PosId = Constants.nativeExpressPosId;//不带视频的大图广告 //string PosId = Constants.nativeExpressPosId;//不带视频的大图广告
string PosId = Constants.nativeExpressVideoPosId;//带视频的大图广告 //string PosId = Constants.nativeExpressVideoPosId;//带视频的大图广告
NativeExpressAd ad = new NativeExpressAd(PosId, GetAdSize()); NativeExpressAd ad = new NativeExpressAd(entity.codeId, GetAdSize());
ad.SetListener(new FeedAdListener(callback)); ad.SetListener(new FeedAdListener(entity,callback));
ad.LoadAd(1); ad.LoadAd(1);
} }
...@@ -48,7 +48,7 @@ public class GDTFeedAdUtil ...@@ -48,7 +48,7 @@ public class GDTFeedAdUtil
/// 展示缓存的FeedAd /// 展示缓存的FeedAd
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
public void ShowCacheFeedAd(AdEntity entity) public void ShowCacheFeedAd(AdEntity entity,Action<bool> callback)
{ {
if (feedAd != null) if (feedAd != null)
{ {
...@@ -57,7 +57,6 @@ public class GDTFeedAdUtil ...@@ -57,7 +57,6 @@ public class GDTFeedAdUtil
if (feedAdCacheList.Count > 0) if (feedAdCacheList.Count > 0)
{ {
feedAd = feedAdCacheList.Dequeue(); feedAd = feedAdCacheList.Dequeue();
#if UNITY_IOS #if UNITY_IOS
// iOS 广告加载完毕即可展示 // iOS 广告加载完毕即可展示
feedAd.Render(); feedAd.Render();
...@@ -82,6 +81,7 @@ public class GDTFeedAdUtil ...@@ -82,6 +81,7 @@ public class GDTFeedAdUtil
} }
else else
{ {
callback(false);
Debug.Log("GDT Feed广告没有缓存数据了"); Debug.Log("GDT Feed广告没有缓存数据了");
} }
...@@ -101,9 +101,11 @@ public class GDTFeedAdUtil ...@@ -101,9 +101,11 @@ public class GDTFeedAdUtil
private sealed class FeedAdListener: INativeExpressAdListener private sealed class FeedAdListener: INativeExpressAdListener
{ {
private AdEntity entity;
private Action<bool> callback; private Action<bool> callback;
public FeedAdListener(Action<bool> callback) public FeedAdListener(AdEntity entity,Action<bool> callback)
{ {
this.entity = entity;
this.callback = callback; this.callback = callback;
} }
...@@ -150,6 +152,7 @@ public class GDTFeedAdUtil ...@@ -150,6 +152,7 @@ public class GDTFeedAdUtil
/// </summary> /// </summary>
public void OnAdViewRenderSuccess(NativeExpressAdView adView) public void OnAdViewRenderSuccess(NativeExpressAdView adView)
{ {
callback(true);
string msg = "OnAdViewRenderSuccess"; string msg = "OnAdViewRenderSuccess";
Debug.unityLogger.Log(Constants.tagForLog, msg); Debug.unityLogger.Log(Constants.tagForLog, msg);
//Debug.unityLogger.Log(Constants.tagForLog, "nativeexpressad ecpmlevel=" + example.view.GetECPMLevel()); //Debug.unityLogger.Log(Constants.tagForLog, "nativeexpressad ecpmlevel=" + example.view.GetECPMLevel());
...@@ -160,6 +163,7 @@ public class GDTFeedAdUtil ...@@ -160,6 +163,7 @@ public class GDTFeedAdUtil
/// </summary> /// </summary>
public void OnAdViewRenderFailed(NativeExpressAdView adView) public void OnAdViewRenderFailed(NativeExpressAdView adView)
{ {
callback(false);
string msg = "OnAdViewRenderFailed"; string msg = "OnAdViewRenderFailed";
Debug.unityLogger.Log(Constants.tagForLog, msg); Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
...@@ -169,6 +173,7 @@ public class GDTFeedAdUtil ...@@ -169,6 +173,7 @@ public class GDTFeedAdUtil
/// </summary> /// </summary>
public void OnAdExposured(NativeExpressAdView adView) public void OnAdExposured(NativeExpressAdView adView)
{ {
callback(true);
string msg = "OnAdExposured"; string msg = "OnAdExposured";
Debug.unityLogger.Log(Constants.tagForLog, msg); Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
...@@ -299,6 +304,7 @@ public class GDTFeedAdUtil ...@@ -299,6 +304,7 @@ public class GDTFeedAdUtil
/// </summary> /// </summary>
public void OnVideoError(NativeExpressAdView adView, AdError error) public void OnVideoError(NativeExpressAdView adView, AdError error)
{ {
callback(false);
string msg = "OnVideoError" + error.GetErrorMsg(); string msg = "OnVideoError" + error.GetErrorMsg();
Debug.unityLogger.Log(Constants.tagForLog, msg); Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
......
...@@ -96,8 +96,6 @@ public class GDTFullScreenAdUtil ...@@ -96,8 +96,6 @@ public class GDTFullScreenAdUtil
callback(true); callback(true);
example.SetFSVideoAd(entity.codeGroup+entity.codeId, ad); example.SetFSVideoAd(entity.codeGroup+entity.codeId, ad);
} }
string msg = "OnAdLoaded";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -114,8 +112,7 @@ public class GDTFullScreenAdUtil ...@@ -114,8 +112,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnAdShown() public void OnAdShown()
{ {
string msg = "OnAdShown";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -127,8 +124,6 @@ public class GDTFullScreenAdUtil ...@@ -127,8 +124,6 @@ public class GDTFullScreenAdUtil
{ {
listener.onAdShow(); listener.onAdShow();
} }
string msg = "OnAdExposured";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -140,8 +135,6 @@ public class GDTFullScreenAdUtil ...@@ -140,8 +135,6 @@ public class GDTFullScreenAdUtil
{ {
listener.onAdVideoBarClick(); listener.onAdVideoBarClick();
} }
string msg = "OnAdClicked";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -149,8 +142,7 @@ public class GDTFullScreenAdUtil ...@@ -149,8 +142,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnAdLeaveApp() public void OnAdLeaveApp()
{ {
string msg = "OnAdLeaveApp";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -166,8 +158,6 @@ public class GDTFullScreenAdUtil ...@@ -166,8 +158,6 @@ public class GDTFullScreenAdUtil
} }
listener.onAdClose(); listener.onAdClose();
} }
string msg = "OnAdClosed";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
#if UNITY_ANDROID #if UNITY_ANDROID
...@@ -177,8 +167,7 @@ public class GDTFullScreenAdUtil ...@@ -177,8 +167,7 @@ public class GDTFullScreenAdUtil
public void OnVideoCached() public void OnVideoCached()
{ {
// 视频素材加载完成,在此时调用展示,视频广告不会有进度条。 // 视频素材加载完成,在此时调用展示,视频广告不会有进度条。
string msg = "OnVideoCached";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
#endif #endif
...@@ -187,8 +176,7 @@ public class GDTFullScreenAdUtil ...@@ -187,8 +176,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnVideoInit() public void OnVideoInit()
{ {
string msg = "OnVideoInit";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -196,8 +184,7 @@ public class GDTFullScreenAdUtil ...@@ -196,8 +184,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnVideoLoading() public void OnVideoLoading()
{ {
string msg = "OnVideoLoading";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -209,8 +196,6 @@ public class GDTFullScreenAdUtil ...@@ -209,8 +196,6 @@ public class GDTFullScreenAdUtil
{ {
listener.onSuccess(); listener.onSuccess();
} }
string msg = "OnVideoStarted";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -218,8 +203,6 @@ public class GDTFullScreenAdUtil ...@@ -218,8 +203,6 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnVideoPaused() public void OnVideoPaused()
{ {
string msg = "OnVideoPaused";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -229,8 +212,6 @@ public class GDTFullScreenAdUtil ...@@ -229,8 +212,6 @@ public class GDTFullScreenAdUtil
{ {
isSkipAd = false; isSkipAd = false;
string msg = "OnVideoCompleted";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -243,8 +224,6 @@ public class GDTFullScreenAdUtil ...@@ -243,8 +224,6 @@ public class GDTFullScreenAdUtil
listener.onError("GDT 全屏视频播放失败"); listener.onError("GDT 全屏视频播放失败");
} }
callback(false); callback(false);
string msg = "OnVideoError";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -252,8 +231,7 @@ public class GDTFullScreenAdUtil ...@@ -252,8 +231,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnVideoDetailPageShown() public void OnVideoDetailPageShown()
{ {
string msg = "OnVideoDetailPageShown";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -261,8 +239,7 @@ public class GDTFullScreenAdUtil ...@@ -261,8 +239,7 @@ public class GDTFullScreenAdUtil
/// </summary> /// </summary>
public void OnVideoDetailPageClosed() public void OnVideoDetailPageClosed()
{ {
string msg = "OnVideoDetailPageClosed";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
} }
......
...@@ -35,10 +35,10 @@ public class GDTInterstitialAdUtil ...@@ -35,10 +35,10 @@ public class GDTInterstitialAdUtil
public void LoadCacheInterstitialAd(AdEntity entity, Action<bool> callback) public void LoadCacheInterstitialAd(AdEntity entity, Action<bool> callback)
{ {
string posId = Constants.intersititialVideoPosId;//带视频插屏测试广告 //string posId = Constants.intersititialVideoPosId;//带视频插屏测试广告
//string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id //string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id
UnifiedInterstitialAd ad = new UnifiedInterstitialAd(posId); UnifiedInterstitialAd ad = new UnifiedInterstitialAd(entity.codeId);
ad.SetListener(new UnifiedInterstitialAdListener(ad,callback)); ad.SetListener(new UnifiedInterstitialAdListener(ad,callback));
ad.LoadAd(); ad.LoadAd();
} }
...@@ -47,15 +47,17 @@ public class GDTInterstitialAdUtil ...@@ -47,15 +47,17 @@ public class GDTInterstitialAdUtil
/// 播放缓存的插屏广告 /// 播放缓存的插屏广告
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
public void PlayCacheInterstitialAd(AdEntity entity) public void PlayCacheInterstitialAd(AdEntity entity,Action<bool> callback)
{ {
if (interstitialAdCacheList.Count > 0) if (interstitialAdCacheList.Count > 0)
{ {
UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue(); UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue();
interAd.SetListener(new UnifiedInterstitialAdListener(interAd, callback));
interAd.Show(); interAd.Show();
} }
else else
{ {
callback(false);
Debug.Log("GDT 插屏广告没有缓存数据了"); Debug.Log("GDT 插屏广告没有缓存数据了");
} }
} }
...@@ -82,8 +84,6 @@ public class GDTInterstitialAdUtil ...@@ -82,8 +84,6 @@ public class GDTInterstitialAdUtil
{ {
interstitialAdCacheList.Enqueue(ad); interstitialAdCacheList.Enqueue(ad);
callback(true); callback(true);
string msg = "OnAdLoaded";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -92,8 +92,6 @@ public class GDTInterstitialAdUtil ...@@ -92,8 +92,6 @@ public class GDTInterstitialAdUtil
public void OnError(AdError error) public void OnError(AdError error)
{ {
callback(false); callback(false);
string msg = "OnError" + error.GetErrorMsg();
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -101,8 +99,7 @@ public class GDTInterstitialAdUtil ...@@ -101,8 +99,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdShown() public void OnAdShown()
{ {
string msg = "OnAdShown";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -110,8 +107,7 @@ public class GDTInterstitialAdUtil ...@@ -110,8 +107,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdExposured() public void OnAdExposured()
{ {
string msg = "OnAdExposured"; callback(true);
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -119,8 +115,7 @@ public class GDTInterstitialAdUtil ...@@ -119,8 +115,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdClicked() public void OnAdClicked()
{ {
string msg = "OnAdClicked";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -128,8 +123,7 @@ public class GDTInterstitialAdUtil ...@@ -128,8 +123,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdLeaveApp() public void OnAdLeaveApp()
{ {
string msg = "OnAdLeaveApp";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -137,8 +131,7 @@ public class GDTInterstitialAdUtil ...@@ -137,8 +131,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdClosed() public void OnAdClosed()
{ {
string msg = "OnAdClosed";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
#if UNITY_ANDROID #if UNITY_ANDROID
...@@ -148,8 +141,7 @@ public class GDTInterstitialAdUtil ...@@ -148,8 +141,7 @@ public class GDTInterstitialAdUtil
public void OnVideoCached() public void OnVideoCached()
{ {
// 视频素材加载完成,在此时调用展示,视频广告不会有进度条。 // 视频素材加载完成,在此时调用展示,视频广告不会有进度条。
string msg = "OnVideoCached";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
#endif #endif
...@@ -158,8 +150,7 @@ public class GDTInterstitialAdUtil ...@@ -158,8 +150,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoInit() public void OnVideoInit()
{ {
string msg = "OnVideoInit";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -167,8 +158,7 @@ public class GDTInterstitialAdUtil ...@@ -167,8 +158,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoLoading() public void OnVideoLoading()
{ {
string msg = "OnVideoLoading";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -176,8 +166,7 @@ public class GDTInterstitialAdUtil ...@@ -176,8 +166,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoStarted() public void OnVideoStarted()
{ {
string msg = "OnVideoStarted";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -185,8 +174,7 @@ public class GDTInterstitialAdUtil ...@@ -185,8 +174,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoPaused() public void OnVideoPaused()
{ {
string msg = "OnVideoPaused";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -194,8 +182,7 @@ public class GDTInterstitialAdUtil ...@@ -194,8 +182,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoCompleted() public void OnVideoCompleted()
{ {
string msg = "OnVideoCompleted";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -203,8 +190,7 @@ public class GDTInterstitialAdUtil ...@@ -203,8 +190,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoError() public void OnVideoError()
{ {
string msg = "OnVideoError";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -212,8 +198,7 @@ public class GDTInterstitialAdUtil ...@@ -212,8 +198,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoDetailPageShown() public void OnVideoDetailPageShown()
{ {
string msg = "OnVideoDetailPageShown";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
/// <summary> /// <summary>
...@@ -221,8 +206,7 @@ public class GDTInterstitialAdUtil ...@@ -221,8 +206,7 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnVideoDetailPageClosed() public void OnVideoDetailPageClosed()
{ {
string msg = "OnVideoDetailPageClosed";
Debug.unityLogger.Log(Constants.tagForLog, msg);
} }
} }
} }
...@@ -28,9 +28,9 @@ public class GDTRewardAdUtil ...@@ -28,9 +28,9 @@ public class GDTRewardAdUtil
/// <param name="callback"></param> /// <param name="callback"></param>
public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback) public void LoadCacheRewardAd(AdEntity entity, Action<bool> callback)
{ {
RewardVideoAd rewardVideoAd = new RewardVideoAd(Constants.rewardVideoPosId); 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(true);//设置声音
rewardVideoAd.LoadAd(); rewardVideoAd.LoadAd();
} }
...@@ -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(true);//设置是否打开声音
rewardAd.ShowAD(); rewardAd.ShowAD();
} }
else else
...@@ -128,11 +128,13 @@ public class GDTRewardAdUtil ...@@ -128,11 +128,13 @@ public class GDTRewardAdUtil
public void OnError(AdError error) public void OnError(AdError error)
{ {
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); callback(false);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + error.GetErrorCode() + " msg" + error.GetErrorMsg());
} }
public void OnRewarded() public void OnRewarded()
......
...@@ -9,6 +9,7 @@ PluginImporter: ...@@ -9,6 +9,7 @@ PluginImporter:
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 0
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1
platformData: platformData:
- first: - first:
Android: Android Android: Android
......
fileFormatVersion: 2 fileFormatVersion: 2
guid: ea5489225a2e4482096765b124c62e25 guid: cbfc243b533794f4a9a553e3e085f2be
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
......
...@@ -16,6 +16,8 @@ public class Splash : MonoBehaviour ...@@ -16,6 +16,8 @@ public class Splash : MonoBehaviour
/// </summary> /// </summary>
private void Awake() private void Awake()
{ {
//Application.runInBackground = true;
} }
...@@ -46,6 +48,7 @@ public class Splash : MonoBehaviour ...@@ -46,6 +48,7 @@ public class Splash : MonoBehaviour
{ {
yield return new WaitForSeconds(3f); yield return new WaitForSeconds(3f);
AdManager.Instance.LoadSplashAd(new SplshAdListener()); AdManager.Instance.LoadSplashAd(new SplshAdListener());
AdManager.Instance.LoadCacheRewardVideoAd("video");
} }
private sealed class SplshAdListener : ZXADSplashListener private sealed class SplshAdListener : ZXADSplashListener
...@@ -61,6 +64,7 @@ public class Splash : MonoBehaviour ...@@ -61,6 +64,7 @@ public class Splash : MonoBehaviour
public void onError(string errorMsg) public void onError(string errorMsg)
{ {
SceneManager.LoadScene("AdDemo");
} }
} }
......
fileFormatVersion: 2
guid: ddf78793cf99f4b699c5a9dcf9cc2b60
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Newtonsoft.Json.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.Android; using UnityEngine.Android;
using UnityEngine.UI; using UnityEngine.UI;
...@@ -36,7 +35,7 @@ public class HttpTest : MonoBehaviour ...@@ -36,7 +35,7 @@ public class HttpTest : MonoBehaviour
public void OnClickPost() public void OnClickPost()
{ {
Dictionary<string, string> d = new Dictionary<string, string>(); Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("type", "1"); d.Add("type", "1");
//HttpTool.Instance._Post("app/v1/game/xynt/use_fertilize", "", null, actionRes); //HttpTool.Instance._Post("app/v1/game/xynt/use_fertilize", "", null, actionRes);
HttpTool.Instance._Post("app/v1/game/xynt/box_reward", d, new Action<TestBean>((bean) => HttpTool.Instance._Post("app/v1/game/xynt/box_reward", d, new Action<TestBean>((bean) =>
...@@ -80,7 +79,7 @@ public class HttpTest : MonoBehaviour ...@@ -80,7 +79,7 @@ public class HttpTest : MonoBehaviour
AndroidJavaClass cpuUtils = new AndroidJavaClass( AndroidJavaClass cpuUtils = new AndroidJavaClass(
"com.unity.adcommon.unity.CpuUtils"); "com.unity.adcommon.unity.CpuUtils");
Dictionary<string, string> d = new Dictionary<string, string>(); Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("md5", PrefenceUtils.GetInstance().getMd5()); d.Add("md5", PrefenceUtils.GetInstance().getMd5());
d.Add("type", cpuUtils.CallStatic<string>("getArchType")); d.Add("type", cpuUtils.CallStatic<string>("getArchType"));
HttpTool.Instance._Get("app/v1/novel/info", d, new Action<TestBean>((bean) => HttpTool.Instance._Get("app/v1/novel/info", d, new Action<TestBean>((bean) =>
......
This diff is collapsed.
...@@ -12,12 +12,12 @@ EditorBuildSettings: ...@@ -12,12 +12,12 @@ EditorBuildSettings:
path: Assets/AD/GDT/UnionDemo/UnionExample.unity path: Assets/AD/GDT/UnionDemo/UnionExample.unity
guid: 6c963ae210fa3c3438c2f6770ee81fc9 guid: 6c963ae210fa3c3438c2f6770ee81fc9
- enabled: 1 - enabled: 1
path: Assets/Splash/Splash.unity path: Assets/Game/Splash/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 1 - enabled: 1
path: Assets/AD/Demo/AdDemo.unity path: Assets/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2 guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 1 - enabled: 0
path: Assets/NetWork/Demo/HttpDemo.unity path: Assets/NetWork/Demo/HttpDemo.unity
guid: 1d254830c8b62484bb74d303cbb2cc3d guid: 1d254830c8b62484bb74d303cbb2cc3d
m_configObjects: {} m_configObjects: {}
...@@ -262,15 +262,15 @@ PlayerSettings: ...@@ -262,15 +262,15 @@ PlayerSettings:
AndroidTargetArchitectures: 1 AndroidTargetArchitectures: 1
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
AndroidKeystoreName: AndroidKeystoreName: D:/antearn.jks
AndroidKeyaliasName: AndroidKeyaliasName: antearn
AndroidBuildApkPerCpuArchitecture: 0 AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0 AndroidTVCompatibility: 0
AndroidIsGame: 1 AndroidIsGame: 1
AndroidEnableTango: 0 AndroidEnableTango: 0
androidEnableBanner: 1 androidEnableBanner: 1
androidUseLowAccuracyLocation: 0 androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0 androidUseCustomKeystore: 1
m_AndroidBanners: m_AndroidBanners:
- width: 320 - width: 320
height: 180 height: 180
...@@ -654,7 +654,8 @@ PlayerSettings: ...@@ -654,7 +654,8 @@ PlayerSettings:
webGLWasmStreaming: 0 webGLWasmStreaming: 0
scriptingDefineSymbols: {} scriptingDefineSymbols: {}
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: {} scriptingBackend:
Android: 0
il2cppCompilerConfiguration: {} il2cppCompilerConfiguration: {}
managedStrippingLevel: {} managedStrippingLevel: {}
incrementalIl2cppBuild: {} incrementalIl2cppBuild: {}
...@@ -664,7 +665,8 @@ PlayerSettings: ...@@ -664,7 +665,8 @@ PlayerSettings:
gcIncremental: 1 gcIncremental: 1
assemblyVersionValidation: 1 assemblyVersionValidation: 1
gcWBarrierValidation: 0 gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {} apiCompatibilityLevelPerPlatform:
Android: 6
m_RenderingPath: 1 m_RenderingPath: 1
m_MobileRenderingPath: 1 m_MobileRenderingPath: 1
metroPackageName: 2D_BuiltInRenderer metroPackageName: 2D_BuiltInRenderer
......
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