2025-09-01 05:59:06 +00:00
|
|
|
|
using System;
|
2025-08-31 08:42:48 +00:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
2025-09-18 13:49:57 +00:00
|
|
|
|
using System.Linq;
|
2025-09-02 09:36:19 +00:00
|
|
|
|
using AdjustSdk;
|
2025-09-05 09:58:34 +00:00
|
|
|
|
using AnyThinkAds.ThirdParty.LitJson;
|
2025-09-01 08:27:45 +00:00
|
|
|
|
using Firebase.RemoteConfig;
|
2025-09-02 10:06:58 +00:00
|
|
|
|
using GoogleMobileAds.Api;
|
2025-09-01 09:57:19 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2025-09-02 09:36:19 +00:00
|
|
|
|
using ThinkingAnalytics;
|
2025-09-05 09:58:34 +00:00
|
|
|
|
using ThinkingData.Analytics;
|
2025-08-31 08:42:48 +00:00
|
|
|
|
using UnityEngine;
|
2025-09-18 04:13:45 +00:00
|
|
|
|
#if UNITY_PURCHASE
|
|
|
|
|
|
using UnityEngine.Purchasing;
|
|
|
|
|
|
#endif
|
2025-09-01 10:32:50 +00:00
|
|
|
|
using WZ;
|
2025-08-31 08:42:48 +00:00
|
|
|
|
|
2025-09-08 05:37:51 +00:00
|
|
|
|
public class RushSDKManager : D_MonoSingleton<RushSDKManager>
|
2025-09-03 08:12:41 +00:00
|
|
|
|
{
|
2026-01-07 09:48:24 +00:00
|
|
|
|
#region vpn
|
|
|
|
|
|
public void StartAdInitialization(bool afterLoading,int level)
|
|
|
|
|
|
{
|
|
|
|
|
|
TransferManager.Instance.StartAdInitialization(afterLoading, level);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2026-01-07 08:02:54 +00:00
|
|
|
|
#region Loading events
|
|
|
|
|
|
private float _loadingStartTime;
|
|
|
|
|
|
private float _loadingEndTime;
|
|
|
|
|
|
public void StartLoading()
|
|
|
|
|
|
{
|
|
|
|
|
|
_loadingStartTime = Time.time;
|
|
|
|
|
|
Invoke(nameof(SendLoadingStartEvent),15);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void LoadingEnd()
|
|
|
|
|
|
{
|
|
|
|
|
|
_loadingEndTime = Time.time - _loadingStartTime;
|
|
|
|
|
|
Invoke(nameof(SendLoadingEndEvent),15);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void SendLoadingStartEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
LogEvent("loading_show");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SendLoadingEndEvent()
|
|
|
|
|
|
{
|
|
|
|
|
|
LogEvent("loading_end","pass_time",(int)_loadingEndTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2025-09-18 03:25:52 +00:00
|
|
|
|
|
|
|
|
|
|
public static string GetSDKVersion()
|
|
|
|
|
|
{
|
2026-01-06 03:04:34 +00:00
|
|
|
|
return "1.0.0";
|
2025-09-18 03:25:52 +00:00
|
|
|
|
}
|
2025-09-10 12:23:01 +00:00
|
|
|
|
protected override void Initialized()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Initialized();
|
|
|
|
|
|
FileParse.Parse();
|
|
|
|
|
|
}
|
2025-09-08 08:36:59 +00:00
|
|
|
|
public void InitializeSdk(Action action, bool showLog)
|
2025-08-31 08:42:48 +00:00
|
|
|
|
{
|
2025-09-02 08:13:06 +00:00
|
|
|
|
LoggerUtils.Enabled = showLog;
|
2025-09-18 13:49:57 +00:00
|
|
|
|
#if UNITY_PURCHASE
|
|
|
|
|
|
IAPPurchaseManager.Instance.PreInitialize();
|
|
|
|
|
|
#endif
|
2025-11-03 07:58:12 +00:00
|
|
|
|
AdsSplashManager.Instance.SetSplashAdCloseCallback(action);
|
2025-09-02 00:58:55 +00:00
|
|
|
|
FireBaseSDKManager.Instance.Init();
|
2025-09-04 06:24:18 +00:00
|
|
|
|
ShuShuMangage.Instance.Init();
|
2025-08-31 08:42:48 +00:00
|
|
|
|
AdjustManager.Instance.Init();
|
2026-01-06 03:04:34 +00:00
|
|
|
|
|
2025-09-18 13:49:57 +00:00
|
|
|
|
#if UNITY_PURCHASE
|
|
|
|
|
|
IAPPurchaseManager.Instance.Initialize();
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-08-31 08:42:48 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-18 04:13:45 +00:00
|
|
|
|
#if UNITY_PURCHASE
|
|
|
|
|
|
#region 支付
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 初始化回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Action<bool, string> OnPurchaseInitComplete;
|
|
|
|
|
|
public void RegisterPurchaseInitHandler(Action<bool,string> _action)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnPurchaseInitComplete = _action;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取 AppStore/Google Play 上所有配置的商品;
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="_action">返回所有商品信息</param>
|
|
|
|
|
|
/// ex:
|
|
|
|
|
|
/// Product[0].metadata.localizedTitle
|
|
|
|
|
|
/// Product[0].metadata.localizedPriceString
|
|
|
|
|
|
/// Product[0].metadata.localizedDescription
|
|
|
|
|
|
/// Product[0].metadata.isoCurrencyCode
|
|
|
|
|
|
public Action<Product[]> OnGetProductsInfo;
|
|
|
|
|
|
public void RegisterProductsInfoHandler(Action<Product[]> _action)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnGetProductsInfo += _action;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-18 10:30:57 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 支付回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Action<PurchaseInfo> OnPurchaseComplete;
|
|
|
|
|
|
public void RegisterPurchaseCompletionHandler(Action<PurchaseInfo> _action)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnPurchaseComplete = _action;
|
|
|
|
|
|
}
|
2025-09-18 13:49:57 +00:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 订阅查询回调
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Action<string, SubscribeInfo> OnSubscriptionQueriedByProductId;
|
|
|
|
|
|
public void QuerySubscriptionDataByProductId(string _pID,Action<string,SubscribeInfo> _action)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnSubscriptionQueriedByProductId = _action;
|
|
|
|
|
|
IAPSubscribeManager.Instance.CheckSubscribeDataByProductId(_pID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取商品价格
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="_pID"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public string GetProductPriceByID(string _pID)
|
|
|
|
|
|
{
|
|
|
|
|
|
return IAPPurchaseManager.Instance.GetProductPriceByID(_pID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取商品信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pID"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public Product GetProductInfoByID(string _pID)
|
|
|
|
|
|
{
|
|
|
|
|
|
return IAPPurchaseManager.Instance.GetProductInfoByID(_pID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 动态添加商品ID
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="_products">Product IDs</param>
|
|
|
|
|
|
public void AddProductsDynamic(Dictionary<string, ProductType> _products,Action<bool, string> _onProductsResult = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
IAPPurchaseManager.Instance.AddProductsDynamic(_products,_onProductsResult);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 初始化前静态添加商品ID
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="_products">Product IDs</param>
|
|
|
|
|
|
public void AddProductsStatic(Dictionary<string, ProductType> _products)
|
|
|
|
|
|
{
|
|
|
|
|
|
IAPPurchaseManager.StaticProductDic = IAPPurchaseManager.StaticProductDic.Concat(_products).ToDictionary(postParK => postParK.Key, PostParV => PostParV.Value);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 点击购买方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="_productId"> 商品SKU </param>
|
|
|
|
|
|
/// <param name="_productName"> 商品名称 </param>
|
|
|
|
|
|
/// <param name="_gameExtraParam"> 游戏拓展参数 </param>
|
|
|
|
|
|
public void PurchaseProductById(string _productId, string _productName, string _gameExtraParam = "")
|
|
|
|
|
|
{
|
|
|
|
|
|
IAPPurchaseManager.Instance.BuyProductByID(_productId, _productName,_gameExtraParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 游戏下发奖励后上报
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="productName">商品名称</param>
|
|
|
|
|
|
/// <param name="productID">商品SKU ID</param>
|
|
|
|
|
|
/// <param name="orderID">订单ID</param>
|
|
|
|
|
|
/// <param name="gameExtra01">游戏拓展字段-购买商品数量</param>
|
|
|
|
|
|
/// <param name="gameExtra02">游戏拓展字段</param>
|
|
|
|
|
|
public void LogCheckingOrder(string _productName, string _productId, string _orderId, string gameExtra01, string gameExtra02)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
#if !UNITY_EDITOR
|
|
|
|
|
|
IAPOrderManager.Instance.RemoveVerifySuccessOrder(_orderId);
|
|
|
|
|
|
IAPPurchaseManager.Instance.DoConfirmPendingPurchaseByID(_productId);
|
|
|
|
|
|
IAPEvent.LogChecingOrderBySdk(_productName, _productId, _orderId, gameExtra01, gameExtra02);
|
|
|
|
|
|
#endif
|
|
|
|
|
|
}
|
2025-09-18 04:13:45 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
2025-09-15 10:37:40 +00:00
|
|
|
|
#region 买量用户回调
|
2025-09-18 04:13:45 +00:00
|
|
|
|
|
2025-09-15 10:37:40 +00:00
|
|
|
|
public Action<bool, string> OnUserSourceListener;
|
2025-09-01 11:10:21 +00:00
|
|
|
|
|
2025-09-15 10:37:40 +00:00
|
|
|
|
/// Adjust归因回调
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// <param name="is organic user">是否为买量用户</param>
|
|
|
|
|
|
/// <param name="adNetwork">adjust 返回的network字段</param>
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public void SetUserSourceListener(Action<bool, string> _action)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnUserSourceListener = _action;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2025-09-18 04:13:45 +00:00
|
|
|
|
|
2025-09-16 08:22:39 +00:00
|
|
|
|
#region 跳转谷歌评价
|
|
|
|
|
|
public void Review()
|
|
|
|
|
|
{
|
|
|
|
|
|
var httpsPlayGoogleComStoreAppsDetailsID = "https://play.google.com/store/apps/details?id=" + Application.identifier;
|
|
|
|
|
|
Application.OpenURL(httpsPlayGoogleComStoreAppsDetailsID);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2025-09-01 10:32:50 +00:00
|
|
|
|
|
2025-09-01 09:57:19 +00:00
|
|
|
|
#region ad
|
|
|
|
|
|
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 06:20:54 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 展示激励广告
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="position"></param>
|
|
|
|
|
|
/// <param name="callback"></param>
|
2025-09-15 10:37:40 +00:00
|
|
|
|
public void ShowRewardAd(string position, Action<bool, double> callback = null)
|
2025-09-01 15:21:18 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Rewarded, position);
|
2026-01-06 03:04:34 +00:00
|
|
|
|
|
|
|
|
|
|
var _platform = TransferAndroidClass.IsVpnConnected() ? PlatformType.Admob : PlatformType.Topon;
|
|
|
|
|
|
|
|
|
|
|
|
bool isRewardAdReady = AdsSDKManager.Instance.IsRewardAdReady(_platform);
|
|
|
|
|
|
|
2025-09-01 15:21:18 +00:00
|
|
|
|
if (isRewardAdReady)
|
|
|
|
|
|
{
|
|
|
|
|
|
AdsSDKManager.Instance.ShowRewardAd(position, (isReward, revenue) =>
|
|
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsSplashManager.Instance.backgroundTime = Time.realtimeSinceStartup;
|
2025-09-01 15:21:18 +00:00
|
|
|
|
if (isReward)
|
|
|
|
|
|
{
|
2025-09-02 06:20:54 +00:00
|
|
|
|
AdsSDKManager.Instance.ClearIvRules();
|
2025-09-01 15:21:18 +00:00
|
|
|
|
callback?.Invoke(true, revenue);
|
|
|
|
|
|
}
|
2025-09-02 06:20:54 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
callback?.Invoke(false, 0);
|
|
|
|
|
|
}
|
2026-01-06 03:04:34 +00:00
|
|
|
|
}, () =>
|
|
|
|
|
|
{
|
|
|
|
|
|
callback?.Invoke(false, 0);
|
|
|
|
|
|
},_platform);
|
2025-09-01 15:21:18 +00:00
|
|
|
|
}
|
2025-09-02 06:20:54 +00:00
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Rewarded, position, AdsShowFailType.NoFill);
|
2025-09-02 06:20:54 +00:00
|
|
|
|
callback?.Invoke(false, 0);
|
|
|
|
|
|
}
|
2025-09-01 15:21:18 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 06:20:54 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 展示插屏广告
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="position"></param>
|
|
|
|
|
|
/// <param name="ivadType"></param>
|
|
|
|
|
|
/// <param name="callback"></param>
|
2026-01-06 03:04:34 +00:00
|
|
|
|
public void ShowInterstitial(string position, IvType ivadType = IvType.IV1, Action<double> callback = null)
|
2025-09-01 05:59:06 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Interstitial, position);
|
2025-09-01 05:59:06 +00:00
|
|
|
|
//插屏展示逻辑
|
|
|
|
|
|
bool ivRulesShow = AdsSDKManager.Instance.IvRulesShow(ivadType);
|
2026-01-06 03:04:34 +00:00
|
|
|
|
var _platform = TransferAndroidClass.IsVpnConnected() ? PlatformType.Admob : PlatformType.Topon;
|
|
|
|
|
|
|
|
|
|
|
|
if (ivRulesShow)
|
2025-09-01 05:59:06 +00:00
|
|
|
|
{
|
|
|
|
|
|
//是否有缓存
|
2026-01-06 03:04:34 +00:00
|
|
|
|
bool isInterstitialReady = AdsSDKManager.Instance.IsInterstitialReady(_platform);
|
2025-09-01 05:59:06 +00:00
|
|
|
|
if (isInterstitialReady)
|
|
|
|
|
|
{
|
2025-09-01 14:14:33 +00:00
|
|
|
|
AdsSDKManager.Instance.ShowInterstitialAd(position, ivadType, (revenue) =>
|
2025-09-01 05:59:06 +00:00
|
|
|
|
{
|
|
|
|
|
|
//展示完一个插屏之后调用
|
2025-09-04 08:50:26 +00:00
|
|
|
|
IvRulesConst.OverLevels[ivadType.ToString()] = 1;
|
2025-09-02 06:20:54 +00:00
|
|
|
|
IvRulesConst.Intervals[ivadType.ToString()] = TimeUtils.GetLocalTimestamp();
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsSplashManager.Instance.backgroundTime = Time.realtimeSinceStartup;
|
2025-09-02 06:20:54 +00:00
|
|
|
|
callback?.Invoke(revenue);
|
2026-01-06 03:04:34 +00:00
|
|
|
|
},_platform);
|
2025-09-01 05:59:06 +00:00
|
|
|
|
}
|
2025-09-01 14:14:33 +00:00
|
|
|
|
else
|
2025-09-15 10:37:40 +00:00
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Interstitial, position, AdsShowFailType.NoFill);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
callback?.Invoke(-1);
|
2025-09-01 14:14:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Interstitial, position, AdsShowFailType.RuleLimit);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
callback?.Invoke(-1);
|
2025-09-01 05:59:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-16 13:29:51 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="bannerType">banner样式,Standard:普通banner;Collapsible:可折叠banner</param>
|
|
|
|
|
|
/// <param name="bannerAlignType">banner位置,CenterBottom:底部居中;CenterTop:顶部居中</param>
|
|
|
|
|
|
public void ShowBanner(BannerType bannerType, BannerAlignType bannerAlignType)
|
2025-09-02 08:13:06 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Banner, "");
|
2025-09-16 13:29:51 +00:00
|
|
|
|
|
2026-01-06 03:04:34 +00:00
|
|
|
|
var _platform = TransferAndroidClass.IsVpnConnected() ? PlatformType.Admob : PlatformType.Topon;
|
|
|
|
|
|
if (AdsSDKManager.Instance.IsBannerAdReady(bannerType,_platform))
|
2025-09-05 02:15:32 +00:00
|
|
|
|
{
|
2026-01-06 03:04:34 +00:00
|
|
|
|
AdsSDKManager.Instance.ShowBanner(bannerType, bannerAlignType, _platform);
|
2025-09-03 11:58:43 +00:00
|
|
|
|
}
|
2025-09-05 02:15:32 +00:00
|
|
|
|
else
|
2025-09-15 10:37:40 +00:00
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Banner, "", AdsShowFailType.NoFill);
|
2025-09-05 02:15:32 +00:00
|
|
|
|
}
|
2025-09-02 08:13:06 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-16 13:29:51 +00:00
|
|
|
|
public void HideBanner(BannerType bannerType)
|
2025-09-02 08:13:06 +00:00
|
|
|
|
{
|
2025-09-16 13:29:51 +00:00
|
|
|
|
AdsSDKManager.Instance.HideBanner(bannerType);
|
2025-09-02 08:13:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-02 08:17:14 +00:00
|
|
|
|
public bool IsNativeFullReady()
|
|
|
|
|
|
{
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobFullNativeId;
|
|
|
|
|
|
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-18 08:45:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="rectTransform"></param>
|
|
|
|
|
|
/// <param name="pCom"></param>
|
|
|
|
|
|
/// <param name="position"></param>
|
|
|
|
|
|
/// <param name="nativeTemplateStyle"></param>
|
2025-09-18 07:03:56 +00:00
|
|
|
|
public void ShowFullNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
2025-09-02 08:17:14 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
if (!IsNativeFullReady())
|
|
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
|
|
|
|
|
AdsActionEvents.TrackAdFailToShow(AdsType.Native,
|
|
|
|
|
|
position,
|
|
|
|
|
|
PlatformType.Admob.ToString(),
|
|
|
|
|
|
"",
|
|
|
|
|
|
StaticValue.AdmobFullNativeId,
|
|
|
|
|
|
AdPlayCountManager.GetAdsActionCount(AdsType.Native,position+AdPlayCountManager.POS_SUFFIX),
|
|
|
|
|
|
NativeType.Full,
|
|
|
|
|
|
"-1",
|
|
|
|
|
|
AdsShowFailType.NoFill.ToString()
|
|
|
|
|
|
);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobFullNativeId;
|
2025-09-18 07:03:56 +00:00
|
|
|
|
|
|
|
|
|
|
if (nativeTemplateStyle == null)
|
2025-09-02 10:06:58 +00:00
|
|
|
|
{
|
2025-09-18 07:03:56 +00:00
|
|
|
|
nativeTemplateStyle = new NativeTemplateStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
TemplateId = NativeTemplateId.Medium,
|
|
|
|
|
|
MainBackgroundColor = Color.white
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2026-01-06 08:31:14 +00:00
|
|
|
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition,NativeType.Full);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
2025-09-08 08:36:59 +00:00
|
|
|
|
/// <summary>
|
2025-09-10 08:42:40 +00:00
|
|
|
|
/// 获取全屏Native广告价值
|
2025-09-08 08:36:59 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public double GetFullNativeRevenue()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsNativeFullReady())
|
|
|
|
|
|
{
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
var adUnitId = StaticValue.AdmobFullNativeId;
|
|
|
|
|
|
return AdsSDKManager.Instance.GetNativeAdRevenue(adUnitId);
|
|
|
|
|
|
}
|
2025-09-02 08:17:14 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
public void HideFullNative()
|
2025-09-02 08:17:14 +00:00
|
|
|
|
{
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobFullNativeId;
|
|
|
|
|
|
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsNativeReady()
|
|
|
|
|
|
{
|
|
|
|
|
|
var adUnitId = StaticValue.AdmobNativeId;
|
|
|
|
|
|
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-18 07:03:56 +00:00
|
|
|
|
public void ShowNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
2025-09-02 08:17:14 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
if (!IsNativeReady())
|
|
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
|
|
|
|
|
AdsActionEvents.TrackAdFailToShow(AdsType.Native,
|
|
|
|
|
|
position,
|
|
|
|
|
|
PlatformType.Admob.ToString(),
|
|
|
|
|
|
"",
|
|
|
|
|
|
StaticValue.AdmobNativeId,
|
|
|
|
|
|
AdPlayCountManager.GetAdsActionCount(AdsType.Native,position+AdPlayCountManager.POS_SUFFIX),
|
|
|
|
|
|
NativeType.Full,
|
|
|
|
|
|
"-1",
|
|
|
|
|
|
AdsShowFailType.NoFill.ToString()
|
|
|
|
|
|
);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-09-18 07:03:56 +00:00
|
|
|
|
|
|
|
|
|
|
if (nativeTemplateStyle == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
nativeTemplateStyle = new NativeTemplateStyle
|
|
|
|
|
|
{
|
2025-09-18 08:45:48 +00:00
|
|
|
|
//除了中型Native,其他的都是Small
|
2025-09-18 07:03:56 +00:00
|
|
|
|
TemplateId = NativeTemplateId.Small,
|
2025-09-18 08:45:48 +00:00
|
|
|
|
//背景颜色
|
2025-09-18 07:03:56 +00:00
|
|
|
|
MainBackgroundColor = Color.white
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobNativeId;
|
2025-09-18 07:03:56 +00:00
|
|
|
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2026-01-06 08:31:14 +00:00
|
|
|
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition,NativeType.Full);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HideNative()
|
|
|
|
|
|
{
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobNativeId;
|
|
|
|
|
|
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
public bool IsSmallNativeReady()
|
|
|
|
|
|
{
|
|
|
|
|
|
var adUnitId = StaticValue.AdmobSmallNativeId;
|
|
|
|
|
|
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-18 07:03:56 +00:00
|
|
|
|
public void ShowSmallNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
2025-09-02 10:06:58 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
if (!IsSmallNativeReady())
|
|
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
|
|
|
|
|
AdsActionEvents.TrackAdFailToShow(AdsType.Native,
|
|
|
|
|
|
position,
|
|
|
|
|
|
PlatformType.Admob.ToString(),
|
|
|
|
|
|
"",
|
|
|
|
|
|
StaticValue.AdmobSmallNativeId,
|
|
|
|
|
|
AdPlayCountManager.GetAdsActionCount(AdsType.Native,position+AdPlayCountManager.POS_SUFFIX),
|
|
|
|
|
|
NativeType.Small,
|
|
|
|
|
|
"-1",
|
|
|
|
|
|
AdsShowFailType.NoFill.ToString()
|
|
|
|
|
|
);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-09-18 07:03:56 +00:00
|
|
|
|
|
|
|
|
|
|
if (nativeTemplateStyle == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
nativeTemplateStyle = new NativeTemplateStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
TemplateId = NativeTemplateId.Small,
|
|
|
|
|
|
MainBackgroundColor = Color.white
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobSmallNativeId;
|
2025-09-18 07:03:56 +00:00
|
|
|
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2026-01-06 08:31:14 +00:00
|
|
|
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition,NativeType.Small);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HideSmallNative()
|
|
|
|
|
|
{
|
|
|
|
|
|
var adUnitId = StaticValue.AdmobSmallNativeId;
|
|
|
|
|
|
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
public bool IsMinddleNativeReady()
|
|
|
|
|
|
{
|
|
|
|
|
|
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
|
|
|
|
|
return AdsSDKManager.Instance.IsNativeAdReady(adUnitId);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-18 07:03:56 +00:00
|
|
|
|
public void ShowMinddleNative(RectTransform rectTransform, Camera pCom = null, string position = "", NativeTemplateStyle nativeTemplateStyle = null)
|
2025-09-02 10:06:58 +00:00
|
|
|
|
{
|
2025-09-03 11:58:43 +00:00
|
|
|
|
AdsActionEvents.TrackAdPosition(AdsType.Native, position);
|
2025-09-05 10:09:55 +00:00
|
|
|
|
if (!IsMinddleNativeReady())
|
2025-09-02 10:06:58 +00:00
|
|
|
|
{
|
2026-01-06 08:31:14 +00:00
|
|
|
|
//AdsActionEvents.TrackAdFailToShow(AdsType.Native, position, AdsShowFailType.NoFill);
|
|
|
|
|
|
AdsActionEvents.TrackAdFailToShow(AdsType.Native,
|
|
|
|
|
|
position,
|
|
|
|
|
|
PlatformType.Admob.ToString(),
|
|
|
|
|
|
"",
|
|
|
|
|
|
StaticValue.AdmobMinddleNativeId,
|
|
|
|
|
|
AdPlayCountManager.GetAdsActionCount(AdsType.Native,position+AdPlayCountManager.POS_SUFFIX),
|
|
|
|
|
|
NativeType.Medium,
|
|
|
|
|
|
"-1",
|
|
|
|
|
|
AdsShowFailType.NoFill.ToString()
|
|
|
|
|
|
);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-09-18 07:03:56 +00:00
|
|
|
|
|
|
|
|
|
|
if (nativeTemplateStyle == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
nativeTemplateStyle = new NativeTemplateStyle
|
|
|
|
|
|
{
|
|
|
|
|
|
TemplateId = NativeTemplateId.Small,
|
|
|
|
|
|
MainBackgroundColor = Color.white
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-02 10:06:58 +00:00
|
|
|
|
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
2025-09-18 07:03:56 +00:00
|
|
|
|
var nativeAdPosition = NativeAdPosition.Create(nativeTemplateStyle, rectTransform, pCom);
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2026-01-06 08:31:14 +00:00
|
|
|
|
AdsSDKManager.Instance.ShowNativeAd(position, adUnitId, nativeAdPosition,NativeType.Medium);
|
2025-09-02 10:06:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void HideMinddleNative()
|
|
|
|
|
|
{
|
|
|
|
|
|
var adUnitId = StaticValue.AdmobMinddleNativeId;
|
|
|
|
|
|
AdsSDKManager.Instance.RemoveNativeAd(adUnitId);
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
2025-09-01 09:57:19 +00:00
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 埋点
|
|
|
|
|
|
|
|
|
|
|
|
public void LogEvent(string eventName)
|
|
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
ShuShuEvent.Instance.Track(eventName);
|
|
|
|
|
|
FireBaseAnalyticsManager.Instance.LogEvent(eventName);
|
2025-09-02 10:08:26 +00:00
|
|
|
|
AdjustTrackEvent.Instance.TrackEventName(eventName, new Dictionary<string, object>());
|
2025-09-01 09:57:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void LogEvent(string eventName, string key1, object value1)
|
|
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
ShuShuEvent.Instance.Track(eventName, key1, value1);
|
|
|
|
|
|
FireBaseAnalyticsManager.Instance.LogEvent(eventName, key1, value1);
|
2025-09-02 10:08:26 +00:00
|
|
|
|
AdjustTrackEvent.Instance.TrackEventName(eventName, new Dictionary<string, object>
|
|
|
|
|
|
{
|
|
|
|
|
|
[key1] = value1
|
|
|
|
|
|
});
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 09:57:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void LogEvent(string eventName, Dictionary<string, object> extraInfo)
|
|
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
ShuShuEvent.Instance.Track(eventName, extraInfo);
|
|
|
|
|
|
FireBaseAnalyticsManager.Instance.LogEvent(eventName, extraInfo);
|
2025-09-02 10:08:26 +00:00
|
|
|
|
AdjustTrackEvent.Instance.TrackEventName(eventName, extraInfo);
|
2025-09-01 09:57:19 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 09:57:19 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 公共事件属性
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="args"></param>
|
|
|
|
|
|
public void SetSuperProperties(Dictionary<string, object> args)
|
|
|
|
|
|
{
|
|
|
|
|
|
ShuShuEvent.Instance.SetSuperProperties(args);
|
|
|
|
|
|
FireBaseAnalyticsManager.Instance.SetSuperProperties(args);
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 09:57:19 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 用户属性
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="args"></param>
|
|
|
|
|
|
public void SetUserProperties(Dictionary<string, object> args)
|
|
|
|
|
|
{
|
|
|
|
|
|
ShuShuEvent.Instance.UserSet(args);
|
|
|
|
|
|
FireBaseAnalyticsManager.Instance.SetUserProperty(args);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 08:33:14 +00:00
|
|
|
|
#region 在线参数
|
|
|
|
|
|
|
|
|
|
|
|
public bool GetRemoteConfigBool(string key, bool defaultValue = false)
|
|
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return defaultValue;
|
|
|
|
|
|
}
|
2025-09-01 08:33:14 +00:00
|
|
|
|
return FireBaseRemoteConfigManager.Instance.GetRemoteConfigBool(key, defaultValue);
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 08:33:14 +00:00
|
|
|
|
public int GetRemoteConfigInt(string key, int defaultValue = 0)
|
|
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return defaultValue;
|
|
|
|
|
|
}
|
2025-09-01 08:33:14 +00:00
|
|
|
|
return FireBaseRemoteConfigManager.Instance.GetRemoteConfigInt(key, defaultValue);
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 15:21:18 +00:00
|
|
|
|
public string GetRemoteConfigStr(string key, string defaultValue = "")
|
2025-09-01 08:33:14 +00:00
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return defaultValue;
|
|
|
|
|
|
}
|
2025-09-01 08:33:14 +00:00
|
|
|
|
return FireBaseRemoteConfigManager.Instance.GetRemoteConfigString(key, defaultValue);
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
2025-09-01 08:33:14 +00:00
|
|
|
|
public float GetRemoteConfigFloat(string key, float defaultValue = 0)
|
|
|
|
|
|
{
|
2025-09-01 11:10:21 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return defaultValue;
|
|
|
|
|
|
}
|
2025-09-01 08:33:14 +00:00
|
|
|
|
return FireBaseRemoteConfigManager.Instance.GetRemoteConfigFloat(key, defaultValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2025-09-02 03:45:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否是自然量用户
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public bool InOrganic()
|
|
|
|
|
|
{
|
|
|
|
|
|
return AdjustNetwork.Instance.InOrganic();
|
|
|
|
|
|
}
|
2025-09-02 08:17:14 +00:00
|
|
|
|
|
2025-09-15 10:37:40 +00:00
|
|
|
|
public string GetGaid()
|
2025-09-02 08:17:14 +00:00
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "gaid";
|
|
|
|
|
|
}
|
|
|
|
|
|
return AdjustManager.Instance.GetGdid();
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetAndroidId()
|
|
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "androidid";
|
|
|
|
|
|
}
|
|
|
|
|
|
string androidId = "unknown";
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
using (AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
|
|
|
|
|
|
using (AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity"))
|
|
|
|
|
|
using (AndroidJavaClass settingsSecure = new AndroidJavaClass("android.provider.Settings$Secure"))
|
|
|
|
|
|
{
|
|
|
|
|
|
// 调用 Settings.Secure.getString() 方法获取 ANDROID_ID
|
|
|
|
|
|
androidId = settingsSecure.CallStatic<string>(
|
|
|
|
|
|
"getString",
|
|
|
|
|
|
currentActivity.Call<AndroidJavaObject>("getContentResolver"),
|
|
|
|
|
|
"android_id"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (System.Exception e)
|
|
|
|
|
|
{
|
|
|
|
|
|
LoggerUtils.Error("获取 Android ID 出错: " + e.Message);
|
|
|
|
|
|
}
|
|
|
|
|
|
return androidId;
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetAdid()
|
|
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "adid";
|
|
|
|
|
|
}
|
|
|
|
|
|
return AdjustManager.Instance.GetAdid();
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetUserAgent()
|
|
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "GetUserAgent";
|
|
|
|
|
|
}
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
// 获取Java的System类
|
|
|
|
|
|
using (AndroidJavaClass systemClass = new AndroidJavaClass("java.lang.System"))
|
|
|
|
|
|
{
|
|
|
|
|
|
// 调用System.getProperty("http.agent")方法
|
|
|
|
|
|
string httpAgent = systemClass.CallStatic<string>("getProperty", "http.agent");
|
|
|
|
|
|
return httpAgent;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (System.Exception e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Debug.LogError("获取http.agent失败: " + e.Message);
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetSSAccountId()
|
|
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "GetSSAccountId";
|
|
|
|
|
|
}
|
2025-09-24 09:43:44 +00:00
|
|
|
|
return "";
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetSSDistinctId()
|
|
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "GetSSDistinctId";
|
|
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
LoggerUtils.Debug("GetSSDistinctId:" + TDAnalytics.GetDistinctId());
|
2025-09-05 09:58:34 +00:00
|
|
|
|
return TDAnalytics.GetDistinctId();
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string GetSSSuperProperties()
|
|
|
|
|
|
{
|
2025-09-02 09:36:19 +00:00
|
|
|
|
if (Application.isEditor)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "GetSSSuperProperties";
|
|
|
|
|
|
}
|
2025-09-04 14:30:30 +00:00
|
|
|
|
|
2025-09-05 09:58:34 +00:00
|
|
|
|
var superProperties = TDAnalytics.GetSuperProperties();
|
|
|
|
|
|
LoggerUtils.Debug("GetSSDistinctId:" + JsonMapper.ToJson(superProperties));
|
2025-09-04 14:30:30 +00:00
|
|
|
|
return superProperties == null ? "" : superProperties.ToString();
|
2025-09-02 08:17:14 +00:00
|
|
|
|
}
|
2025-09-15 10:37:40 +00:00
|
|
|
|
|
|
|
|
|
|
public void OpenPrivacy()
|
|
|
|
|
|
{
|
|
|
|
|
|
Application.OpenURL(StaticValue.PrivacyUrl);
|
|
|
|
|
|
}
|
2025-10-15 08:31:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
2025-08-31 08:42:48 +00:00
|
|
|
|
}
|