Commit 269f2a58 authored by 王雪伟's avatar 王雪伟

修复设置actionName为null 和 上报加入公共参数

parent cd52f889
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using System;
using Tencent.GDT;
using System.Runtime.InteropServices;
public class AdManager
{
......@@ -40,7 +41,8 @@ public class AdManager
return activity;
}
[DllImport("__Internal")]
public static extern void InitCSJSDK(string appId); // ios初始化穿山甲SDK
private bool IsInitAd = false;
......@@ -55,16 +57,20 @@ public class AdManager
//paras.Clear();
//paras.Add("pkg", "com.ym.xynt");
//获取广告配置
Dictionary<string, object> paras = new Dictionary<string, object>();
HttpTool.Instance._GetAD(AdConfigUrl, paras, new Action<List<AdIdConfig>>((AdConfigList) =>
HttpTool.Instance._GetAD(AdConfigUrl, null, new Action<List<AdIdConfig>>((AdConfigList) =>
{
foreach (AdIdConfig id in AdConfigList)
{
switch (id.adPlatform)
{
//初始化穿山甲广告ID
case ZXADConfig.PLANTFORM_AD_TT:
#if UNITY_ANDROID
AndroidJavaClass jc = new AndroidJavaClass("com.unity.adcommon.unity.TTADManager");
jc.CallStatic("init", id.codeAppId);
#elif UNITY_IOS
InitCSJSDK(id.codeAppId);
#endif
break;
case ZXADConfig.PLANTFORM_AD_GDT:
if (id.codeAppId != null && id.codeAppId != "")
......@@ -170,8 +176,14 @@ public class AdManager
switch (entity.adPlatform)
{
case ZXADConfig.PLANTFORM_AD_TT:
//加载穿山甲开屏广告
#if UNITY_ANDROID
//加载穿山甲开屏广告
CSJSplshADUtils.Instance.LoadSplshAd(entity, GetActivity(), GetSplashAdManager(), listener, callback);
#elif UNITY_IOS
//加载穿山甲开屏广告
CSJSplshADUtils.Instance.LoadSplshAd(entity,null, null, listener, callback);
#endif
break;
case ZXADConfig.PLANTFORM_AD_GDT:
//广点通开屏广告
......@@ -275,9 +287,9 @@ public class AdManager
public void ShowCacheBannerAd(string slotName,string actionName)
{
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, "");
entity.actionName = actionName;
if (entity != null)
{
entity.actionName = actionName;
ZXADConfig.Instance.RemoveAdCache(slotName, "");
mShowCacheBannerAdPlatform(entity, new Action<bool>((bl) =>
{
......@@ -293,6 +305,7 @@ public class AdManager
}
else
{
LoadCacheBannerAd(slotName);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "展示Banner失败 缓存的信息为null");
}
}
......@@ -350,7 +363,7 @@ public class AdManager
/// <summary>
/// 根据广告List开始加载插屏缓存
/// 根据广告List开始加载大图缓存
/// </summary>
private Action<bool> FeedAdCallBack;
private void mLoadFeedCacheAd(string sloatName, List<AdEntity> adList)
......@@ -409,9 +422,9 @@ public class AdManager
public void ShowCacheFeedAd(string slotName,string actionName)
{
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, "");
entity.actionName = actionName;
if (entity != null)
{
entity.actionName = actionName;
ZXADConfig.Instance.RemoveAdCache(slotName, "");
mShowCacheFeedAdPlatform(entity, new Action<bool>((bl) =>
{
......@@ -427,6 +440,7 @@ public class AdManager
}
else
{
LoadCacheFeedAd(slotName);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "展示大图失败 缓存的信息为null");
}
}
......@@ -543,25 +557,26 @@ public class AdManager
public void PlayCacheInterstitialAd(string slotName,string actionName)
{
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName,"");
entity.actionName = actionName;
if (entity != null)
{
entity.actionName = actionName;
ZXADConfig.Instance.RemoveAdCache(slotName, "");
mPlayCacheInterstitialAdPlatform(entity, new Action<bool>((bl) =>
{
if (bl)
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放屏视频成功 " + entity.adPlatform + " CodeId" + entity.codeId);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放屏视频成功 " + entity.adPlatform + " CodeId" + entity.codeId);
}
else
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放屏视频失败 " + entity.adPlatform + " CodeId" + entity.codeId);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放屏视频失败 " + entity.adPlatform + " CodeId" + entity.codeId);
}
}));
}
else
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放全屏视频失败 缓存的信息为null");
LoadCacheInterstitialAd(slotName);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放插屏视频失败 缓存的信息为null");
}
}
......@@ -789,9 +804,9 @@ public class AdManager
entity = entityB;
ZXADConfig.Instance.RemoveAdCache(slotName, "B");
}
entity.actionName = actionName;
if (entity != null)
{
entity.actionName = actionName;
mPlayCacheFSVodeoAdPlatform(entity, listener, new Action<bool>((bl) =>
{
if (bl)
......@@ -806,6 +821,8 @@ public class AdManager
}
else
{
LoadCacheFSVideoAd(slotName);
listener.onError("播放全屏视频失败 缓存的信息为null");
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放全屏视频失败 缓存的信息为null");
}
}
......@@ -897,14 +914,12 @@ public class AdManager
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "激励视频A组没有数据");
return;
}
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "正序的第一个广告ID" + adList[0].codeId);
if (IsFirstLoadRewardAd)
{
//第一次预加载 A组进行逆序加载
IsFirstLoadRewardAd = false;
adList.Reverse();
}
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "反序的第一个广告ID" + adList[0].codeId);
List<AdEntity> totalEntityList = adList;
AdEntity entity = totalEntityList[0];
......@@ -1046,9 +1061,9 @@ public class AdManager
ZXADConfig.Instance.RemoveAdCache(slotName, "B");
}
entity.actionName = actionName;
if (entity != null)
{
entity.actionName = actionName;
mPlayCacheRewardVodeoAdPlatform(entity, listener, new Action<bool>((bl) =>
{
......@@ -1059,14 +1074,15 @@ public class AdManager
else
{
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.codeGroup + "播放激励视频失败 " + entity.adPlatform + " CodeId" + entity.codeId);
//listener.onError(entity.codeGroup + "播放激励视频失败 " + entity.adPlatform + " CodeId" + entity.codeId);
}
}));
}
else
{
LoadCacheRewardVideoAd(slotName);
listener.onError("播放激励视频失败 缓存的信息为null");
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放激励视频失败 缓存的信息为null");
}
}
......
......@@ -135,21 +135,25 @@ public class CSJBannerUtil
public void OnExpressAdLoad(List<ExpressAd> ads)
{
#if UNITY_ANDROID
EventUtils.onEventPullSuccess(entity);
IEnumerator<ExpressAd> enumerator = ads.GetEnumerator();
if (enumerator.MoveNext())
{
callback(true);
bannerAdCacheListAndroid.Enqueue(enumerator.Current);
callback(true);
}
#endif
}
#if UNITY_IOS
public void OnExpressBannerAdLoad(ExpressBannerAd ad)
{
EventUtils.onEventPullSuccess(entity);
callback(true);
Debug.Log("OnExpressBannerAdLoad");
bannerAdCacheListIOS.Enqueue(ad);
bannerAdCacheListIOS.Enqueue(ad);
callback(true);
}
public void OnExpressInterstitialAdLoad(ExpressInterstitialAd ad)
......@@ -186,16 +190,17 @@ public class CSJBannerUtil
public void OnAdShow(ExpressAd ad)
{
Debug.Log("express OnAdShow,type:" + type);
EventUtils.onEventShowSuccess(entity);
callback(true);
Debug.Log("express OnAdShow,type:" + type);
}
public void OnAdViewRenderError(ExpressAd ad, int code, string message)
{
Debug.Log("express OnAdViewRenderError,type:" + type);
EventUtils.onEventShowFail(entity);
callback(false);
Debug.Log("express OnAdViewRenderError,type:" + type);
}
public void OnAdViewRenderSucc(ExpressAd ad, float width, float height)
......
......@@ -125,8 +125,8 @@ public class CSJFeedUtil : MonoBehaviour
IEnumerator<ExpressAd> enumerator = ads.GetEnumerator();
if (enumerator.MoveNext())
{
callback(true);
feedAdCacheList.Enqueue(enumerator.Current);
callback(true);
}
}
#if UNITY_IOS
......@@ -168,16 +168,18 @@ public class CSJFeedUtil : MonoBehaviour
public void OnAdShow(ExpressAd ad)
{
Debug.Log("express OnAdShow,type:" + type);
EventUtils.onEventShowSuccess(entity);
callback(true);
Debug.Log("express OnAdShow,type:" + type);
}
public void OnAdViewRenderError(ExpressAd ad, int code, string message)
{
Debug.Log("express OnAdViewRenderError,type:" + type);
EventUtils.onEventShowFail(entity);
callback(false);
Debug.Log("express OnAdViewRenderError,type:" + type);
}
public void OnAdViewRenderSucc(ExpressAd ad, float width, float height)
......@@ -186,8 +188,9 @@ public class CSJFeedUtil : MonoBehaviour
}
public void OnAdClose(ExpressAd ad)
{
EventUtils.onEventAdComplete(entity);
Debug.Log("express OnAdClose,type:" + type);
EventUtils.onEventAdComplete(entity);
}
}
......
......@@ -59,7 +59,7 @@ public class CSJFullScreenUtil : MonoBehaviour
.SetOrientation(AdOrientation.Horizontal)
.Build();
#if UNITY_IOS
this.AdNative.LoadExpressFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this, callback));
this.AdNative.LoadExpressFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this,entity, callback));
#else
this.AdNative.LoadFullScreenVideoAd(adSlot, new FullScreenVideoAdListener(this, entity, callback));
#endif
......@@ -71,7 +71,7 @@ public class CSJFullScreenUtil : MonoBehaviour
ExpressFullScreenVideoAd fsAd = GetFSVideoAdForIOS(entity.codeGroup+entity.codeId);
if (fsAd!=null)
{
fsAd.SetFullScreenVideoAdInteractionListener(new FullScreenAdInteractionListener(listener, callback));
fsAd.SetFullScreenVideoAdInteractionListener(new FullScreenAdInteractionListener(entity,listener, callback));
fsAd.ShowFullScreenVideoAd();
}
else
......@@ -163,8 +163,8 @@ public class CSJFullScreenUtil : MonoBehaviour
public void OnAdShow()
{
EventUtils.onEventShowSuccess(entity);
callback(true);
listener.onAdShow();
callback(true);
}
public void OnAdVideoBarClick()
......@@ -187,8 +187,9 @@ public class CSJFullScreenUtil : MonoBehaviour
public void OnVideoError()
{
EventUtils.onEventShowFail(entity);
callback(false);
listener.onError("CSJ 全屏视频播放错误");
callback(false);
}
}
......
......@@ -105,8 +105,9 @@ public class CSJInterstitialUtil
}
else
{
callback(false);
Debug.Log("CSJ 插屏广告没有缓存数据了");
callback(false);
}
#endif
}
......@@ -130,13 +131,20 @@ public class CSJInterstitialUtil
public void OnExpressAdLoad(List<ExpressAd> ads)
{
#if UNITY_ANDROID
EventUtils.onEventPullSuccess(entity);
IEnumerator<ExpressAd> enumerator = ads.GetEnumerator();
if (enumerator.MoveNext())
{
callback(true);
interstitialAdCacheListAndroid.Enqueue(enumerator.Current);
callback(true);
}
#endif
}
#if UNITY_IOS
public void OnExpressBannerAdLoad(ExpressBannerAd ad)
......@@ -147,8 +155,9 @@ public class CSJInterstitialUtil
public void OnExpressInterstitialAdLoad(ExpressInterstitialAd ad)
{
EventUtils.onEventPullSuccess(entity);
callback(true);
interstitialAdCacheListIOS.Enqueue(ad);
callback(true);
}
#else
#endif
......
......@@ -121,9 +121,9 @@ public class CSJRewardUtil
public void OnError(int code, string message)
{
EventUtils.onEventPullFail(entity, code.ToString(),message);
callback(false);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, entity.adPlatform + " 激励视频 Error Group" + entity.codeGroup + " Code " + code + " msg" + message);
}
callback(false);
}
public void OnRewardVideoAdLoad(RewardVideoAd ad)
{
......@@ -181,9 +181,10 @@ public class CSJRewardUtil
{
EventUtils.onEventShowSuccess(entity);
Debug.Log("rewardVideoAd show");
listener.onAdShow();
callback(true);
//this.cjsAd.rewardAd = null;
listener.onAdShow();
}
public void OnAdVideoBarClick()
......@@ -214,8 +215,9 @@ public class CSJRewardUtil
{
EventUtils.onEventShowFail(entity);
Debug.Log("rewardVideoAd error");
callback(false);
listener.onError("CSJ RewardAd Error");
callback(false);
}
public void OnRewardVerify(bool rewardVerify, int rewardAmount, string rewardName)
......
......@@ -39,12 +39,12 @@ public class AdDemo : MonoBehaviour
public void onAdClose()
{
this.demo.RewardAdResult.text = "Reward onAdClose";
//AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdShow()
{
this.demo.RewardAdResult.text = "Reward onAdShow";
AdManager.Instance.LoadCacheRewardVideoAd("video");
}
public void onAdVideoBarClick()
......
......@@ -59,12 +59,12 @@ public class Splash : MonoBehaviour
public void onAdSkip()
{
SceneManager.LoadScene("AdDemo");
SceneManager.LoadSceneAsync("AdDemo");
}
public void onError(string errorMsg)
{
SceneManager.LoadScene("AdDemo");
SceneManager.LoadSceneAsync("AdDemo");
}
}
......
......@@ -528,5 +528,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedComponents:
- {fileID: 5984542369482327738, guid: 1053be02c113a7a45adf322c929b0cb6, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 1053be02c113a7a45adf322c929b0cb6, type: 3}
using UnityEngine;
using System.Collections;
using System;
using System.Security.Cryptography;
using System.Text;
/// <summary>
/// AES加密算法
/// </summary>
public class AESEncryption : MonoBehaviour
{
/// <summary>
/// aes加密key
/// </summary>
private static string aesKey = "c20505927997d952";
/// <summary>
/// aes加密偏移量
/// </summary>
private static string aeslv = "e2e7d664d72f710b";
/// <summary>
/// AES加密
/// </summary>
/// <param name="content">被加密的明文</param>
/// <param name="key">密钥</param>
/// <param name="vector">向量</param>
/// <returns>密文</returns>
public static string AESEncrypt(string content)
{
string key = aesKey;
string vector = aeslv;
if (string.IsNullOrEmpty(content)) return null;
byte[] toEncryptArray = Encoding.UTF8.GetBytes(content);
RijndaelManaged rm = new RijndaelManaged
{
Key = Encoding.UTF8.GetBytes(key),
IV = Encoding.UTF8.GetBytes(vector),
Mode = CipherMode.CBC,
Padding = PaddingMode.PKCS7
};
ICryptoTransform cTransform = rm.CreateEncryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
return Convert.ToBase64String(resultArray, 0, resultArray.Length);
}
/// <summary>
/// AES解密方法
/// </summary
/// <param name="content">要解密的内容</param>
/// <param name="key">解密key</param>
/// <param name="vector">向量</param>
/// <returns></returns>
public static string AESDecipher(string content)
{
string key = aesKey;
string vector = aeslv;
if (string.IsNullOrEmpty(content)) return null;
byte[] toEncryptArray = Convert.FromBase64String(content);
RijndaelManaged rm = new RijndaelManaged
{
Key = Encoding.UTF8.GetBytes(key),
IV = Encoding.UTF8.GetBytes(vector),
Mode = CipherMode.CBC,
Padding = PaddingMode.PKCS7
};
ICryptoTransform cTransform = rm.CreateDecryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
return Encoding.UTF8.GetString(resultArray);
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 3f3bf7630836b7043bfb3b3328ed8fdc
guid: 1617db6d6711f8442a0a168a8c4b909d
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
fileFormatVersion: 2
guid: 4402898c05ead0348ae9c35f0ba35328
guid: 08abcf21e7d2d224596f1ce2fd2178d4
PluginImporter:
externalObjects: {}
serializedVersion: 2
......
......@@ -19,23 +19,8 @@ public class GameConfig : MonoBehaviour
private void Awake()
{
GameConfig._instacne = this;
//是否显示Log
Debug.unityLogger.logEnabled = IsShowLog;
}
public bool IsShowLog = false;
//private string
......
......@@ -10,7 +10,6 @@ GameObject:
m_Component:
- component: {fileID: 2853166085728200635}
- component: {fileID: 2853166085728200634}
- component: {fileID: 5984542369482327738}
- component: {fileID: -2993611056400550530}
m_Layer: 0
m_Name: HTTP
......@@ -46,21 +45,10 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
IS_TEST: 1
pkg:
IS_TGYZ: 0
IsShowLog: 1
appLs:
--- !u!114 &5984542369482327738
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2853166085728200632}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3f3bf7630836b7043bfb3b3328ed8fdc, type: 3}
m_Name:
m_EditorClassIdentifier:
URL_GAME_HOME_INFO: app/v1/game/xynt/home_info
appkey: faba1d018f76086
--- !u!114 &-2993611056400550530
MonoBehaviour:
m_ObjectHideFlags: 0
......
This diff is collapsed.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NetConfig : MonoBehaviour
{
private static NetConfig _instacne = null;
public static NetConfig Instance
{
get
{
if (_instacne == null)
{
Debug.LogError("NetConfig Awake error");
}
return _instacne;
}
}
private void Awake()
{
NetConfig._instacne = this;
}
public string URL_GAME_HOME_INFO = "app/v1/game/xynt/home_info";
}
......@@ -270,7 +270,7 @@ PlayerSettings:
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0
androidUseCustomKeystore: 1
m_AndroidBanners:
- width: 320
height: 180
......
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