Commit 611e0a9c authored by erwin's avatar erwin

dddddd

parents 85903fcc da84ac26
{
"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 != "")
......@@ -112,9 +118,14 @@ public class AdManager
//加载Splash广告
mLoadSplashAd("splash", listener, bannerAdList);
}
else
{
listener.onError("Splash数据null");
}
}), new Action<string, string>((code, errMsg) =>
{
listener.onError("code" + code + "errMsg" + errMsg);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "Splash 请求失败" + errMsg);
}));
}
......@@ -170,8 +181,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 +292,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 +310,7 @@ public class AdManager
}
else
{
LoadCacheBannerAd(slotName);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "展示Banner失败 缓存的信息为null");
}
}
......@@ -350,7 +368,7 @@ public class AdManager
/// <summary>
/// 根据广告List开始加载插屏缓存
/// 根据广告List开始加载大图缓存
/// </summary>
private Action<bool> FeedAdCallBack;
private void mLoadFeedCacheAd(string sloatName, List<AdEntity> adList)
......@@ -409,9 +427,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 +445,7 @@ public class AdManager
}
else
{
LoadCacheFeedAd(slotName);
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "展示大图失败 缓存的信息为null");
}
}
......@@ -543,25 +562,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 +809,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 +826,8 @@ public class AdManager
}
else
{
LoadCacheFSVideoAd(slotName);
listener.onError("播放全屏视频失败 缓存的信息为null");
Debug.unityLogger.Log(ZXADConfig.ADManagerTAG, "播放全屏视频失败 缓存的信息为null");
}
}
......@@ -897,14 +919,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 +1066,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 +1079,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()
......
......@@ -30,7 +30,7 @@ public class GDTRewardAdUtil
{
RewardVideoAd rewardVideoAd = new RewardVideoAd(entity.codeId);
rewardVideoAd.SetListener(new RewardVideoAdListener(this, entity, rewardVideoAd, callback, true));
rewardVideoAd.SetVideoMuted(true);//设置声音
rewardVideoAd.SetVideoMuted(false);//设置声音
rewardVideoAd.LoadAd();
}
......@@ -50,7 +50,7 @@ public class GDTRewardAdUtil
#if UNITY_IOS
rewardAd.SetEnableDefaultAudioSessionSetting(false);
#endif
rewardAd.SetVideoMuted(true);//设置是否打开声音
rewardAd.SetVideoMuted(false);//设置是否打开声音
rewardAd.ShowAD();
}
else
......
......@@ -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}
......@@ -1201,6 +1201,11 @@ PrefabInstance:
propertyPath: IS_TEST
value: 1
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
......@@ -1341,7 +1346,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 329210704}
m_MethodName: TestJiami
m_MethodName: OnClickTestSign
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
......
using System;
using LitJson;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Android;
using UnityEngine.UI;
......@@ -23,14 +25,14 @@ public class HttpTest : MonoBehaviour
Debug.Log("测试GET");
//app/v1/game/xynt/land_list
//app/v1/game/xynt/home_info
HttpTool.Instance._Get("app/v1/game/xynt/land_list", null, new Action<List<TestBean>>((bean) =>
HttpTool.Instance._Get("app/v1/tianzi/question", null, new Action<TestBean>((bean) =>
{
Debug.Log("Get 请求成功"+ bean.Count);
Debug.Log("Get 请求成功111");
}), new Action<string, string>((code, errMsg) =>
{
Debug.Log("Get 请求失败" + errMsg);
}));
Debug.Log("Get 请求失败"+code + errMsg);
}));;
}
public void OnClickPost()
......@@ -115,7 +117,35 @@ public class HttpTest : MonoBehaviour
{
}));
}
//string enc = "cYMqfCFXX1qTbOitQJVqOtUsXx/8ZeTXIjnsq9MpqMXkx+v92z5wAWjM5l+RPAHjih2CmDKTljKPuY4DaAQ2FxUXl05hUN0Kc84g0WOZFEDeVsQ2UB/Dhp6KTtSlVGVPlQ1hWZpkEq3ZhE4H2EY2KVKNYW0B9rlRyOYGLCumeGMsMXR1Vnz+l8MLXSshdzBh6ZqksdPYeU1qk3FuXWN71Y54kM8JIun7DW5uL2EVxjYVgvbcgtMxWdIBQxlbE0wQWDwQ3XnPn8j7nQ/v+TB9r3q10k837ZfkO+t5UpSCIQwZFA7/ZUyf9t/HJoklRJGDmtL+ua5F4xTi+amBdlCkmlnnr4PNqgpnP/AojVCkpDfhoO96CH/H9tbkoyrt2fueCTjHfoQYV/HKV0RrvYTG789JUGn2/brzL2MWSv0EkFYNihTGPzifG9C1gvSyIH/wkghFN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UEyqeccu4P3kyZXYNQUAJydH7FLrhQLHM98GSGJ0eqcES7znG7AtdsQj5H4O+B5B0l44zcvwPrsh0WSzzvsIi5r+IkgdKzZZ//hvCgqcLmn78Mkpm60kuf8KyOUbhVjvUKh1cdmzFetN87wnSIKHsgaLDeSgbwlW9m/yht0W6LjRyXX5IU8fR\",\"security\":\"SECURITY\"}";
public void OnClickTestSign()
{
Response<TestBean> response = JsonMapper.ToObject<Response<TestBean>>(json);
String signResult = EncryptHelper.EncryptHelper.DeCode(response.enc, "as09384io03lmp78", "e2e7d664d72f710c");
try
{
//String signResult = DataSignVerify(response.enc, response.sign);
Debug.unityLogger.Log("DecryptInterceptor", "signResult: " + signResult);
if (("OK").Equals(signResult))
{
//String decryptResult = DecryptData(response.enc);
//Debug.unityLogger.Log("DecryptInterceptor", "decryptResult: " + decryptResult);
}
else
{
Debug.unityLogger.Log("DecryptInterceptor", "decryptResult: error");
}
}
catch (Exception e)
{
Debug.unityLogger.Log("DecryptInterceptor", "error" + e.ToString());
}
}
......
......@@ -6,6 +6,6 @@ using System;
[Serializable]
public class TestBean
{
public int landId;
public int status;
public int landId { set; get; }
public int status { set; get; }
}
......@@ -3,6 +3,7 @@ using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
namespace EncryptHelper
{
......@@ -125,6 +126,126 @@ namespace EncryptHelper
}
}
}
/// <summary>
/// 加密数据
/// </summary>
/// <param name="data">明文数据</param>
/// <param name="key">密钥</param>
/// <param name="iv">偏移</param>
/// <returns></returns>
public static string EnCode(string data, string key, string iv)
{
try
{
byte[] keyArray = Encoding.UTF8.GetBytes(key);
byte[] ivArray = Encoding.UTF8.GetBytes(iv);
byte[] toEncryptArray = Encoding.UTF8.GetBytes(data);
RijndaelManaged rDel = new RijndaelManaged();
rDel.Key = keyArray;
rDel.IV = ivArray;
rDel.Mode = CipherMode.CBC;
rDel.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = rDel.CreateEncryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
return Convert.ToBase64String(resultArray, 0, resultArray.Length);
}
catch (Exception e)
{
return "";
}
}
/// <summary>
/// 解密数据
/// </summary>
/// <param name="data">加密内容</param>
/// <param name="key">密钥</param>
/// <param name="iv">偏移</param>
/// <returns></returns>
public static string DeCode(string data, string key, string iv)
{
try
{
byte[] keyArray = Encoding.UTF8.GetBytes(key);
byte[] ivArray = Encoding.UTF8.GetBytes(iv);
byte[] toEncryptArray = Convert.FromBase64String(data);
RijndaelManaged rDel = new RijndaelManaged();
rDel.Key = keyArray;
rDel.IV = ivArray;
rDel.Mode = CipherMode.CBC;
rDel.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = rDel.CreateDecryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
return Encoding.UTF8.GetString(resultArray);
}
catch (Exception e)
{
return "";
}
}
/// <summary>
/// AES解密
/// </summary>
/// <param name="Data">被解密的密文</param>
/// <param name="Key">密钥</param>
/// <param name="Vector">向量</param>
/// <returns>明文</returns>
public static String AESDecrypt(String Data, String Key, String Vector)
{
//string dummyData = Data.Trim().Replace("%", "").Replace(",", "").Replace(" ", "+");
//if (dummyData.Length % 4 > 0)
//{
// dummyData = dummyData.PadRight(dummyData.Length + 4 - dummyData.Length % 4, '=');
//}
Byte[] encryptedBytes = Convert.FromBase64String(Data);
Byte[] bKey = new Byte[32];
Array.Copy(Encoding.UTF8.GetBytes(Key.PadRight(bKey.Length)), bKey, bKey.Length);
Byte[] bVector = new Byte[16];
Array.Copy(Encoding.UTF8.GetBytes(Vector.PadRight(bVector.Length)), bVector, bVector.Length);
Byte[] original = null; // 解密后的明文
Rijndael Aes = Rijndael.Create();
try
{
// 开辟一块内存流,存储密文
using (MemoryStream Memory = new MemoryStream(encryptedBytes))
{
// 把内存流对象包装成加密流对象
using (CryptoStream Decryptor = new CryptoStream(Memory,
Aes.CreateDecryptor(bKey, bVector),
CryptoStreamMode.Read))
{
// 明文存储区
using (MemoryStream originalMemory = new MemoryStream())
{
Byte[] Buffer = new Byte[1024];
Int32 readBytes = 0;
while ((readBytes = Decryptor.Read(Buffer, 0, Buffer.Length)) > 0)
{
originalMemory.Write(Buffer, 0, readBytes);
}
original = originalMemory.ToArray();
}
}
}
}
catch(Exception e)
{
original = null;
}
return Encoding.UTF8.GetString(original);
}
/// <summary>
/// MD5加密
/// </summary>
......
......@@ -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";
}
......@@ -3,9 +3,13 @@
[Serializable]
public class Response<T>
{
public int status;
public string msg = "";
public int status { get; set; }
public string msg { get; set; }
public Result<T> result = null;
public string sign { get; set; }
public string enc { get; set; }
public string security { get; set; }
[Serializable]
public class Result<T>
......
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
......
......@@ -22,7 +22,7 @@ public final class UnionApplication extends Application {
public void onCreate() {
super.onCreate();
AppliContext.init(this);
UMConfigure.setLogEnabled(true);
UMConfigure.init(this, "602f890b668f9e17b8b31413", "xynt", UMConfigure.DEVICE_TYPE_PHONE,"");
// TTAdConfig config = new TTAdConfig.Builder()
// //.appId("5001121")
......
using Umeng;
using LitJson;
using System.Collections.Generic;
using UnityEngine;
public class EventUtils
{
......@@ -17,6 +18,7 @@ public class EventUtils
map["event"] = Event;
map["action"] = action;
HttpTool.Instance._PostEvent(JsonMapper.ToJson(map));
Debug.unityLogger.Log("UmLog", "OnEvent action" + action);
GA.Event(action);
}
public static void OnEvent(string action, string value)
......@@ -26,6 +28,7 @@ public class EventUtils
map["action"] = action;
map["value"] = value;
HttpTool.Instance._PostEvent(JsonMapper.ToJson(map));
Debug.unityLogger.Log("UmLog", "OnEvent action" + action+ " value " + value);
GA.Event(action, value);
}
......@@ -43,7 +46,7 @@ public class EventUtils
}
if (entity.actionName == null)
{
entity.actionName = "";
entity.actionName = entity.slotName+ "PullFail";
}
Dictionary<string, string> map = new Dictionary<string, string>();
map["event"] = Event;
......@@ -61,7 +64,8 @@ public class EventUtils
{
HttpTool.Instance._GetEvent(entity.pullfail_tracking[0]);
}
GA.Event(entity.actionName);
Debug.unityLogger.Log("UmLog", "onEventPullFail entity.actionName " + entity.actionName);
GA.Event(entity.actionName);
}
/// <summary>
......@@ -76,7 +80,7 @@ public class EventUtils
}
if (entity.actionName == null)
{
entity.actionName = "";
entity.actionName = entity.slotName + "PullSuc";
}
Dictionary<string, string> map = new Dictionary<string, string>();
map["event"] = Event;
......@@ -91,6 +95,7 @@ public class EventUtils
{
HttpTool.Instance._GetEvent(entity.pullsucc_tracking[0]);
}
Debug.unityLogger.Log("UmLog", "onEventPullSuccess entity.actionName " + entity.actionName);
GA.Event(entity.actionName);
}
/// <summary>
......@@ -104,7 +109,7 @@ public class EventUtils
}
if (entity.actionName == null)
{
entity.actionName = "";
entity.actionName = entity.slotName + "PullSuc";
}
Dictionary<string, string> map = new Dictionary<string, string>();
map["event"] = Event;
......@@ -133,7 +138,7 @@ public class EventUtils
}
if (entity.actionName == null)
{
entity.actionName = "";
entity.actionName = entity.slotName + "ShowFail";
}
Dictionary<string, string> map = new Dictionary<string, string>();
map["event"] = Event;
......@@ -148,6 +153,7 @@ public class EventUtils
{
HttpTool.Instance._GetEvent(entity.showfail_tracking[0]);
}
Debug.unityLogger.Log("UmLog", "onEventShowFail entity.actionName " + entity.actionName);
GA.Event(entity.actionName);
}
/// <summary>
......@@ -162,7 +168,7 @@ public class EventUtils
}
if (entity.actionName == null)
{
entity.actionName = "";
entity.actionName = entity.slotName + "Complete";
}
Dictionary<string, string> map = new Dictionary<string, string>();
map["event"] = Event;
......@@ -177,6 +183,7 @@ public class EventUtils
{
HttpTool.Instance._GetEvent(entity.playcomplete_trackings[0]);
}
Debug.unityLogger.Log("UmLog", "onEventAdComplete entity.actionName " + entity.actionName);
GA.Event(entity.actionName);
}
......@@ -192,7 +199,7 @@ public class EventUtils
}
if (entity.actionName == null)
{
entity.actionName = "";
entity.actionName = entity.slotName + "Click";
}
Dictionary<string, string> map = new Dictionary<string, string>();
map["event"] = Event;
......@@ -207,6 +214,7 @@ public class EventUtils
{
HttpTool.Instance._GetEvent(entity.clk_tracking[0]);
}
Debug.unityLogger.Log("UmLog", "onEventAdClick entity.actionName " + entity.actionName);
GA.Event(entity.actionName);
}
......
......@@ -11,13 +11,13 @@ EditorBuildSettings:
- enabled: 0
path: Assets/AD/GDT/UnionDemo/UnionExample.unity
guid: 6c963ae210fa3c3438c2f6770ee81fc9
- enabled: 1
- enabled: 0
path: Assets/Game/Splash/Splash.unity
guid: 37af8cf3fb373478ab04e3ee2f3b700a
- enabled: 1
- enabled: 0
path: Assets/AD/Demo/AdDemo.unity
guid: ef80a35d44f809e4a8957d1ed9571fd2
- enabled: 0
- enabled: 1
path: Assets/NetWork/Demo/HttpDemo.unity
guid: 1d254830c8b62484bb74d303cbb2cc3d
m_configObjects: {}
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