Commit fbe72d25 authored by 王雪伟's avatar 王雪伟

插屏广告加入回调

parent 55f8d2d7
...@@ -829,14 +829,14 @@ public class AdManager ...@@ -829,14 +829,14 @@ public class AdManager
/// <summary> /// <summary>
/// 播放缓存的插屏广告 /// 播放缓存的插屏广告
/// </summary> /// </summary>
public void PlayCacheInterstitialAd(string slotName, string actionName) public void PlayCacheInterstitialAd(string slotName, string actionName, ZXADInterstitialListener listener)
{ {
AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, ""); AdEntity entity = ZXADConfig.Instance.GetAdCache(slotName, "");
if (entity != null) if (entity != null)
{ {
entity.actionName = actionName; entity.actionName = actionName;
ZXADConfig.Instance.RemoveAdCache(slotName, ""); ZXADConfig.Instance.RemoveAdCache(slotName, "");
mPlayCacheInterstitialAdPlatform(entity, new Action<bool>((bl) => mPlayCacheInterstitialAdPlatform(entity,listener, new Action<bool>((bl) =>
{ {
if (bl) if (bl)
{ {
...@@ -856,22 +856,22 @@ public class AdManager ...@@ -856,22 +856,22 @@ public class AdManager
} }
private void mPlayCacheInterstitialAdPlatform(AdEntity entity, Action<bool> callback) private void mPlayCacheInterstitialAdPlatform(AdEntity entity, ZXADInterstitialListener listener, Action<bool> callback)
{ {
switch (entity.adPlatform) switch (entity.adPlatform)
{ {
case ZXADConfig.PLANTFORM_AD_TT: case ZXADConfig.PLANTFORM_AD_TT:
//穿山甲插屏广告加载 //穿山甲插屏广告加载
CSJInterstitialUtil.Instance.PlayCacheInterstitialAd(entity, callback); CSJInterstitialUtil.Instance.PlayCacheInterstitialAd(entity, callback, listener);
break; break;
case ZXADConfig.PLANTFORM_AD_GDT: case ZXADConfig.PLANTFORM_AD_GDT:
//广点通插屏广告加载 //广点通插屏广告加载
GDTInterstitialAdUtil.Instance.PlayCacheInterstitialAd(entity, callback); GDTInterstitialAdUtil.Instance.PlayCacheInterstitialAd(entity, callback, listener);
break; break;
#if UNITY_ANDROID #if UNITY_ANDROID
case ZXADConfig.PLANTFORM_AD_KUS: case ZXADConfig.PLANTFORM_AD_KUS:
//快手插屏广告加载 //快手插屏广告加载
KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, callback); KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, callback,listener);
break; break;
#endif #endif
default: default:
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface ZXADInterstitialListener
{
//展示插屏广告
void onInterstitialAdShow();
//插屏广告Error
void onInterstitialError(string errorMsg);
//插屏广告关闭
void onInterstitialClose();
}
fileFormatVersion: 2
guid: df6493c8cebe4674388300fe68e8d28c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -14,8 +14,8 @@ public class ZXADConfig ...@@ -14,8 +14,8 @@ public class ZXADConfig
} }
} }
public const int ZXAD_VC = 136; public const int ZXAD_VC = 137;
public const string ZXAD_VN = "1.3.6"; public const string ZXAD_VN = "1.3.7";
public const string ADManagerTAG = "AdManager"; public const string ADManagerTAG = "AdManager";
public const string PLANTFORM_AD_TT = "chuanshanjia"; //穿山甲 public const string PLANTFORM_AD_TT = "chuanshanjia"; //穿山甲
......
...@@ -66,17 +66,18 @@ public class CSJInterstitialUtil ...@@ -66,17 +66,18 @@ public class CSJInterstitialUtil
#else #else
.SetCodeId(entity.codeId) .SetCodeId(entity.codeId)
.SetExpressViewAcceptedSize(350, 0) .SetExpressViewAcceptedSize(350, 0)
////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应 ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应
#endif #endif
.SetSupportDeepLink(true) .SetSupportDeepLink(true)
.SetAdCount(1) .SetAdCount(1)
.SetImageAcceptedSize(1080, 1920) .SetImageAcceptedSize(1080, 1920)
.Build(); .Build();
this.AdNative.LoadExpressInterstitialAd(adSlot, new InterstitialAdListener(entity,callback)); this.AdNative.LoadExpressInterstitialAd(adSlot, new InterstitialAdListener(entity, callback));
} }
public void PlayCacheInterstitialAd(AdEntity entity,Action<bool> callback) public void PlayCacheInterstitialAd(AdEntity entity, Action<bool> callback, ZXADInterstitialListener listener)
{ {
#if UNITY_IOS #if UNITY_IOS
if (interstitialAdCacheListIOS.Count > 0) if (interstitialAdCacheListIOS.Count > 0)
{ {
...@@ -87,7 +88,7 @@ public class CSJInterstitialUtil ...@@ -87,7 +88,7 @@ public class CSJInterstitialUtil
//{ //{
// y = 100; // 防止Demo里刘海遮挡 // y = 100; // 防止Demo里刘海遮挡
//} //}
mInterstitialAd.SetExpressInteractionListener(new ExpressAdInteractionListener(this, callback, entity, 1)); mInterstitialAd.SetExpressInteractionListener(new ExpressAdInteractionListener(this, listener,callback, entity, 1));
mInterstitialAd.ShowExpressAd(x, y); mInterstitialAd.ShowExpressAd(x, y);
} }
else else
...@@ -100,14 +101,14 @@ public class CSJInterstitialUtil ...@@ -100,14 +101,14 @@ public class CSJInterstitialUtil
if (interstitialAdCacheListAndroid.Count > 0) if (interstitialAdCacheListAndroid.Count > 0)
{ {
mInterstitialAd = interstitialAdCacheListAndroid.Dequeue(); mInterstitialAd = interstitialAdCacheListAndroid.Dequeue();
ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, callback,entity, 1); ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, listener, callback, entity, 1);
NativeAdManager.Instance().ShowExpressInterstitialAd(GetActivity(), mInterstitialAd.handle, expressAdInteractionListener); NativeAdManager.Instance().ShowExpressInterstitialAd(GetActivity(), mInterstitialAd.handle, expressAdInteractionListener);
} }
else else
{ {
Debug.Log("CSJ 插屏广告没有缓存数据了"); Debug.Log("CSJ 插屏广告没有缓存数据了");
callback(false); callback(false);
} }
#endif #endif
} }
...@@ -117,7 +118,7 @@ public class CSJInterstitialUtil ...@@ -117,7 +118,7 @@ public class CSJInterstitialUtil
{ {
private AdEntity entity; private AdEntity entity;
private Action<bool> callback; private Action<bool> callback;
public InterstitialAdListener(AdEntity entity,Action<bool> callback) public InterstitialAdListener(AdEntity entity, Action<bool> callback)
{ {
this.entity = entity; this.entity = entity;
this.callback = callback; this.callback = callback;
...@@ -171,13 +172,15 @@ public class CSJInterstitialUtil ...@@ -171,13 +172,15 @@ public class CSJInterstitialUtil
{ {
private CSJInterstitialUtil example; private CSJInterstitialUtil example;
private Action<bool> callback; private Action<bool> callback;
private ZXADInterstitialListener listener;
private AdEntity entity; private AdEntity entity;
int type;//0:feed 1:banner 2:interstitial int type;//0:feed 1:banner 2:interstitial
public ExpressAdInteractionListener(CSJInterstitialUtil example,Action<bool> callback,AdEntity entity, int type) public ExpressAdInteractionListener(CSJInterstitialUtil example, ZXADInterstitialListener listener, Action<bool> callback, AdEntity entity, int type)
{ {
this.example = example; this.example = example;
this.callback = callback; this.callback = callback;
this.listener = listener;
this.entity = entity; this.entity = entity;
this.type = type; this.type = type;
} }
...@@ -191,6 +194,7 @@ public class CSJInterstitialUtil ...@@ -191,6 +194,7 @@ public class CSJInterstitialUtil
{ {
EventUtils.onEventShowSuccess(entity); EventUtils.onEventShowSuccess(entity);
Debug.Log("express OnAdShow,type:" + type); Debug.Log("express OnAdShow,type:" + type);
listener.onInterstitialAdShow();
} }
public void OnAdViewRenderError(ExpressAd ad, int code, string message) public void OnAdViewRenderError(ExpressAd ad, int code, string message)
...@@ -198,6 +202,7 @@ public class CSJInterstitialUtil ...@@ -198,6 +202,7 @@ public class CSJInterstitialUtil
EventUtils.onEventShowFail(entity); EventUtils.onEventShowFail(entity);
Debug.Log("express OnAdViewRenderError,type:" + type); Debug.Log("express OnAdViewRenderError,type:" + type);
callback(false); callback(false);
listener.onInterstitialError("code " + code + " message " + message);
} }
public void OnAdViewRenderSucc(ExpressAd ad, float width, float height) public void OnAdViewRenderSucc(ExpressAd ad, float width, float height)
...@@ -209,6 +214,7 @@ public class CSJInterstitialUtil ...@@ -209,6 +214,7 @@ public class CSJInterstitialUtil
{ {
EventUtils.onEventAdComplete(entity); EventUtils.onEventAdComplete(entity);
Debug.Log("express OnAdClose,type:" + type); Debug.Log("express OnAdClose,type:" + type);
listener.onInterstitialClose();
} }
public void onAdRemoved(ExpressAd ad) public void onAdRemoved(ExpressAd ad)
......
...@@ -197,7 +197,25 @@ public class AdDemo : MonoBehaviour ...@@ -197,7 +197,25 @@ public class AdDemo : MonoBehaviour
public void OnClickPlayInterAd() public void OnClickPlayInterAd()
{ {
AdManager.Instance.PlayCacheInterstitialAd(Interstitial, "test"); AdManager.Instance.PlayCacheInterstitialAd(Interstitial, "test",new InterstitialAdListener());
}
private sealed class InterstitialAdListener : ZXADInterstitialListener
{
public void onInterstitialAdShow()
{
Debug.unityLogger.Log("onInterstitialAdShow");
}
public void onInterstitialClose()
{
Debug.unityLogger.Log("onInterstitialClose");
}
public void onInterstitialError(string errorMsg)
{
Debug.unityLogger.Log("onInterstitialError");
}
} }
public void OnClickLoadFullScreeVideoAd() public void OnClickLoadFullScreeVideoAd()
......
...@@ -39,7 +39,7 @@ public class GDTInterstitialAdUtil ...@@ -39,7 +39,7 @@ public class GDTInterstitialAdUtil
//string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id //string posId = Constants.intersititialNoVideoPosId;//不带视频的插屏广告测试Id
UnifiedInterstitialAd ad = new UnifiedInterstitialAd(entity.codeId); UnifiedInterstitialAd ad = new UnifiedInterstitialAd(entity.codeId);
ad.SetListener(new UnifiedInterstitialAdListener(entity,ad, callback)); ad.SetListener(new UnifiedInterstitialAdListener(entity,ad,null, callback));
ad.LoadAd(); ad.LoadAd();
} }
...@@ -47,12 +47,12 @@ public class GDTInterstitialAdUtil ...@@ -47,12 +47,12 @@ public class GDTInterstitialAdUtil
/// 播放缓存的插屏广告 /// 播放缓存的插屏广告
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
public void PlayCacheInterstitialAd(AdEntity entity,Action<bool> callback) public void PlayCacheInterstitialAd(AdEntity entity,Action<bool> callback,ZXADInterstitialListener listener)
{ {
if (interstitialAdCacheList.Count > 0) if (interstitialAdCacheList.Count > 0)
{ {
UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue(); UnifiedInterstitialAd interAd = interstitialAdCacheList.Dequeue();
interAd.SetListener(new UnifiedInterstitialAdListener(entity,interAd, callback)); interAd.SetListener(new UnifiedInterstitialAdListener(entity,interAd, listener, callback));
interAd.Show(); interAd.Show();
} }
else else
...@@ -71,11 +71,13 @@ public class GDTInterstitialAdUtil ...@@ -71,11 +71,13 @@ public class GDTInterstitialAdUtil
{ {
private AdEntity entity; private AdEntity entity;
private UnifiedInterstitialAd ad; private UnifiedInterstitialAd ad;
private ZXADInterstitialListener listener;
private Action<bool> callback; private Action<bool> callback;
public UnifiedInterstitialAdListener(AdEntity entity,UnifiedInterstitialAd ad, Action<bool> callback) public UnifiedInterstitialAdListener(AdEntity entity,UnifiedInterstitialAd ad, ZXADInterstitialListener listener, Action<bool> callback)
{ {
this.entity = entity; this.entity = entity;
this.ad = ad; this.ad = ad;
this.listener = listener;
this.callback = callback; this.callback = callback;
} }
...@@ -112,6 +114,10 @@ public class GDTInterstitialAdUtil ...@@ -112,6 +114,10 @@ public class GDTInterstitialAdUtil
public void OnAdExposured() public void OnAdExposured()
{ {
callback(true); callback(true);
if (listener != null)
{
listener.onInterstitialAdShow();
}
} }
/// <summary> /// <summary>
...@@ -135,7 +141,10 @@ public class GDTInterstitialAdUtil ...@@ -135,7 +141,10 @@ public class GDTInterstitialAdUtil
/// </summary> /// </summary>
public void OnAdClosed() public void OnAdClosed()
{ {
if (listener != null)
{
listener.onInterstitialClose();
}
} }
#if UNITY_ANDROID #if UNITY_ANDROID
...@@ -195,6 +204,10 @@ public class GDTInterstitialAdUtil ...@@ -195,6 +204,10 @@ public class GDTInterstitialAdUtil
public void OnVideoError() public void OnVideoError()
{ {
EventUtils.onEventShowFail(entity); EventUtils.onEventShowFail(entity);
if (listener != null)
{
listener.onInterstitialError("GDT 插屏播放时出现错误");
}
} }
/// <summary> /// <summary>
......
...@@ -208,10 +208,10 @@ public class KsDemo : MonoBehaviour ...@@ -208,10 +208,10 @@ public class KsDemo : MonoBehaviour
entity.codeGroup = "A"; entity.codeGroup = "A";
entity.slotName = "Tessss"; entity.slotName = "Tessss";
#if UNITY_ANDROID #if UNITY_ANDROID
KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, new Action<bool>((cb) => { //KsInterstitialAdUtils.Instance.PlayCacheInterstitialAd(entity, new Action<bool>((cb) => {
})); //}));
#endif #endif
} }
} }
...@@ -41,13 +41,13 @@ public class KsInterstitialAdUtils ...@@ -41,13 +41,13 @@ public class KsInterstitialAdUtils
/// 播放缓存的插屏广告 /// 播放缓存的插屏广告
/// </summary> /// </summary>
/// <param name="entity"></param> /// <param name="entity"></param>
public void PlayCacheInterstitialAd(AdEntity entity, Action<bool> callback) public void PlayCacheInterstitialAd(AdEntity entity, Action<bool> callback, ZXADInterstitialListener listener)
{ {
if (interstitialAdCacheList.Count > 0) if (interstitialAdCacheList.Count > 0)
{ {
Debug.unityLogger.Log("KS 插屏广告没有缓存数据了"+ interstitialAdCacheList.Count); Debug.unityLogger.Log("KS 插屏广告没有缓存数据了"+ interstitialAdCacheList.Count);
KsInterstitialAd interAd = interstitialAdCacheList.Dequeue(); KsInterstitialAd interAd = interstitialAdCacheList.Dequeue();
interAd.SetPlayListener(new KsInterstitialPlayAdListener(callback, entity)); interAd.SetPlayListener(new KsInterstitialPlayAdListener(callback, listener, entity));
interAd.ShowKsIntetstitialAd(); interAd.ShowKsIntetstitialAd();
} }
else else
...@@ -86,11 +86,13 @@ public class KsInterstitialAdUtils ...@@ -86,11 +86,13 @@ public class KsInterstitialAdUtils
private sealed class KsInterstitialPlayAdListener : IKsUnityInterstitialPlayListener private sealed class KsInterstitialPlayAdListener : IKsUnityInterstitialPlayListener
{ {
private Action<bool> callback; private Action<bool> callback;
private ZXADInterstitialListener listener;
private AdEntity entity; private AdEntity entity;
public KsInterstitialPlayAdListener(Action<bool> callback, AdEntity entity) public KsInterstitialPlayAdListener(Action<bool> callback, ZXADInterstitialListener listener, AdEntity entity)
{ {
this.callback = callback; this.callback = callback;
this.listener = listener;
this.entity = entity; this.entity = entity;
} }
public void onAdClicked() public void onAdClicked()
...@@ -100,12 +102,13 @@ public class KsInterstitialAdUtils ...@@ -100,12 +102,13 @@ public class KsInterstitialAdUtils
public void onAdClosed() public void onAdClosed()
{ {
listener.onInterstitialClose();
} }
public void onAdShow() public void onAdShow()
{ {
EventUtils.onEventShowSuccess(entity); EventUtils.onEventShowSuccess(entity);
listener.onInterstitialAdShow();
} }
public void onPageDismiss() public void onPageDismiss()
...@@ -127,6 +130,7 @@ public class KsInterstitialAdUtils ...@@ -127,6 +130,7 @@ public class KsInterstitialAdUtils
{ {
EventUtils.onEventShowFail(entity); EventUtils.onEventShowFail(entity);
callback(false); callback(false);
listener.onInterstitialError("code"+ code+"msg"+msg);
} }
public void onVideoPlayStart() public void onVideoPlayStart()
......
...@@ -53,5 +53,20 @@ ...@@ -53,5 +53,20 @@
</intent-filter> </intent-filter>
</activity> </activity>
<!-- WebView --> <!-- WebView -->
<provider
android:name="com.bytedance.sdk.openadsdk.TTFileProvider"
android:authorities="${applicationId}.TTFileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<provider
android:name="com.bytedance.sdk.openadsdk.multipro.TTMultiProvider"
android:authorities="${applicationId}.TTMultiProvider"
android:exported="false" />
</application> </application>
</manifest> </manifest>
...@@ -24,14 +24,16 @@ public class CallingNativeMethods ...@@ -24,14 +24,16 @@ public class CallingNativeMethods
} }
return activity; return activity;
} }
#if UNITY_IOS
//判断微信是否安装 //判断微信是否安装
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern bool _isWechatInstalled(); private static extern bool _isWechatInstalled();
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _WechatLogin(string appid, string state, string universalLink); private static extern void _WechatLogin(string appid, string state, string universalLink);
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void ShowIOSWebView(string urlStr, string titleStr); private static extern void ShowIOSWebView(string urlStr, string titleStr);
#endif
/// <summary> /// <summary>
/// 注册初始化微信登录 /// 注册初始化微信登录
......
...@@ -371,19 +371,30 @@ public class UnityPhoneUtils { ...@@ -371,19 +371,30 @@ public class UnityPhoneUtils {
} }
public String getDeviceId(Context context) { public String getDeviceId(Context context) {
return getMd5Value(getAndroidID(context) + getImei(context)); return getMd5Value(getAndroidID(context) + getImei(context));
} }
public String getMd5Value(String sSecret) { public String getMd5Value(String sSecret) {
try { try {
MessageDigest bmd5 = MessageDigest.getInstance("MD5"); MessageDigest bmd5 = MessageDigest.getInstance("MD5");
bmd5.update(sSecret.getBytes()); bmd5.update(sSecret.getBytes());
int i=0;
StringBuffer buf = new StringBuffer();
byte[] b = bmd5.digest();
for (int j=0;j<b.length;j++){
i = Integer.parseInt(b[j]+"");
if (i < 0)
i += 256;
if (i < 16)
buf.append("0");
buf.append(Integer.toHexString(i));
}
return buf.toString();
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return "";
} }
return "";
} }
public String getImei(Context context) { public String getImei(Context context) {
......
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using AOT; using AOT;
using UnityEngine; using UnityEngine;
public class UnityPhoneUtils public class UnityPhoneUtils
{ {
private UnityPhoneUtils() { } private UnityPhoneUtils() { }
private static readonly UnityPhoneUtils singleInstance = new UnityPhoneUtils(); private static readonly UnityPhoneUtils singleInstance = new UnityPhoneUtils();
public static UnityPhoneUtils Instance public static UnityPhoneUtils Instance
{ {
get get
{ {
return singleInstance; return singleInstance;
} }
} }
private AndroidJavaObject activity; private AndroidJavaObject activity;
public AndroidJavaObject GetActivity() public AndroidJavaObject GetActivity()
{ {
if (activity == null) if (activity == null)
{ {
var unityPlayer = new AndroidJavaClass( var unityPlayer = new AndroidJavaClass(
"com.unity3d.player.UnityPlayer"); "com.unity3d.player.UnityPlayer");
activity = unityPlayer.GetStatic<AndroidJavaObject>( activity = unityPlayer.GetStatic<AndroidJavaObject>(
"currentActivity"); "currentActivity");
} }
return activity; return activity;
} }
private AndroidJavaObject phoneUtil; private AndroidJavaObject phoneUtil;
private AndroidJavaObject GetPhoneUtil() private AndroidJavaObject GetPhoneUtil()
{ {
if (phoneUtil == null) if (phoneUtil == null)
{ {
phoneUtil = new AndroidJavaClass("com.ym.common.UnityPhoneUtils").CallStatic<AndroidJavaObject>("getInstance"); phoneUtil = new AndroidJavaClass("com.ym.common.UnityPhoneUtils").CallStatic<AndroidJavaObject>("getInstance");
} }
return phoneUtil; return phoneUtil;
} }
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ResultHandler(string device, string IDFA); public delegate void ResultHandler(string device, string IDFA);
[MonoPInvokeCallback(typeof(ResultHandler))] [MonoPInvokeCallback(typeof(ResultHandler))]
static void resultHandler(string deviceStr, string IDFAStr) static void resultHandler(string deviceStr, string IDFAStr)
{ {
Debug.Log("resultHandler : deviceStr = " + deviceStr + "IDFAStr = " + IDFAStr); Debug.Log("resultHandler : deviceStr = " + deviceStr + "IDFAStr = " + IDFAStr);
Constant.Instance.device = deviceStr; Constant.Instance.device = deviceStr;
Constant.Instance.idfa = IDFAStr; Constant.Instance.idfa = IDFAStr;
} }
#if UNITY_IOS
[DllImport("__Internal")] [DllImport("__Internal")]
static extern void BridageDeviceAndIDFA(IntPtr resultHandler); static extern void BridageDeviceAndIDFA(IntPtr resultHandler);
#endif
public void Handler()
{ public void Handler()
ResultHandler handler = new ResultHandler(resultHandler); {
IntPtr fp = Marshal.GetFunctionPointerForDelegate(handler); ResultHandler handler = new ResultHandler(resultHandler);
BridageDeviceAndIDFA(fp); IntPtr fp = Marshal.GetFunctionPointerForDelegate(handler);
} #if UNITY_IOS
BridageDeviceAndIDFA(fp);
public string GetImsi() #endif
{
string imsi = ""; }
#if UNITY_EDITOR
Debug.unityLogger.Log("GetImsi"); public string GetImsi()
#elif UNITY_ANDROID {
imsi = GetPhoneUtil().Call<string>("getIMSI", GetActivity()); string imsi = "";
#elif UNITY_IOS #if UNITY_EDITOR
Debug.unityLogger.Log("GetImsi");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetImsi " + imsi); imsi = GetPhoneUtil().Call<string>("getIMSI", GetActivity());
return imsi; #elif UNITY_IOS
}
public string GetImei() #endif
{ Debug.unityLogger.Log("GetImsi " + imsi);
string imei = ""; return imsi;
#if UNITY_EDITOR }
Debug.unityLogger.Log("GetImei"); public string GetImei()
#elif UNITY_ANDROID {
imei = GetPhoneUtil().Call<string>("getImei", GetActivity()); string imei = "";
#elif UNITY_IOS #if UNITY_EDITOR
Debug.unityLogger.Log("GetImei");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetImsi " + imei); imei = GetPhoneUtil().Call<string>("getImei", GetActivity());
return imei; #elif UNITY_IOS
}
#endif
public string getMac() Debug.unityLogger.Log("GetImsi " + imei);
{ return imei;
string mac = ""; }
#if UNITY_EDITOR
Debug.unityLogger.Log("getMac"); public string getMac()
#elif UNITY_ANDROID {
mac = GetPhoneUtil().Call<string>("getMac", GetActivity()); string mac = "";
#elif UNITY_IOS #if UNITY_EDITOR
Debug.unityLogger.Log("getMac");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("getMac " + mac); mac = GetPhoneUtil().Call<string>("getMac", GetActivity());
return mac; #elif UNITY_IOS
}
#endif
/// <summary> Debug.unityLogger.Log("getMac " + mac);
/// 获取uuid 随机字符串保存下来 每次重新安装生成新的随机数 用来判断安装次数 return mac;
/// </summary> }
/// <returns></returns>
public string GetUUID() /// <summary>
{ /// 获取uuid 随机字符串保存下来 每次重新安装生成新的随机数 用来判断安装次数
string uuid = PlayerPrefs.GetString("app_uuid", ""); /// </summary>
/// <returns></returns>
if (uuid.Equals("")) public string GetUUID()
{ {
#if UNITY_EDITOR string uuid = PlayerPrefs.GetString("app_uuid", "");
uuid = "";
#elif UNITY_ANDROID if (uuid.Equals(""))
uuid = GetPhoneUtil().Call<string>("getUUID"); {
#elif UNITY_IOS #if UNITY_EDITOR
uuid = "";
#endif #elif UNITY_ANDROID
PlayerPrefs.SetString("app_uuid", uuid); uuid = GetPhoneUtil().Call<string>("getUUID");
} #elif UNITY_IOS
Debug.unityLogger.Log("GetUUID " + uuid);
return uuid; #endif
} PlayerPrefs.SetString("app_uuid", uuid);
}
/// <summary> Debug.unityLogger.Log("GetUUID " + uuid);
/// 获取IP地址 return uuid;
/// </summary> }
/// <param name="isIpv4">是否使用IPV4</param>
/// <returns></returns> /// <summary>
public string GetIP(bool isIpv4) /// 获取IP地址
{ /// </summary>
string ip = ""; /// <param name="isIpv4">是否使用IPV4</param>
/// <returns></returns>
#if UNITY_EDITOR public string GetIP(bool isIpv4)
Debug.unityLogger.Log("GetIP"); {
#elif UNITY_ANDROID string ip = "";
ip=GetPhoneUtil().Call<string>("getIPAddress",isIpv4);
#elif UNITY_IOS #if UNITY_EDITOR
Debug.unityLogger.Log("GetIP");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetIP " + ip); ip=GetPhoneUtil().Call<string>("getIPAddress",isIpv4);
return ip; #elif UNITY_IOS
}
#endif
public string GetSVN() Debug.unityLogger.Log("GetIP " + ip);
{ return ip;
string svn = ""; }
#if UNITY_EDITOR public string GetSVN()
Debug.unityLogger.Log("GetSVN"); {
#elif UNITY_ANDROID string svn = "";
svn = GetPhoneUtil().Call<string>("getSVN");
#elif UNITY_IOS #if UNITY_EDITOR
svn = ""; Debug.unityLogger.Log("GetSVN");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetSVN " + svn); svn = GetPhoneUtil().Call<string>("getSVN");
return svn; #elif UNITY_IOS
} svn = "";
#endif
public string GetNTT() Debug.unityLogger.Log("GetSVN " + svn);
{ return svn;
string ntt = ""; }
#if UNITY_EDITOR
Debug.unityLogger.Log("GetNTT"); public string GetNTT()
#elif UNITY_ANDROID {
ntt = GetPhoneUtil().Call<string>("getNetwork",GetActivity()); string ntt = "";
#elif UNITY_IOS #if UNITY_EDITOR
ntt = "4G"; Debug.unityLogger.Log("GetNTT");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetNTT " + ntt); ntt = GetPhoneUtil().Call<string>("getNetwork",GetActivity());
return ntt; #elif UNITY_IOS
} ntt = "4G";
#endif
public string GetCarrier() Debug.unityLogger.Log("GetNTT " + ntt);
{ return ntt;
string carrier = ""; }
#if UNITY_EDITOR
Debug.unityLogger.Log("GetCarrier"); public string GetCarrier()
#elif UNITY_ANDROID {
carrier = GetPhoneUtil().Call<string>("getOperator", GetActivity()); string carrier = "";
#elif UNITY_IOS #if UNITY_EDITOR
carrier = ""; Debug.unityLogger.Log("GetCarrier");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetCarrier " + carrier); carrier = GetPhoneUtil().Call<string>("getOperator", GetActivity());
return carrier; #elif UNITY_IOS
} carrier = "";
#endif
/// <summary> Debug.unityLogger.Log("GetCarrier " + carrier);
/// 张哲注意了 实时改 return carrier;
/// </summary> }
/// <returns></returns>
public string GetVC() /// <summary>
{ /// 张哲注意了 实时改
string vc = ""; /// </summary>
/// <returns></returns>
#if UNITY_EDITOR public string GetVC()
Debug.unityLogger.Log("GetVC"); {
#elif UNITY_ANDROID string vc = "";
vc = GetPhoneUtil().Call<int>("getAppVersionCode", GetActivity())+"";
#elif UNITY_IOS #if UNITY_EDITOR
Debug.unityLogger.Log("GetVC");
vc = "1"; #elif UNITY_ANDROID
#endif vc = GetPhoneUtil().Call<int>("getAppVersionCode", GetActivity())+"";
Debug.unityLogger.Log("GetVC " + vc); #elif UNITY_IOS
return vc;
} vc = "1";
#endif
public string GetVN() Debug.unityLogger.Log("GetVC " + vc);
{ return vc;
string vn = ""; }
#if UNITY_EDITOR public string GetVN()
Debug.unityLogger.Log("GetVN"); {
#elif UNITY_ANDROID string vn = "";
vn = GetPhoneUtil().Call<string>("getAppVersionName", GetActivity());
#elif UNITY_IOS #if UNITY_EDITOR
vn = Application.version; Debug.unityLogger.Log("GetVN");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetVN " + vn); vn = GetPhoneUtil().Call<string>("getAppVersionName", GetActivity());
return vn; #elif UNITY_IOS
} vn = Application.version;
#endif
public string GetAid() Debug.unityLogger.Log("GetVN " + vn);
{ return vn;
string aid = PlayerPrefs.GetString("app_aid", ""); }
if (aid.Equals("")) public string GetAid()
{ {
#if UNITY_EDITOR string aid = PlayerPrefs.GetString("app_aid", "");
aid = "";
#elif UNITY_ANDROID if (aid.Equals(""))
aid = GetPhoneUtil().Call<string>("getAndroidID", GetActivity()); {
#elif UNITY_IOS #if UNITY_EDITOR
aid = "";
#endif #elif UNITY_ANDROID
PlayerPrefs.SetString("app_aid", aid); aid = GetPhoneUtil().Call<string>("getAndroidID", GetActivity());
} #elif UNITY_IOS
Debug.unityLogger.Log("GetAid " + aid);
return aid; #endif
} PlayerPrefs.SetString("app_aid", aid);
}
public string GetDevice() Debug.unityLogger.Log("GetAid " + aid);
{ return aid;
string device = PlayerPrefs.GetString("user_device", ""); }
if (device.Equals(""))
{ public string GetDevice()
#if UNITY_EDITOR {
device = "debug_test_001"; string device = PlayerPrefs.GetString("user_device", "");
#elif UNITY_ANDROID if (device.Equals(""))
device = GetPhoneUtil().Call<string>("getAndroidID", GetActivity()); {
#elif UNITY_IOS #if UNITY_EDITOR
device = "debug_test_001";
device = Constant.Instance.device; #elif UNITY_ANDROID
device = GetPhoneUtil().Call<string>("getDeviceId", GetActivity());
#endif #elif UNITY_IOS
PlayerPrefs.SetString("user_device", device); device = Constant.Instance.device;
}
Debug.unityLogger.Log("GetDevice " + device); #endif
return device;
} PlayerPrefs.SetString("user_device", device);
}
/// <summary> Debug.unityLogger.Log("GetDevice " + device);
/// umeng渠道 return device;
/// </summary> }
/// <returns></returns>
public string GetSource() /// <summary>
{ /// umeng渠道
string channel = ""; /// </summary>
#if UNITY_EDITOR /// <returns></returns>
Debug.unityLogger.Log("GetSource"); public string GetSource()
#elif UNITY_ANDROID {
channel = GetPhoneUtil().Call<string>("getChannel", GetActivity()); string channel = "";
#elif UNITY_IOS #if UNITY_EDITOR
channel = "AppStore"; Debug.unityLogger.Log("GetSource");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetSource " + channel); channel = GetPhoneUtil().Call<string>("getChannel", GetActivity());
return channel; #elif UNITY_IOS
} channel = "AppStore";
#endif
/// <summary> Debug.unityLogger.Log("GetSource " + channel);
/// 浏览器类型 return channel;
/// </summary> }
/// <returns></returns>
public string GetUA() /// <summary>
{ /// 浏览器类型
string ua = ""; /// </summary>
#if UNITY_EDITOR /// <returns></returns>
Debug.unityLogger.Log("GetUA"); public string GetUA()
#elif UNITY_ANDROID {
ua = GetPhoneUtil().Call<string>("getUserAgent", GetActivity()); string ua = "";
#elif UNITY_IOS #if UNITY_EDITOR
ua = ""; Debug.unityLogger.Log("GetUA");
#endif #elif UNITY_ANDROID
Debug.unityLogger.Log("GetUA " + ua); ua = GetPhoneUtil().Call<string>("getUserAgent", GetActivity());
return ua; #elif UNITY_IOS
} ua = "";
#endif
/// <summary> Debug.unityLogger.Log("GetUA " + ua);
/// IDFA return ua;
/// </summary> }
/// <returns></returns>
public string GetIDFA() /// <summary>
{ /// IDFA
string idfaStr = ""; /// </summary>
#if UNITY_EDITOR /// <returns></returns>
Debug.unityLogger.Log("GetIDFA"); public string GetIDFA()
#elif UNITY_ANDROID {
idfaStr =""; string idfaStr = "";
#elif UNITY_IOS #if UNITY_EDITOR
Debug.unityLogger.Log("GetIDFA");
idfaStr = Constant.Instance.idfa; #elif UNITY_ANDROID
idfaStr ="";
#endif #elif UNITY_IOS
Debug.unityLogger.Log("GetIDFA " + idfaStr); idfaStr = Constant.Instance.idfa;
return idfaStr;
} #endif
}
Debug.unityLogger.Log("GetIDFA " + idfaStr);
return idfaStr;
}
}
...@@ -41,6 +41,12 @@ PlayerSettings: ...@@ -41,6 +41,12 @@ PlayerSettings:
height: 1 height: 1
m_SplashScreenLogos: [] m_SplashScreenLogos: []
m_VirtualRealitySplashScreen: {fileID: 0} m_VirtualRealitySplashScreen: {fileID: 0}
m_ShowUnitySplashAds: 0
m_AdsAndroidGameId:
m_AdsIosGameId:
m_ShowSplashAdsSlogan: 0
m_SloganImage: {fileID: 0}
m_SloganHeight: 150
m_HolographicTrackingLossScreen: {fileID: 0} m_HolographicTrackingLossScreen: {fileID: 0}
defaultScreenWidth: 1920 defaultScreenWidth: 1920
defaultScreenHeight: 1080 defaultScreenHeight: 1080
...@@ -118,13 +124,14 @@ PlayerSettings: ...@@ -118,13 +124,14 @@ PlayerSettings:
vulkanNumSwapchainBuffers: 3 vulkanNumSwapchainBuffers: 3
vulkanEnableSetSRGBWrite: 0 vulkanEnableSetSRGBWrite: 0
vulkanEnableLateAcquireNextImage: 0 vulkanEnableLateAcquireNextImage: 0
useSecurityBuild: 0
m_SupportedAspectRatios: m_SupportedAspectRatios:
4:3: 1 4:3: 1
5:4: 1 5:4: 1
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.0.7 bundleVersion: 1.0.0
preloadedAssets: [] preloadedAssets: []
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
...@@ -168,7 +175,7 @@ PlayerSettings: ...@@ -168,7 +175,7 @@ PlayerSettings:
androidSupportedAspectRatio: 1 androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
applicationIdentifier: applicationIdentifier:
Android: com.ym.wdlc Android: com.ym.chxxx
Lumin: com.DefaultCompany.com.unity.template.mobile2D Lumin: com.DefaultCompany.com.unity.template.mobile2D
Standalone: com.DefaultCompany.com.unity.template.mobile2D Standalone: com.DefaultCompany.com.unity.template.mobile2D
iPhone: com.ym.iosawpdd iPhone: com.ym.iosawpdd
...@@ -177,7 +184,7 @@ PlayerSettings: ...@@ -177,7 +184,7 @@ PlayerSettings:
Standalone: 0 Standalone: 0
iPhone: 0 iPhone: 0
tvOS: 0 tvOS: 0
AndroidBundleVersionCode: 8 AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 21 AndroidMinSdkVersion: 21
AndroidTargetSdkVersion: 0 AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1
...@@ -263,7 +270,7 @@ PlayerSettings: ...@@ -263,7 +270,7 @@ PlayerSettings:
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
...@@ -366,6 +373,7 @@ PlayerSettings: ...@@ -366,6 +373,7 @@ PlayerSettings:
m_Kind: 2 m_Kind: 2
m_SubKind: m_SubKind:
m_BuildTargetBatching: [] m_BuildTargetBatching: []
m_BuildTargetEncrypting: []
m_BuildTargetGraphicsJobs: m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport - m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 0 m_GraphicsJobs: 0
...@@ -647,7 +655,7 @@ PlayerSettings: ...@@ -647,7 +655,7 @@ PlayerSettings:
scriptingDefineSymbols: {} scriptingDefineSymbols: {}
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: scriptingBackend:
Android: 0 Android: 1
il2cppCompilerConfiguration: {} il2cppCompilerConfiguration: {}
managedStrippingLevel: {} managedStrippingLevel: {}
incrementalIl2cppBuild: {} incrementalIl2cppBuild: {}
......
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