修改命名空间&开屏广告

This commit is contained in:
juncong lee 2025-09-01 18:32:50 +08:00
parent 8b7054ef00
commit b7b1b2c9f4
56 changed files with 1345 additions and 1131 deletions

View File

@ -5,10 +5,9 @@ using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using Google.MiniJSON; using Google.MiniJSON;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.Common.FileParse namespace WZ
{ {
public static class FileParse public static class FileParse

View File

@ -1,7 +1,6 @@
using System; using System;
using Script.SDKManager.AdsSDKManager.Constant;
namespace Script.Common namespace WZ
{ {
/// <summary> /// <summary>
/// 提供广告SDK功能的统一接口 /// 提供广告SDK功能的统一接口

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Script.Common namespace WZ
{ {
[System.Serializable] [System.Serializable]
public class IvRulesData public class IvRulesData

View File

@ -1,4 +1,4 @@
namespace Script.Common namespace WZ
{ {
[System.Serializable] [System.Serializable]
public class RevenueData public class RevenueData

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.Common namespace WZ
{ {
public static class StaticValue public static class StaticValue

View File

@ -1,9 +1,9 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using AdjustSdk; using AdjustSdk;
using Script.Utils;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using WZ;
public class AdjustManager : NormalSingleton<AdjustManager> public class AdjustManager : NormalSingleton<AdjustManager>
{ {

View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using Script.Utils;
using UnityEngine; using UnityEngine;
using WZ;
public class AdjustNetwork : NormalSingleton<AdjustNetwork> public class AdjustNetwork : NormalSingleton<AdjustNetwork>
{ {

View File

@ -1,9 +1,8 @@
using AdjustSdk; using AdjustSdk;
using Firebase.RemoteConfig; using Firebase.RemoteConfig;
using Newtonsoft.Json; using Newtonsoft.Json;
using Script.Common; using WZ;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.Utils;
public class AdjustTrackEvent : NormalSingleton<AdjustTrackEvent> public class AdjustTrackEvent : NormalSingleton<AdjustTrackEvent>
{ {

View File

@ -2,15 +2,10 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using GoogleMobileAds.Api; using GoogleMobileAds.Api;
using Script.Common;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager namespace WZ
{ {
public class AdmobAdsManager : NormalSingleton<AdmobAdsManager>, IAdService public class AdmobAdsManager : NormalSingleton<AdmobAdsManager>, IAdService
@ -52,8 +47,6 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
if (_bannerAdUnits.Count > 0) LoadBanner(); if (_bannerAdUnits.Count > 0) LoadBanner();
if (_interstitialAdUnits.Count > 0) LoadInterstitial(); if (_interstitialAdUnits.Count > 0) LoadInterstitial();
if (_rewardedAdUnits.Count > 0) LoadRewarded(); if (_rewardedAdUnits.Count > 0) LoadRewarded();
if (_splashAdUnits.Count > 0) LoadSplash();
_initialized = true; _initialized = true;
LoggerUtils.Debug("[Admob] init success"); LoggerUtils.Debug("[Admob] init success");
}); });
@ -268,14 +261,16 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
} }
private void OnSplashAdDismissed(string adSource,string adUnitId,double revenue) private void OnSplashAdDismissed(string adSource, string adUnitId, double revenue)
{ {
AdsActionEvents.TrackAdClosed(Platfrom, adSource, adUnitId, AdsType.Splash, "", revenue); AdsActionEvents.TrackAdClosed(Platfrom, adSource, adUnitId, AdsType.Splash, "", revenue);
AdsSDKManager.Instance.OnSplashAdCloseCallback?.Invoke();
} }
private void OnSplashAdError(string adUnitId, int errorCode, string errorMsg) private void OnSplashAdError(string adUnitId, int errorCode, string errorMsg)
{ {
AdsActionEvents.TrackAdFailToShow(Platfrom,AdsType.Splash,errorMsg,""); AdsActionEvents.TrackAdFailToShow(Platfrom, AdsType.Splash, errorMsg, "");
AdsSDKManager.Instance.OnSplashAdCloseCallback?.Invoke();
} }
private void OnSplashAdClicked(string adSource,string adUnitId,double revenue) private void OnSplashAdClicked(string adSource,string adUnitId,double revenue)
@ -294,7 +289,6 @@ namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager
#region 广 #region 广
public void LoadNative() public void LoadNative()
{ {
throw new System.NotImplementedException();
} }
public double GetNativeRevenue() public double GetNativeRevenue()
{ {

View File

@ -1,12 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using GoogleMobileAds.Api; using GoogleMobileAds.Api;
using System; using System;
using Script.Utils;
using Script.SDKManager.AdsSDKManager.AdmobAdsManager.Utils;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager namespace WZ
{ {
public class AdmobBannerAdManager public class AdmobBannerAdManager
{ {

View File

@ -1,12 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using GoogleMobileAds.Api; using GoogleMobileAds.Api;
using Script.SDKManager.AdsSDKManager.AdmobAdsManager.Utils;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.Utils;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager namespace WZ
{ {
public class AdmobInterstitialAdManager public class AdmobInterstitialAdManager
{ {

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager namespace WZ
{ {
public class AdmobNativeAdManager : MonoBehaviour public class AdmobNativeAdManager : MonoBehaviour
{ {

View File

@ -1,13 +1,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using GoogleMobileAds.Api; using GoogleMobileAds.Api;
using Script.SDKManager.AdsSDKManager.AdmobAdsManager.Utils;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.Utils;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager namespace WZ
{ {
public class AdmobRewardedAdManager public class AdmobRewardedAdManager
{ {

View File

@ -2,13 +2,9 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using GoogleMobileAds.Api; using GoogleMobileAds.Api;
using Script.SDKManager.AdsSDKManager.AdmobAdsManager.Utils;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager namespace WZ
{ {
public class AdmobSplashAdManager public class AdmobSplashAdManager
{ {

View File

@ -2,11 +2,10 @@ using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using GoogleMobileAds.Api; using GoogleMobileAds.Api;
using Script.Utils;
using UnityEngine; using UnityEngine;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
namespace Script.SDKManager.AdsSDKManager.AdmobAdsManager.Utils namespace WZ
{ {
public class AdmobUtils public class AdmobUtils
{ {

View File

@ -3,378 +3,394 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Firebase.RemoteConfig; using Firebase.RemoteConfig;
using Newtonsoft.Json; using Newtonsoft.Json;
using Script.Common;
using Script.SDKManager.AdsSDKManager.AdmobAdsManager;
using Script.SDKManager.AdsSDKManager.BigoAdsManager;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.SDKManager.AdsSDKManager.MaxAdsManager;
using Script.SDKManager.AdsSDKManager.TpnAdsManager;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using UnityEngine; using UnityEngine;
public class AdsSDKManager : NormalSingleton<AdsSDKManager> namespace WZ
{ {
private List<IAdService> _adNetworks = new List<IAdService>(); public class AdsSDKManager : NormalSingleton<AdsSDKManager>
/// <summary>
/// 看完广告的回调
/// </summary>
private Action<double> AdRewardCallback;
/// <summary>
/// 广告竞价开关激励、插屏、全屏Native广告竞价
/// </summary>
public bool IsMoreAdsBidding = false;
public void InitSDK()
{ {
// 初始化广告平台状态 private List<IAdService> _adNetworks = new List<IAdService>();
BidPlatformManager.Instance.InitializePlatformStates(AdConfigParser.GetAdExpireInSec()); // 是否有激励视频或者插屏广告在展示
InitializeAdNetworks(); public bool otherAdsOnShow = false;
} /// <summary>
/// 看完广告的回调
/// </summary>
private Action<double> AdRewardCallback;
private void InitializeAdNetworks() /// <summary>
{ /// 广告竞价开关激励、插屏、全屏Native广告竞价
_adNetworks.Add(AdmobAdsManager.Instance); /// </summary>
_adNetworks.Add(BigoAdsManager.Instance); public bool IsMoreAdsBidding = false;
_adNetworks.Add(TpnAdsManager.Instance);
_adNetworks.Add(MaxAdsManager.Instance);
foreach (var network in _adNetworks) public Action OnSplashAdCloseCallback;
public void InitSDK(Action action)
{ {
network.Initialize(); OnSplashAdCloseCallback = action;
} // 初始化广告平台状态
} BidPlatformManager.Instance.InitializePlatformStates(AdConfigParser.GetAdExpireInSec());
InitializeAdNetworks();
public bool IsRewardAdReady()
{
return _adNetworks.Any(network => network.IsRewardedAvailable());
}
/// <summary>
/// 展示激励广告
/// </summary>
/// <param name="callback"></param>
public void ShowRewardAd(string _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null)
{
AdsActionEvents.TrackAdPosition(AdsType.Rewarded, _adPos);
if (!IsRewardAdReady())
{
_showFailedCallback?.Invoke();
return;
} }
PlatformType result = GetBestPlatformType(false); private void InitializeAdNetworks()
BidPlatformManager.Instance.RecordBidSuccess(result, AdsType.Rewarded);
if (result == PlatformType.AppLovin)
{
MaxAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Admob)
{
AdmobAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Bigo)
{
BigoAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Topon)
{
TpnAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Kwai)
{ {
_adNetworks.Add(AdmobAdsManager.Instance);
_adNetworks.Add(BigoAdsManager.Instance);
_adNetworks.Add(TpnAdsManager.Instance);
_adNetworks.Add(MaxAdsManager.Instance);
} foreach (var network in _adNetworks)
else
{
_showFailedCallback?.Invoke();
}
AdPlayCountManager.IncrementAdPlayCount(AdsType.Rewarded);
CheckAndRefreshExpiredBids(AdsType.Rewarded);
}
public bool IsInterstitialReady()
{
return _adNetworks.Any(network => network.IsInterstitialAvailable());
}
/// <summary>
/// 展示激励广告
/// </summary>
/// <param name="callback"></param>
public void ShowInterstitialAd(string _adPos, IvType _IvType = IvType.IV1, Action _closeCallback = null)
{
AdsActionEvents.TrackAdPosition(AdsType.Interstitial, _adPos);
if (!IsRewardAdReady())
{
_closeCallback?.Invoke();
_closeCallback = null;
return;
}
PlatformType result = GetBestPlatformType(true);
BidPlatformManager.Instance.RecordBidSuccess(result, AdsType.Interstitial);
if (result == PlatformType.AppLovin)
{
MaxAdsManager.Instance.DisplayInterstitial(_adPos, _IvType,_closeCallback);
}
else if (result == PlatformType.Admob)
{
AdmobAdsManager.Instance.DisplayInterstitial(_adPos, _IvType,_closeCallback);
}
else if (result == PlatformType.Bigo)
{
BigoAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
}
else if (result == PlatformType.Topon)
{
TpnAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
}
else if (result == PlatformType.Kwai)
{
}
else
{
_closeCallback?.Invoke();
}
AdPlayCountManager.IncrementAdPlayCount(AdsType.Interstitial);
// 刷新其他类型广告
CheckAndRefreshExpiredBids(AdsType.Interstitial);
}
private PlatformType GetBestPlatformType(bool isInterstitial)
{
if (isInterstitial)
{
AdPriceInfo priceInfo = new AdPriceInfo(
maxPrice: MaxAdsManager.Instance.GetInterstitialRevenue(),
admobPrice: AdmobAdsManager.Instance.GetInterstitialRevenue(),
bigoPrice: BigoAdsManager.Instance.GetInterstitialRevenue(),
// todo : 这里的kwaiPrice暂时设置为0后续需要根据实际情况设置
kwaiPrice: 0,
toponAdUnitId: TpnAdsManager.Instance.topon_interstitial_units
);
return AdsBidResult.GetPlatformType(priceInfo);
}
else
{
AdPriceInfo priceInfo = new AdPriceInfo(
maxPrice: MaxAdsManager.Instance.GetRewardedRevenue(),
admobPrice: AdmobAdsManager.Instance.GetRewardedRevenue(),
bigoPrice: BigoAdsManager.Instance.GetRewardedRevenue(),
// todo : 这里的kwaiPrice暂时设置为0后续需要根据实际情况设置
kwaiPrice: 0,
toponAdUnitId: TpnAdsManager.Instance.topon_rewarded_units
);
return AdsBidResult.GetPlatformType(priceInfo);
}
}
// 检查并刷新过期竞价
private void CheckAndRefreshExpiredBids(AdsType _adsType)
{
Dictionary<PlatformType, List<AdsType>> expiredBids = BidPlatformManager.Instance.GetExpiredBids();
foreach (var kvp in expiredBids)
{
PlatformType platformName = kvp.Key;
foreach (AdsType adType in kvp.Value)
{ {
if (_adsType == adType) network.Initialize();
{ }
LoggerUtils.Debug($"{platformName} 平台 {adType} 广告竞价已过期,重新加载广告"); AdsSplashManager.Instance.InitSplash();
RefreshPlatformAds(platformName, adType); }
}
public bool IsRewardAdReady()
{
return _adNetworks.Any(network => network.IsRewardedAvailable());
}
/// <summary>
/// 展示激励广告
/// </summary>
/// <param name="callback"></param>
public void ShowRewardAd(string _adPos, Action<bool> _rewardCallback = null, Action _showFailedCallback = null)
{
AdsActionEvents.TrackAdPosition(AdsType.Rewarded, _adPos);
if (!IsRewardAdReady())
{
_showFailedCallback?.Invoke();
return;
}
PlatformType result = GetBestPlatformType(false);
BidPlatformManager.Instance.RecordBidSuccess(result, AdsType.Rewarded);
if (result == PlatformType.AppLovin)
{
MaxAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Admob)
{
AdmobAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Bigo)
{
BigoAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Topon)
{
TpnAdsManager.Instance.DisplayRewarded(_adPos, _rewardCallback, _showFailedCallback);
}
else if (result == PlatformType.Kwai)
{
}
else
{
_showFailedCallback?.Invoke();
}
AdPlayCountManager.IncrementAdPlayCount(AdsType.Rewarded);
CheckAndRefreshExpiredBids(AdsType.Rewarded);
}
public bool IsInterstitialReady()
{
return _adNetworks.Any(network => network.IsInterstitialAvailable());
}
/// <summary>
/// 展示激励广告
/// </summary>
/// <param name="callback"></param>
public void ShowInterstitialAd(string _adPos, IvType _IvType = IvType.IV1, Action _closeCallback = null)
{
AdsActionEvents.TrackAdPosition(AdsType.Interstitial, _adPos);
if (!IsRewardAdReady())
{
_closeCallback?.Invoke();
_closeCallback = null;
return;
}
otherAdsOnShow = true;
PlatformType result = GetBestPlatformType(true);
BidPlatformManager.Instance.RecordBidSuccess(result, AdsType.Interstitial);
if (result == PlatformType.AppLovin)
{
MaxAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
}
else if (result == PlatformType.Admob)
{
AdmobAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
}
else if (result == PlatformType.Bigo)
{
BigoAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
}
else if (result == PlatformType.Topon)
{
TpnAdsManager.Instance.DisplayInterstitial(_adPos, _IvType, _closeCallback);
}
else if (result == PlatformType.Kwai)
{
}
else
{
_closeCallback?.Invoke();
}
AdPlayCountManager.IncrementAdPlayCount(AdsType.Interstitial);
// 刷新其他类型广告
CheckAndRefreshExpiredBids(AdsType.Interstitial);
}
#region 广
public bool IsSplashAvailable()
{
return _adNetworks.Any(network => network.IsSplashAvailable());
}
public void ShowSplashAd()
{
AdmobAdsManager.Instance.DisplaySplash();
}
public void LoadSplashAd()
{
AdmobAdsManager.Instance.LoadSplash();
}
#endregion
private PlatformType GetBestPlatformType(bool isInterstitial)
{
if (isInterstitial)
{
AdPriceInfo priceInfo = new AdPriceInfo(
maxPrice: MaxAdsManager.Instance.GetInterstitialRevenue(),
admobPrice: AdmobAdsManager.Instance.GetInterstitialRevenue(),
bigoPrice: BigoAdsManager.Instance.GetInterstitialRevenue(),
// todo : 这里的kwaiPrice暂时设置为0后续需要根据实际情况设置
kwaiPrice: 0,
toponAdUnitId: TpnAdsManager.Instance.topon_interstitial_units
);
return AdsBidResult.GetPlatformType(priceInfo);
}
else
{
AdPriceInfo priceInfo = new AdPriceInfo(
maxPrice: MaxAdsManager.Instance.GetRewardedRevenue(),
admobPrice: AdmobAdsManager.Instance.GetRewardedRevenue(),
bigoPrice: BigoAdsManager.Instance.GetRewardedRevenue(),
// todo : 这里的kwaiPrice暂时设置为0后续需要根据实际情况设置
kwaiPrice: 0,
toponAdUnitId: TpnAdsManager.Instance.topon_rewarded_units
);
return AdsBidResult.GetPlatformType(priceInfo);
} }
} }
}
private void RefreshPlatformAds(PlatformType platformName, AdsType adType)
{
switch (platformName)
{
case PlatformType.Admob:
RefreshAdmobAds(adType);
break;
case PlatformType.Topon:
RefreshTopOnAds(adType);
break;
case PlatformType.AppLovin:
RefreshMaxAds(adType);
break;
case PlatformType.Bigo:
RefreshBigoAds(adType);
break;
case PlatformType.Kwai:
RefreshKwaiAds(adType);
break;
default:
break;
}
}
private void RefreshAdmobAds(AdsType adType) // 检查并刷新过期竞价
{ private void CheckAndRefreshExpiredBids(AdsType _adsType)
switch (adType)
{ {
case AdsType.Rewarded: Dictionary<PlatformType, List<AdsType>> expiredBids = BidPlatformManager.Instance.GetExpiredBids();
AdmobAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
AdmobAdsManager.Instance.LoadInterstitial();
break;
case AdsType.Banner:
AdmobAdsManager.Instance.LoadBanner();
break;
case AdsType.Native:
AdmobAdsManager.Instance.LoadNative();
break;
case AdsType.Splash:
AdmobAdsManager.Instance.LoadSplash();
break;
default:
break;
}
}
// 刷新TopOn广告
private void RefreshTopOnAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
TpnAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
TpnAdsManager.Instance.LoadInterstitial();
break;
default:
break;
}
}
// 刷新Max广告
private void RefreshMaxAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
MaxAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
MaxAdsManager.Instance.LoadInterstitial();
break;
default:
break;
}
}
// 刷新Bigo广告
private void RefreshBigoAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
BigoAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
BigoAdsManager.Instance.LoadInterstitial();
break;
default:
break;
}
}
private void RefreshKwaiAds (AdsType adType) foreach (var kvp in expiredBids)
{
switch (adType)
{
case AdsType.Rewarded:
// todo: 刷新激励广告
KwaiAdsManager.Instance.LoadRewardAd();
break;
case AdsType.Interstitial:
// todo: 刷新插屏广告
KwaiAdsManager.Instance.LoadInterstitialAd();
break;
default:
break;
}
}
/// <summary>
/// 广告看完回调
/// </summary>
public void OnRewardAdCallback(double price)
{
AdRewardCallback?.Invoke(price);
AdRewardCallback = null;
}
/// <summary>
/// 根据IvRules判断是否可以展示插屏
/// </summary>
/// <returns></returns>
public bool IvRulesShow(IvType ivadType)
{
//1.获取远程配置
string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("IV_RULES");
if (string.IsNullOrEmpty(json))
{
return true;
}
//2.解析配置
var dates = JsonConvert.DeserializeObject<IvRulesData[]>(json);
if (dates == null && dates.Length == 0)
{
return true;
}
//3.获取IVADType对应的配置
IvRulesData ivRulesData = null;
foreach (var data in dates)
{
if (data.type == (int)ivadType)
{ {
ivRulesData = data; PlatformType platformName = kvp.Key;
foreach (AdsType adType in kvp.Value)
{
if (_adsType == adType)
{
LoggerUtils.Debug($"{platformName} 平台 {adType} 广告竞价已过期,重新加载广告");
RefreshPlatformAds(platformName, adType);
}
}
} }
} }
if (ivRulesData == null) private void RefreshPlatformAds(PlatformType platformName, AdsType adType)
{ {
switch (platformName)
{
case PlatformType.Admob:
RefreshAdmobAds(adType);
break;
case PlatformType.Topon:
RefreshTopOnAds(adType);
break;
case PlatformType.AppLovin:
RefreshMaxAds(adType);
break;
case PlatformType.Bigo:
RefreshBigoAds(adType);
break;
case PlatformType.Kwai:
RefreshKwaiAds(adType);
break;
default:
break;
}
}
private void RefreshAdmobAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
AdmobAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
AdmobAdsManager.Instance.LoadInterstitial();
break;
case AdsType.Banner:
AdmobAdsManager.Instance.LoadBanner();
break;
case AdsType.Native:
AdmobAdsManager.Instance.LoadNative();
break;
case AdsType.Splash:
AdmobAdsManager.Instance.LoadSplash();
break;
default:
break;
}
}
// 刷新TopOn广告
private void RefreshTopOnAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
TpnAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
TpnAdsManager.Instance.LoadInterstitial();
break;
default:
break;
}
}
// 刷新Max广告
private void RefreshMaxAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
MaxAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
MaxAdsManager.Instance.LoadInterstitial();
break;
default:
break;
}
}
// 刷新Bigo广告
private void RefreshBigoAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
BigoAdsManager.Instance.LoadRewarded();
break;
case AdsType.Interstitial:
BigoAdsManager.Instance.LoadInterstitial();
break;
default:
break;
}
}
private void RefreshKwaiAds(AdsType adType)
{
switch (adType)
{
case AdsType.Rewarded:
// todo: 刷新激励广告
KwaiAdsManager.Instance.LoadRewardAd();
break;
case AdsType.Interstitial:
// todo: 刷新插屏广告
KwaiAdsManager.Instance.LoadInterstitialAd();
break;
default:
break;
}
}
/// <summary>
/// 广告看完回调
/// </summary>
public void OnRewardAdCallback(double price)
{
AdRewardCallback?.Invoke(price);
AdRewardCallback = null;
}
/// <summary>
/// 根据IvRules判断是否可以展示插屏
/// </summary>
/// <returns></returns>
public bool IvRulesShow(IvType ivadType)
{
//1.获取远程配置
string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("IV_RULES");
if (string.IsNullOrEmpty(json))
{
return true;
}
//2.解析配置
var dates = JsonConvert.DeserializeObject<IvRulesData[]>(json);
if (dates == null && dates.Length == 0)
{
return true;
}
//3.获取IVADType对应的配置
IvRulesData ivRulesData = null;
foreach (var data in dates)
{
if (data.type == (int)ivadType)
{
ivRulesData = data;
}
}
if (ivRulesData == null)
{
return true;
}
//4.判断skip(次安装跳过几次触发不展示广告)
int skipLevel = ivRulesData.skipLevel;
int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt(IvRulesKey.KEY_SKIPLEVEL, 0);
if (currentSkipLevel < skipLevel)
{
LoggerUtils.Debug($"[SDK] skipLevel limit");
PlayerPrefsUtils.SavePlayerPrefsInt(IvRulesKey.KEY_SKIPLEVEL, currentSkipLevel + 1);
return false;
}
//5.判断overLevel(没跳过几次触发)
int overLevel = ivRulesData.overLevel;
int currentOverLevel = IvRulesConst.CurrentOverLevel;
if (currentOverLevel < overLevel)
{
LoggerUtils.Debug($"[SDK] overLevel limit");
IvRulesConst.CurrentOverLevel++;
return false;
}
//6.判断interval(广告时间间隔)
int interval = ivRulesData.interval;
long currentInterval = IvRulesConst.CurrentInterval;
long localTimestamp = TimeUtils.GetLocalTimestamp();
if (localTimestamp < currentInterval + (interval * 1000L))
{
LoggerUtils.Debug($"[SDK] interval limit");
return false;
}
return true; return true;
} }
//4.判断skip(次安装跳过几次触发不展示广告)
int skipLevel = ivRulesData.skipLevel;
int currentSkipLevel = PlayerPrefsUtils.GetPlayerPrefsInt(IvRulesKey.KEY_SKIPLEVEL, 0);
if (currentSkipLevel < skipLevel)
{
LoggerUtils.Debug($"[SDK] skipLevel limit");
PlayerPrefsUtils.SavePlayerPrefsInt(IvRulesKey.KEY_SKIPLEVEL, currentSkipLevel + 1);
return false;
}
//5.判断overLevel(没跳过几次触发)
int overLevel = ivRulesData.overLevel;
int currentOverLevel = IvRulesConst.CurrentOverLevel;
if (currentOverLevel < overLevel)
{
LoggerUtils.Debug($"[SDK] overLevel limit");
IvRulesConst.CurrentOverLevel++;
return false;
}
//6.判断interval(广告时间间隔)
int interval = ivRulesData.interval;
long currentInterval = IvRulesConst.CurrentInterval;
long localTimestamp = TimeUtils.GetLocalTimestamp();
if (localTimestamp < currentInterval + (interval * 1000L))
{
LoggerUtils.Debug($"[SDK] interval limit");
return false;
}
return true;
} }
} }

View File

@ -0,0 +1,203 @@
using System.Collections;
using System.Collections.Generic;
using Firebase.RemoteConfig;
using GoogleMobileAds.Api;
using GoogleMobileAds.Common;
using UnityEngine;
namespace WZ
{
public class AdsSplashManager : MonoBehaviour
{
public static AdsSplashManager Instance { get; private set; }
public float backgroundTime = 0;
private int timeoutDuration = 5;
private bool _coldLaunch = true;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
return;
}
Instance = this;
DontDestroyOnLoad(gameObject);
}
public void InitSplash()
{
timeoutDuration = GetSplashConfigItem().loadtime;
StartCoroutine(LoadSplashAdAdWithTimeout());
}
private void OnAppStateChanged(AppState state)
{
if (_coldLaunch)
{
_coldLaunch = false;
return;
}
if (state == AppState.Foreground)
{
LoggerUtils.Debug("[AppOpen] 进入前台");
CheckSplashAdlash(false);
}
else if (state == AppState.Background)
{
backgroundTime = Time.realtimeSinceStartup;
LoggerUtils.Debug("[AppOpen] 进入后台 " + backgroundTime);
}
}
private IEnumerator LoadSplashAdAdWithTimeout()
{
// 开始加载广告
AdsSDKManager.Instance.LoadSplashAd();
// 等待5秒或直到广告加载完成
float elapsedTime = 0f;
while (elapsedTime < timeoutDuration && !AdsSDKManager.Instance.IsSplashAvailable())
{
elapsedTime += Time.deltaTime;
yield return null;
}
CheckSplashAdlash(true);
}
IEnumerator DelayedAction()
{
yield return new WaitForSeconds(1f);
CheckSplashAdlash(false);
}
private void CheckSplashAdlash(bool isCold)
{
if (!isCold)
{
// 热启动
// 当前有其他类型广告在展示
LoggerUtils.Debug(" [AppOpen] 热启动 是否有广告在展示:" + AdsSDKManager.Instance.otherAdsOnShow);
if (AdsSDKManager.Instance.otherAdsOnShow) return;
// 热启动开关
var hotSplashSwitch = GetSplashConfigItem().hot_splash_switch == 1;
LoggerUtils.Debug(" [AppOpen] 热启动 开关:" + hotSplashSwitch);
if (!hotSplashSwitch)
{
return;
}
// 后台运行时间
float resultTime = Time.realtimeSinceStartup - backgroundTime;
float onlineTime = GetSplashConfigItem().hot_timegap;
LoggerUtils.Debug(" [AppOpen] 后台运行时间差值:" + resultTime + " 在线参数值:" + onlineTime);
if (resultTime < onlineTime)
{
return;
}
if (!AdsSDKManager.Instance.IsSplashAvailable())
{
LoggerUtils.Debug(" [AppOpen] 热启动 广告是否准备好:");
AdsSDKManager.Instance.LoadSplashAd();
return;
}
// 展示热启动开屏
AdsSDKManager.Instance.ShowSplashAd();
}
else
{
// 冷启动
// 首次启动
var isNew = PlayerPrefsUtils.GetPlayerPrefsInt("Firstcold_Splash_Switch", 0) == 0;
// 首次冷启动开关
var isFirstShow = GetSplashConfigItem().firstcold_splash_switch == 1;
// 冷启动开关
var coldSplashSwitch = GetSplashConfigItem().cold_splash_switch == 1;
LoggerUtils.Debug(" [AppOpen] 冷启动 开关:" + coldSplashSwitch + " 首次启动是否展示开屏:" + isFirstShow + " 新用户:" + isNew);
// 新用户首次启动
if (isNew)
{
PlayerPrefsUtils.SavePlayerPrefsInt("Firstcold_Splash_Switch", 1);
if (!isFirstShow)
{
// 新用户首次不展示
AdsSDKManager.Instance.OnSplashAdCloseCallback?.Invoke();
}
else
{
// 新用户首次展示
if (AdsSDKManager.Instance.IsSplashAvailable())
{
AdsSDKManager.Instance.ShowSplashAd();
}
else
{
AdsSDKManager.Instance.OnSplashAdCloseCallback?.Invoke();
AdsSDKManager.Instance.LoadSplashAd();
LoggerUtils.Debug(" [AppOpen] 冷启动广告未准备好");
}
}
}
else
{
// 非首次启动
if (coldSplashSwitch)
{
// 展示冷启动
if (AdsSDKManager.Instance.IsSplashAvailable())
{
AdsSDKManager.Instance.ShowSplashAd();
}
else
{
AdsSDKManager.Instance.OnSplashAdCloseCallback?.Invoke();
AdsSDKManager.Instance.LoadSplashAd();
}
}
else
{
AdsSDKManager.Instance.OnSplashAdCloseCallback?.Invoke();
}
}
AppStateEventNotifier.AppStateChanged += OnAppStateChanged;
}
}
private static string Splash_AD_RULES = "Splash_AD_RULES";
private static string Splash_AD_RULES_DEFAULT_VALUE = "[{\"firstcold_splash_switch\":1,\"cold_splash_switch\":1,\"hot_splash_switch\":1,\"hot_timegap\":30,\"loadtime\":5}]";
public SplashConfigItem GetSplashConfigItem()
{
string jsonData = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString(Splash_AD_RULES, Splash_AD_RULES_DEFAULT_VALUE);
SplashConfigItem[] configItems = DataUtils.FromJsonArray<SplashConfigItem>(jsonData);
if (configItems.Length == 0 || configItems == null)
{
return new SplashConfigItem() { firstcold_splash_switch = 1, cold_splash_switch = 1, hot_splash_switch = 1, hot_timegap = 30, loadtime = 5 };
}
else
{
return configItems[0];
}
}
[System.Serializable]
public class SplashConfigItem
{
public int firstcold_splash_switch;
public int cold_splash_switch;
public int hot_splash_switch;
public int hot_timegap;
public int loadtime;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: ad8d5f86e3dbf4c9986fcd1981e0be68

View File

@ -2,16 +2,10 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using BigoAds.Scripts.Api; using BigoAds.Scripts.Api;
using Script.Common;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.BigoAdsManager namespace WZ
{ {
public class BigoAdsManager : NormalSingleton<BigoAdsManager>, IAdService public class BigoAdsManager : NormalSingleton<BigoAdsManager>, IAdService
{ {

View File

@ -2,13 +2,9 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using BigoAds.Scripts.Api; using BigoAds.Scripts.Api;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.BigoAdsManager namespace WZ
{ {
public class BigoInterstitialAdManager public class BigoInterstitialAdManager

View File

@ -2,12 +2,9 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using BigoAds.Scripts.Api; using BigoAds.Scripts.Api;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.BigoAdsManager namespace WZ
{ {
public class BigoRewardedAdManager public class BigoRewardedAdManager

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Constant namespace WZ
{ {
public enum AdsType public enum AdsType
{ {

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Constant namespace WZ
{ {
public enum BannerAliignType public enum BannerAliignType
{ {

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Constant namespace WZ
{ {
public enum IvType public enum IvType
{ {

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Constant namespace WZ
{ {
public enum PlatformType public enum PlatformType
{ {

View File

@ -1,9 +1,9 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Script.SDKManager.AdsSDKManager.Constant;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Events.AdsEvents
namespace WZ
{ {
public class AdsActionEvents public class AdsActionEvents
{ {
@ -14,12 +14,12 @@ namespace Script.SDKManager.AdsSDKManager.Events.AdsEvents
public static void TrackAdClosed(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, string posotion, double value) public static void TrackAdClosed(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, string posotion, double value)
{ {
AdsSDKManager.Instance.otherAdsOnShow = false;
} }
public static void TrackAdStartLoad(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat) public static void TrackAdStartLoad(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat)
{ {
AdsSDKManager.Instance.otherAdsOnShow = true;
} }
public static void TrackAdLoaded(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, double loadTime) public static void TrackAdLoaded(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, double loadTime)
@ -33,18 +33,18 @@ namespace Script.SDKManager.AdsSDKManager.Events.AdsEvents
public static void TrackAdFailToShow(PlatformType adPlatform, AdsType adFormat, string reason, string pos) public static void TrackAdFailToShow(PlatformType adPlatform, AdsType adFormat, string reason, string pos)
{ {
AdsSDKManager.Instance.otherAdsOnShow = false;
} }
public static void TrackAdPosition(AdsType adFormat, string pos) public static void TrackAdPosition(AdsType adFormat, string pos)
{ {
} }
public static void TrackAdImpression(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, string posotion, double value) public static void TrackAdImpression(PlatformType adPlatform, string adSource, string adUnitName, AdsType adFormat, string posotion, double value)
{ {
} }
} }
} }

View File

@ -2,13 +2,10 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Firebase.Analytics; using Firebase.Analytics;
using Newtonsoft.Json; using Newtonsoft.Json;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using Unity.VisualScripting.Antlr3.Runtime;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Events.AdsEvents namespace WZ
{ {
public class AdsKeyEvents : NormalSingleton<AdsKeyEvents> public class AdsKeyEvents : NormalSingleton<AdsKeyEvents>
{ {

View File

@ -1,16 +1,19 @@
using UnityEngine; using UnityEngine;
public class InitResultCallbackImpl : KwaiAds.Scripts.Api.InitResultCallback namespace WZ
{ {
public void OnSuccess() public class InitResultCallbackImpl : KwaiAds.Scripts.Api.InitResultCallback
{ {
Debug.Log("快手广告初始化成功"); public void OnSuccess()
KwaiAdsManager.Instance.LoadRewardAd(); {
KwaiAdsManager.Instance.LoadInterstitialAd(); Debug.Log("快手广告初始化成功");
} KwaiAdsManager.Instance.LoadRewardAd();
KwaiAdsManager.Instance.LoadInterstitialAd();
}
public void OnFail(int code, string msg) public void OnFail(int code, string msg)
{ {
Debug.LogFormat($"快手广告初始化失败 code is {code}, msg:{msg}"); Debug.LogFormat($"快手广告初始化失败 code is {code}, msg:{msg}");
}
} }
} }

View File

@ -1,31 +1,33 @@
using KwaiAds.Scripts.Api.Interstitial; using KwaiAds.Scripts.Api.Interstitial;
using UnityEngine; using UnityEngine;
namespace WZ
public class InterstitialAdListener : IInterstitialAdListener
{ {
public void OnAdClick() public class InterstitialAdListener : IInterstitialAdListener
{ {
// 插页广告调整转换页 Interstitial ad agjust conversion page public void OnAdClick()
} {
// 插页广告调整转换页 Interstitial ad agjust conversion page
}
public void OnAdClose() public void OnAdClose()
{ {
// 插页广告关闭 | Interstitial ad close // 插页广告关闭 | Interstitial ad close
} }
public void OnAdPlayComplete() public void OnAdPlayComplete()
{ {
// 插页视频播放完成 | Interstitial video play complete // 插页视频播放完成 | Interstitial video play complete
KwaiAdsManager.Instance.OnInterstitialCallback(); KwaiAdsManager.Instance.OnInterstitialCallback();
} }
public void OnAdShow() public void OnAdShow()
{ {
// 插页视频曝光 | Interstitial video show // 插页视频曝光 | Interstitial video show
} }
public void OnAdShowFailed(int code, string msg) public void OnAdShowFailed(int code, string msg)
{ {
Debug.LogError($"RewardAdListener#OnAdShowFailed , code:{code}, msg:{msg}"); Debug.LogError($"RewardAdListener#OnAdShowFailed , code:{code}, msg:{msg}");
}
} }
} }

View File

@ -2,35 +2,38 @@
using KwaiAds.Scripts.Api.Interstitial; using KwaiAds.Scripts.Api.Interstitial;
using UnityEngine; using UnityEngine;
public class InterstitialAdLoadListener : IInterstitialAdLoadListener namespace WZ
{ {
private const int maxLoadCount = 3; public class InterstitialAdLoadListener : IInterstitialAdLoadListener
private int currentLoadCount = 0;
public void OnAdLoadFailed(string trackId, int code, string msg)
{ {
// 受国内环境限制国内无法请求到海外广告需要加白。可以将trackId反馈给对接同学进行加白。| Due to the limitations of the domestic environment, it is not possible to request overseas advertisements in China, and it is necessary to add white. You can feedback the trackId to the contact peroson to add white. private const int maxLoadCount = 3;
Debug.LogFormat($"InterstitialAdLoadListener#OnAdLoadFailed , trackId:{trackId}, code:{code}, msg:{msg}"); private int currentLoadCount = 0;
currentLoadCount++;
if (currentLoadCount < maxLoadCount) public void OnAdLoadFailed(string trackId, int code, string msg)
{ {
KwaiAdsManager.Instance.LoadRewardAd(); // 受国内环境限制国内无法请求到海外广告需要加白。可以将trackId反馈给对接同学进行加白。| Due to the limitations of the domestic environment, it is not possible to request overseas advertisements in China, and it is necessary to add white. You can feedback the trackId to the contact peroson to add white.
Debug.LogFormat($"InterstitialAdLoadListener#OnAdLoadFailed , trackId:{trackId}, code:{code}, msg:{msg}");
currentLoadCount++;
if (currentLoadCount < maxLoadCount)
{
KwaiAdsManager.Instance.LoadRewardAd();
}
} }
}
public void OnAdLoadStart(string trackId) public void OnAdLoadStart(string trackId)
{
Debug.Log($"InterstitialAdLoadListener#OnAdLoadStart , trackId:{trackId}");
}
public void OnAdLoadSuccess(string trackId, string price)
{
// price 单位是$(美元ecpm) | price in $ (dollars, ecpm)
Debug.Log($"InterstitialAdLoadListener#OnAdLoadSuccess , trackId:{trackId}, price:{price}");
if (double.TryParse(price, NumberStyles.Float, CultureInfo.InvariantCulture, out double result))
{ {
KwaiAdsManager.Instance.interstitiaAdRevenue = result; Debug.Log($"InterstitialAdLoadListener#OnAdLoadStart , trackId:{trackId}");
}
public void OnAdLoadSuccess(string trackId, string price)
{
// price 单位是$(美元ecpm) | price in $ (dollars, ecpm)
Debug.Log($"InterstitialAdLoadListener#OnAdLoadSuccess , trackId:{trackId}, price:{price}"); Debug.Log($"InterstitialAdLoadListener#OnAdLoadSuccess , trackId:{trackId}, price:{price}");
if (double.TryParse(price, NumberStyles.Float, CultureInfo.InvariantCulture, out double result))
{
KwaiAdsManager.Instance.interstitiaAdRevenue = result;
Debug.Log($"InterstitialAdLoadListener#OnAdLoadSuccess , trackId:{trackId}, price:{price}");
}
} }
} }
} }

View File

@ -2,130 +2,131 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using KwaiAds.Scripts.Api.Interstitial; using KwaiAds.Scripts.Api.Interstitial;
using KwaiAds.Scripts.Api.Reward; using KwaiAds.Scripts.Api.Reward;
using Script.SDKManager.AdsSDKManager.BigoAdsManager;
using Script.Utils;
using UnityEngine; using UnityEngine;
public class KwaiAdsManager : NormalSingleton<KwaiAdsManager> namespace WZ
{ {
//目前都是测试id public class KwaiAdsManager : NormalSingleton<KwaiAdsManager>
private const string appId = "899999";
private const string token = "EaCw0AipSYyvf3E7";
private const string rewardAdUnitId = "8999996001";
private const string interstitialAdUnitId = "8999996002";
/// <summary>
/// 目前是千倍广告价值
/// </summary>
public double rewardAdRevenue = 0;
/// <summary>
/// 插屏奖励价值 如果有竞价功能可能会用到
/// </summary>
public double interstitiaAdRevenue = 0;
private IRewardAdController rewardAdController;
private IInterstitialAdController interstitialAdController;
public void Init()
{ {
bool debug = true; // Whether in debug mode. Plsease set to false when in release build. //目前都是测试id
var kwaiAdConfig = new KwaiAds.Scripts.Api.KwaiAdConfig.Builder() private const string appId = "899999";
.SetAppId(appId) private const string token = "EaCw0AipSYyvf3E7";
.SetToken(token) private const string rewardAdUnitId = "8999996001";
.SetAppName("App Name") // Optional private const string interstitialAdUnitId = "8999996002";
.SetDebugLog(debug) // Optional
.Build();
KwaiAds.Scripts.Api.KwaiAdsSdk.Initialize(kwaiAdConfig, new InitResultCallbackImpl());
}
#region 广 /// <summary>
/// 目前是千倍广告价值
/// </summary>
public double rewardAdRevenue = 0;
/// <summary>
/// 插屏奖励价值 如果有竞价功能可能会用到
/// </summary>
public double interstitiaAdRevenue = 0;
/// <summary> private IRewardAdController rewardAdController;
/// 加载激励广告 private IInterstitialAdController interstitialAdController;
/// </summary>
public void LoadRewardAd() public void Init()
{
if (rewardAdController != null)
{ {
rewardAdController.Destroy(); bool debug = true; // Whether in debug mode. Plsease set to false when in release build.
rewardAdController = null; var kwaiAdConfig = new KwaiAds.Scripts.Api.KwaiAdConfig.Builder()
rewardAdRevenue = 0; .SetAppId(appId)
.SetToken(token)
.SetAppName("App Name") // Optional
.SetDebugLog(debug) // Optional
.Build();
KwaiAds.Scripts.Api.KwaiAdsSdk.Initialize(kwaiAdConfig, new InitResultCallbackImpl());
} }
rewardAdController = KwaiAds.Scripts.Api.KwaiAdsSdk.SDK.getRewardAdController();
KwaiRewardAdRequest kwaiRewardAdRequest = new KwaiRewardAdRequest(rewardAdUnitId);
rewardAdController.Load(kwaiRewardAdRequest, new RewardAdListener(), new RewardAdLoadListener());
}
/// <summary> #region 广
/// 展示激励广告
/// </summary> /// <summary>
public void ShowRewardAd() /// 加载激励广告
{ /// </summary>
if (rewardAdController != null) public void LoadRewardAd()
{ {
rewardAdController.Show(); if (rewardAdController != null)
{
rewardAdController.Destroy();
rewardAdController = null;
rewardAdRevenue = 0;
}
rewardAdController = KwaiAds.Scripts.Api.KwaiAdsSdk.SDK.getRewardAdController();
KwaiRewardAdRequest kwaiRewardAdRequest = new KwaiRewardAdRequest(rewardAdUnitId);
rewardAdController.Load(kwaiRewardAdRequest, new RewardAdListener(), new RewardAdLoadListener());
} }
else
/// <summary>
/// 展示激励广告
/// </summary>
public void ShowRewardAd()
{ {
if (rewardAdController != null)
{
rewardAdController.Show();
}
else
{
LoadRewardAd();
}
}
/// <summary>
/// 广告播放完成 获得奖励
/// </summary>
public void OnRewardAdCallback()
{
AdsSDKManager.Instance.OnRewardAdCallback(rewardAdRevenue);
LoadRewardAd(); LoadRewardAd();
} }
}
/// <summary> #endregion
/// 广告播放完成 获得奖励
/// </summary>
public void OnRewardAdCallback()
{
AdsSDKManager.Instance.OnRewardAdCallback(rewardAdRevenue);
LoadRewardAd();
}
#endregion #region
#region public void LoadInterstitialAd()
public void LoadInterstitialAd()
{
if (interstitialAdController != null)
{ {
interstitialAdController.Destroy(); if (interstitialAdController != null)
interstitialAdController = null; {
interstitiaAdRevenue = 0; interstitialAdController.Destroy();
interstitialAdController = null;
interstitiaAdRevenue = 0;
}
interstitialAdController = KwaiAds.Scripts.Api.KwaiAdsSdk.SDK.getInterstitialAdController();
KwaiInterstitialAdRequest kwaiInterstitialAdRequest = new KwaiInterstitialAdRequest(interstitialAdUnitId);
interstitialAdController.Load(kwaiInterstitialAdRequest, new InterstitialAdListener(), new InterstitialAdLoadListener());
} }
interstitialAdController = KwaiAds.Scripts.Api.KwaiAdsSdk.SDK.getInterstitialAdController();
KwaiInterstitialAdRequest kwaiInterstitialAdRequest = new KwaiInterstitialAdRequest(interstitialAdUnitId);
interstitialAdController.Load(kwaiInterstitialAdRequest, new InterstitialAdListener(), new InterstitialAdLoadListener());
}
public void ShowInterstitialAd() public void ShowInterstitialAd()
{
if (interstitialAdController != null)
{ {
interstitialAdController.Show(); if (interstitialAdController != null)
{
interstitialAdController.Show();
}
else
{
LoadInterstitialAd();
}
} }
else
/// <summary>
/// 广告播放完成 获得奖励
/// </summary>
public void OnInterstitialCallback()
{ {
if (AdsSDKManager.Instance.IsMoreAdsBidding)
{
AdsSDKManager.Instance.OnRewardAdCallback(interstitiaAdRevenue);
}
LoadInterstitialAd(); LoadInterstitialAd();
} }
}
#endregion
/// <summary>
/// 广告播放完成 获得奖励
/// </summary>
public void OnInterstitialCallback()
{
if (AdsSDKManager.Instance.IsMoreAdsBidding)
{
AdsSDKManager.Instance.OnRewardAdCallback(interstitiaAdRevenue);
}
LoadInterstitialAd();
} }
#endregion }
}

View File

@ -1,37 +1,40 @@
using KwaiAds.Scripts.Api.Reward; using KwaiAds.Scripts.Api.Reward;
using UnityEngine; using UnityEngine;
public class RewardAdListener : IRewardAdListener namespace WZ
{ {
public void OnAdClick() public class RewardAdListener : IRewardAdListener
{ {
// 激励广告调整转换页 | Reward ad adjustment conversion page public void OnAdClick()
} {
// 激励广告调整转换页 | Reward ad adjustment conversion page
}
public void OnAdClose() public void OnAdClose()
{ {
// 激励广告关闭 | Reward ad close // 激励广告关闭 | Reward ad close
KwaiAdsManager.Instance.LoadRewardAd(); KwaiAdsManager.Instance.LoadRewardAd();
} }
public void OnAdPlayComplete() public void OnAdPlayComplete()
{ {
// 激励视频播放完成 | Reward video play complete // 激励视频播放完成 | Reward video play complete
} }
public void OnAdShow() public void OnAdShow()
{ {
// 激励视频曝光 | Reward video show // 激励视频曝光 | Reward video show
} }
public void OnAdShowFailed(int code, string msg) public void OnAdShowFailed(int code, string msg)
{ {
Debug.LogFormat($"RewardAdListener#OnAdShowFailed , code:{code}, msg:{msg}"); Debug.LogFormat($"RewardAdListener#OnAdShowFailed , code:{code}, msg:{msg}");
} }
public void OnRewardEarned() public void OnRewardEarned()
{ {
// 获取到激励 | Reward earned // 获取到激励 | Reward earned
KwaiAdsManager.Instance.OnRewardAdCallback(); KwaiAdsManager.Instance.OnRewardAdCallback();
}
} }
} }

View File

@ -2,34 +2,37 @@
using KwaiAds.Scripts.Api.Reward; using KwaiAds.Scripts.Api.Reward;
using UnityEngine; using UnityEngine;
public class RewardAdLoadListener : IRewardAdLoadListener namespace WZ
{ {
private const int maxLoadCount = 3; public class RewardAdLoadListener : IRewardAdLoadListener
private int currentLoadCount = 0;
public void OnAdLoadFailed(string trackId, int code, string msg)
{ {
// 受国内环境限制国内无法请求到海外广告需要加白。可以将trackId反馈给对接同学进行加白。| Due to the limitations of the domestic environment, it is not possible to request overseas advertisements in China, and it is necessary to add white. You can feedback the trackId to the contact peroson to add white. private const int maxLoadCount = 3;
Debug.LogFormat($"RewardAdLoadListener#OnAdLoadFailed , trackId:{trackId}, code:{code}, msg:{msg}"); private int currentLoadCount = 0;
currentLoadCount++;
if (currentLoadCount < maxLoadCount) public void OnAdLoadFailed(string trackId, int code, string msg)
{ {
KwaiAdsManager.Instance.LoadRewardAd(); // 受国内环境限制国内无法请求到海外广告需要加白。可以将trackId反馈给对接同学进行加白。| Due to the limitations of the domestic environment, it is not possible to request overseas advertisements in China, and it is necessary to add white. You can feedback the trackId to the contact peroson to add white.
Debug.LogFormat($"RewardAdLoadListener#OnAdLoadFailed , trackId:{trackId}, code:{code}, msg:{msg}");
currentLoadCount++;
if (currentLoadCount < maxLoadCount)
{
KwaiAdsManager.Instance.LoadRewardAd();
}
} }
}
public void OnAdLoadStart(string trackId) public void OnAdLoadStart(string trackId)
{
Debug.Log($"RewardAdLoadListener#OnAdLoadStart , trackId:{trackId}");
}
public void OnAdLoadSuccess(string trackId, string price)
{
// price 单位是$(美元ecpm) | price in $ (dollars, ecpm)
if (double.TryParse(price, NumberStyles.Float, CultureInfo.InvariantCulture, out double result))
{ {
KwaiAdsManager.Instance.rewardAdRevenue = result; Debug.Log($"RewardAdLoadListener#OnAdLoadStart , trackId:{trackId}");
Debug.Log($"RewardAdLoadListener#OnAdLoadSuccess , trackId:{trackId}, price:{price}"); }
public void OnAdLoadSuccess(string trackId, string price)
{
// price 单位是$(美元ecpm) | price in $ (dollars, ecpm)
if (double.TryParse(price, NumberStyles.Float, CultureInfo.InvariantCulture, out double result))
{
KwaiAdsManager.Instance.rewardAdRevenue = result;
Debug.Log($"RewardAdLoadListener#OnAdLoadSuccess , trackId:{trackId}, price:{price}");
}
} }
} }
} }

View File

@ -4,14 +4,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Security; using System.Net.Security;
using Firebase.Analytics; using Firebase.Analytics;
using Script.Common;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.MaxAdsManager namespace WZ
{ {
public class MaxAdsManager : NormalSingleton<MaxAdsManager>, IAdService public class MaxAdsManager : NormalSingleton<MaxAdsManager>, IAdService
{ {

View File

@ -5,15 +5,9 @@ using System.Linq;
using System.Threading; using System.Threading;
using AnyThinkAds.Api; using AnyThinkAds.Api;
using AnyThinkAds.ThirdParty.LitJson; using AnyThinkAds.ThirdParty.LitJson;
using Script.Common;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.SDKManager.AdsSDKManager.Utils;
using Script.Utils;
using SDKManager.AdsSDKManager.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.TpnAdsManager namespace WZ
{ {
public class TpnAdsManager : NormalSingleton<TpnAdsManager>, IAdService public class TpnAdsManager : NormalSingleton<TpnAdsManager>, IAdService
{ {

View File

@ -1,11 +1,10 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Utils namespace WZ
{ {
public static class AdConfigParser public static class AdConfigParser
{ {

View File

@ -1,11 +1,9 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Utils namespace WZ
{ {
public class AdPlayCountManager public class AdPlayCountManager
{ {

View File

@ -1,10 +1,9 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.Utils;
using UnityEngine; using UnityEngine;
namespace Script.SDKManager.AdsSDKManager.Utils namespace WZ
{ {
public struct AdPriceInfo public struct AdPriceInfo
{ {

View File

@ -1,11 +1,9 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Script.Utils;
using UnityEngine; using UnityEngine;
using Script.SDKManager.AdsSDKManager.Constant;
namespace Script.SDKManager.AdsSDKManager.Utils namespace WZ
{ {
[Serializable] [Serializable]
public class AdTypeBidState public class AdTypeBidState

View File

@ -5,7 +5,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using UnityEngine; using UnityEngine;
namespace SDKManager.AdsSDKManager.Utils namespace WZ
{ {
public class ThreadUtils : MonoBehaviour public class ThreadUtils : MonoBehaviour
{ {

View File

@ -4,10 +4,8 @@ using System.Collections.Generic;
using EFSDK; using EFSDK;
using Firebase.RemoteConfig; using Firebase.RemoteConfig;
using Newtonsoft.Json; using Newtonsoft.Json;
using Script.Common;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.Utils;
using UnityEngine; using UnityEngine;
using WZ;
public class AppSDKManager : MonoBehaviour public class AppSDKManager : MonoBehaviour
{ {
@ -23,10 +21,15 @@ public class AppSDKManager : MonoBehaviour
FireBaseSDKManager.Instance.Init(); FireBaseSDKManager.Instance.Init();
AdjustManager.Instance.Init(); AdjustManager.Instance.Init();
ShuShuMangage.Instance.Init(); ShuShuMangage.Instance.Init();
AdsSDKManager.Instance.InitSDK();
EFSdkManager.Instance.Init(); EFSdkManager.Instance.Init();
} }
public void Init(Action action)
{
AdsSDKManager.Instance.InitSDK(action);
}
/// <summary> /// <summary>
/// 协程 /// 协程
/// </summary> /// </summary>

View File

@ -1,46 +1,48 @@
using EFSDK; using EFSDK;
using Firebase.Analytics; using Firebase.Analytics;
using Script.Utils;
using UnityEngine; using UnityEngine;
public class EFSdkManager : NormalSingleton<EFSdkManager> namespace WZ
{ {
public void Init() public class EFSdkManager : NormalSingleton<EFSdkManager>
{ {
EFSdk.get().Init((actionType, str) => public void Init()
{ {
if (EFSdk.ActionType.COIN_CLICK == actionType) EFSdk.get().Init((actionType, str) =>
{ {
//TOTO 游戏在此处理 点击金币弹广告的逻辑或其他 if (EFSdk.ActionType.COIN_CLICK == actionType)
} {
if (EFSdk.ActionType.BALLOON_CLICK == actionType) //TOTO 游戏在此处理 点击金币弹广告的逻辑或其他
{ }
//TOTO 游戏在此处理 点击宝箱弹广告的逻辑或其他 if (EFSdk.ActionType.BALLOON_CLICK == actionType)
} {
if (EFSdk.ActionType.COIN_SHOW == actionType) //TOTO 游戏在此处理 点击宝箱弹广告的逻辑或其他
{ }
if (EFSdk.ActionType.COIN_SHOW == actionType)
} {
if (EFSdk.ActionType.BOX_SHOW == actionType)
{
}
if (EFSdk.ActionType.GAM_LOAD_SUCC == actionType)
{
// 标签id,标识哪个WebView加载成功了
int id = int.Parse(str);
}
});
SetSDKEventCallback(); }
} if (EFSdk.ActionType.BOX_SHOW == actionType)
{
private void SetSDKEventCallback() }
{ if (EFSdk.ActionType.GAM_LOAD_SUCC == actionType)
EFSdk.get().SetSDKEventCallback((eventName, dict) => {
// 标签id,标识哪个WebView加载成功了
int id = int.Parse(str);
}
});
SetSDKEventCallback();
}
private void SetSDKEventCallback()
{ {
FireBaseAnalyticsManager.Instance.LogEvent(eventName, dict); EFSdk.get().SetSDKEventCallback((eventName, dict) =>
ShuShuEvent.Instance.Track(eventName, dict); {
}); FireBaseAnalyticsManager.Instance.LogEvent(eventName, dict);
ShuShuEvent.Instance.Track(eventName, dict);
});
}
} }
} }

View File

@ -3,114 +3,112 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Firebase.Analytics; using Firebase.Analytics;
using Newtonsoft.Json; using Newtonsoft.Json;
using Script.Common;
using Script.SDKManager.AdsSDKManager.Constant;
using Script.SDKManager.AdsSDKManager.Events.AdsEvents;
using Script.Utils;
/// <summary> namespace WZ
/// Firebase analytics事件上报
/// </summary>
public class FireBaseAnalyticsManager : NormalSingleton<FireBaseAnalyticsManager>
{ {
private const string KEY_SUPER_PROPERTIES = "KEY_SUPER_PROPERTIES"; /// <summary>
/// Firebase analytics事件上报
private Dictionary<string, object> superProperties = new Dictionary<string, object>(); /// </summary>
public class FireBaseAnalyticsManager : NormalSingleton<FireBaseAnalyticsManager>
{
private const string KEY_SUPER_PROPERTIES = "KEY_SUPER_PROPERTIES";
public void InitSuperProperties() private Dictionary<string, object> superProperties = new Dictionary<string, object>();
{
string json = PlayerPrefsUtils.GetPlayerPrefsString(KEY_SUPER_PROPERTIES, ""); public void InitSuperProperties()
if (!string.IsNullOrEmpty(json))
{ {
superProperties = JsonConvert.DeserializeObject<Dictionary<string, object>>(json); string json = PlayerPrefsUtils.GetPlayerPrefsString(KEY_SUPER_PROPERTIES, "");
} if (!string.IsNullOrEmpty(json))
}
public void LogEvent(string eventName)
{
List<Parameter> parameterList = new List<Parameter>();
if (superProperties != null)
{
foreach (var superProperty in superProperties)
{ {
Parameter parameter = new Parameter(superProperty.Key, superProperty.Value.ToString()); superProperties = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
parameterList.Add(parameter);
} }
} }
FirebaseAnalytics.LogEvent(eventName, parameterList.ToArray());
}
public void LogEvent(string eventName, Dictionary<string, string> dict)
{
List<Parameter> parameters = new List<Parameter>();
foreach (var item in dict)
{
Parameter parameter = new Parameter(item.Key, item.Value);
parameters.Add(parameter);
}
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, parameters.ToArray());
}
/// <summary>
/// 设置用户属性
/// </summary>
/// <param name="name"></param>
/// <param name="property"></param>
public void SetUserProperty(string name, string property)
{
Firebase.Analytics.FirebaseAnalytics.SetUserProperty(name, property);
}
/// <summary>
/// 设置用户属性
/// </summary>
/// <param name="name"></param>
/// <param name="property"></param>
public void SetUserProperty(Dictionary<string, object> propertys)
{
foreach (var property in propertys)
{
SetUserProperty(property.Key, property.Value.ToString());
}
}
/// <summary> public void LogEvent(string eventName)
/// 设置公共事件属性
/// </summary>
/// <param name="propertys"></param>
public void SetSuperProperties(Dictionary<string, object> propertys)
{
if (superProperties == null)
{ {
superProperties = new Dictionary<string, object>(); List<Parameter> parameterList = new List<Parameter>();
if (superProperties != null)
{
foreach (var superProperty in superProperties)
{
Parameter parameter = new Parameter(superProperty.Key, superProperty.Value.ToString());
parameterList.Add(parameter);
}
}
FirebaseAnalytics.LogEvent(eventName, parameterList.ToArray());
} }
foreach (var property in propertys) public void LogEvent(string eventName, Dictionary<string, string> dict)
{ {
superProperties[property.Key] = property.Value; List<Parameter> parameters = new List<Parameter>();
foreach (var item in dict)
{
Parameter parameter = new Parameter(item.Key, item.Value);
parameters.Add(parameter);
}
Firebase.Analytics.FirebaseAnalytics.LogEvent(eventName, parameters.ToArray());
}
/// <summary>
/// 设置用户属性
/// </summary>
/// <param name="name"></param>
/// <param name="property"></param>
public void SetUserProperty(string name, string property)
{
Firebase.Analytics.FirebaseAnalytics.SetUserProperty(name, property);
}
/// <summary>
/// 设置用户属性
/// </summary>
/// <param name="name"></param>
/// <param name="property"></param>
public void SetUserProperty(Dictionary<string, object> propertys)
{
foreach (var property in propertys)
{
SetUserProperty(property.Key, property.Value.ToString());
}
}
/// <summary>
/// 设置公共事件属性
/// </summary>
/// <param name="propertys"></param>
public void SetSuperProperties(Dictionary<string, object> propertys)
{
if (superProperties == null)
{
superProperties = new Dictionary<string, object>();
}
foreach (var property in propertys)
{
superProperties[property.Key] = property.Value;
}
string json = JsonConvert.SerializeObject(superProperties);
PlayerPrefsUtils.SavePlayerPrefsString(KEY_SUPER_PROPERTIES, json);
} }
string json = JsonConvert.SerializeObject(superProperties);
PlayerPrefsUtils.SavePlayerPrefsString(KEY_SUPER_PROPERTIES, json);
}
/// <summary> /// <summary>
/// FireBase收益上报 /// FireBase收益上报
/// </summary> /// </summary>
/// <param name="ad_platform">聚合平台名称</param> /// <param name="ad_platform">聚合平台名称</param>
/// <param name="ad_source">广告平台名称</param> /// <param name="ad_source">广告平台名称</param>
/// <param name="ad_unit_name">广告位ID</param> /// <param name="ad_unit_name">广告位ID</param>
/// <param name="ad_format">广告格式</param> /// <param name="ad_format">广告格式</param>
/// <param name="revenue">单次展示收益</param> /// <param name="revenue">单次展示收益</param>
/// <param name="position">广告展示点位</param> /// <param name="position">广告展示点位</param>
/// <param name="number">第几次展示该格式的广告</param> /// <param name="number">第几次展示该格式的广告</param>
public void OnAdRevenueEvent(string ad_platform, string ad_source, string ad_unit_name, AdsType ad_format, double revenue, string position, int number) public void OnAdRevenueEvent(string ad_platform, string ad_source, string ad_unit_name, AdsType ad_format, double revenue, string position, int number)
{ {
var impressionParameters = new[] { var impressionParameters = new[] {
new Firebase.Analytics.Parameter("ad_platform", ad_platform), new Firebase.Analytics.Parameter("ad_platform", ad_platform),
new Firebase.Analytics.Parameter("ad_source", ad_source), new Firebase.Analytics.Parameter("ad_source", ad_source),
new Firebase.Analytics.Parameter("ad_unit_name",ad_unit_name), new Firebase.Analytics.Parameter("ad_unit_name",ad_unit_name),
@ -121,50 +119,51 @@ public class FireBaseAnalyticsManager : NormalSingleton<FireBaseAnalyticsManager
new Firebase.Analytics.Parameter("number", number), new Firebase.Analytics.Parameter("number", number),
}; };
string name = GetName(); string name = GetName();
Firebase.Analytics.FirebaseAnalytics.LogEvent(name, impressionParameters); Firebase.Analytics.FirebaseAnalytics.LogEvent(name, impressionParameters);
AdsKeyEvents.Instance.LogAdCountEvents(ad_format, revenue); AdsKeyEvents.Instance.LogAdCountEvents(ad_format, revenue);
}
/// <summary>
/// 收益分离
/// </summary>
/// <returns></returns>
private string GetName()
{
string name = "ad_impression";
//获取在线参数
string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("revenue_fir");
if (string.IsNullOrEmpty(json))
{
return name;
}
var revenueAdjs = JsonConvert.DeserializeObject<RevenueData[]>(json);
if (revenueAdjs == null && revenueAdjs.Length == 0)
{
return name;
} }
int totalRate = 0; /// <summary>
//获取全部概率 /// 收益分离
foreach (var item in revenueAdjs) /// </summary>
/// <returns></returns>
private string GetName()
{ {
totalRate += item.rate; string name = "ad_impression";
} //获取在线参数
//开始随机 string json = FireBaseRemoteConfigManager.Instance.GetRemoteConfigString("revenue_fir");
int randomValue = UnityEngine.Random.Range(0, totalRate); if (string.IsNullOrEmpty(json))
int accumulatedRate = 0;
//根据随机值定位
foreach (var item in revenueAdjs)
{
accumulatedRate += item.rate;
if (randomValue < accumulatedRate)
{ {
return item.name; return name;
}
var revenueAdjs = JsonConvert.DeserializeObject<RevenueData[]>(json);
if (revenueAdjs == null && revenueAdjs.Length == 0)
{
return name;
} }
}
return name; int totalRate = 0;
//获取全部概率
foreach (var item in revenueAdjs)
{
totalRate += item.rate;
}
//开始随机
int randomValue = UnityEngine.Random.Range(0, totalRate);
int accumulatedRate = 0;
//根据随机值定位
foreach (var item in revenueAdjs)
{
accumulatedRate += item.rate;
if (randomValue < accumulatedRate)
{
return item.name;
}
}
return name;
}
} }
} }

View File

@ -2,218 +2,219 @@
using System.Globalization; using System.Globalization;
using Firebase.Extensions; using Firebase.Extensions;
using Firebase.RemoteConfig; using Firebase.RemoteConfig;
using Script.Utils;
using SDK.Utils;
using UnityEngine; using UnityEngine;
public class FireBaseRemoteConfigManager : NormalSingleton<FireBaseRemoteConfigManager> namespace WZ
{ {
public void FetchRemoteConfig() public class FireBaseRemoteConfigManager : NormalSingleton<FireBaseRemoteConfigManager>
{ {
Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task => public void FetchRemoteConfig()
{ {
if (task.Result == Firebase.DependencyStatus.Available) Firebase.FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
{ {
Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero).ContinueWithOnMainThread(task => if (task.Result == Firebase.DependencyStatus.Available)
{ {
FirebaseRemoteConfig.DefaultInstance.ActivateAsync().ContinueWithOnMainThread(task => Firebase.RemoteConfig.FirebaseRemoteConfig.DefaultInstance.FetchAsync(TimeSpan.Zero).ContinueWithOnMainThread(task =>
{ {
// adjust卸载监控 FirebaseRemoteConfig.DefaultInstance.ActivateAsync().ContinueWithOnMainThread(task =>
{
/* 执行到这时表示firebase接入正常能获取到远端在线参数 */ // adjust卸载监控
// 设置 firebase 初始化成功 flag /* 执行到这时表示firebase接入正常能获取到远端在线参数 */
// 初始化广告 // 设置 firebase 初始化成功 flag
// 检查Adjust归因 // 初始化广告
// 检查Adjust归因
});
}); });
}); }
} });
});
}
/// <summary>
/// 获取int参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public int GetRemoteConfigInt(string key, int defaultValue = 0, bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
int value = (int)GetValueLong(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {value}, No Is defaultValue");
return value;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
} }
catch (Exception e)
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
return defaultValue;
}
}
/// <summary>
/// 获取string参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public string GetRemoteConfigString(string key, string defaultValue = "", bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
string valueStr = GetValueStr(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {valueStr}, No Is defaultValue");
return valueStr;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
catch (Exception e)
{
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
/// <summary>
/// 获取bool参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public bool GetRemoteConfigBool(string key, bool defaultValue = false, bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
bool valueBool = GetValueBool(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {valueBool}, No Is defaultValue");
return valueBool;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
catch (Exception e)
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
return defaultValue;
}
}
/// <summary>
/// 获取float参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public float GetRemoteConfigFloat(string key, float defaultValue = 0, bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
float valueFloat = (float)GetValueDouble(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {valueFloat}, No Is defaultValue");
return valueFloat;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
catch (Exception e)
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
return defaultValue;
}
}
/// <summary>
/// 是否是加密
/// </summary>
/// <returns></returns>
private bool IsEncrypt(string key)
{
return key.StartsWith("CCB", StringComparison.OrdinalIgnoreCase);
}
private string GetKey(string key, bool isEncrypt) /// <summary>
{ /// 获取int参数
//ccb开头 忽略大小写 /// </summary>
return isEncrypt ? $"ccb{EncryptionUtils.AesEncrypt(AppSDKManager.PackageName, key)}" : key; /// <param name="key"></param>
} /// <param name="defaultValue"></param>
/// <returns></returns>
private string GetValueStr(string key, ConfigValue configValue) public int GetRemoteConfigInt(string key, int defaultValue = 0, bool IsEncrypt = false)
{
return IsEncrypt(key) ? EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue) : configValue.StringValue;
}
private long GetValueLong(string key, ConfigValue configValue)
{
return IsEncrypt(key) ? long.Parse(EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue)) : configValue.LongValue;
}
private bool GetValueBool(string key, ConfigValue configValue)
{
return IsEncrypt(key) ? bool.Parse(EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue)) : configValue.BooleanValue;
}
private double GetValueDouble(string key, ConfigValue configValue)
{
if (IsEncrypt(key))
{ {
string valueStr = EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue); try
if (float.TryParse(valueStr, NumberStyles.Float, CultureInfo.InvariantCulture, out float result))
{ {
return result; string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
int value = (int)GetValueLong(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {value}, No Is defaultValue");
return value;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
} }
catch (Exception e)
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
return defaultValue;
}
}
/// <summary>
/// 获取string参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public string GetRemoteConfigString(string key, string defaultValue = "", bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
string valueStr = GetValueStr(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {valueStr}, No Is defaultValue");
return valueStr;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
catch (Exception e)
{
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
/// <summary>
/// 获取bool参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public bool GetRemoteConfigBool(string key, bool defaultValue = false, bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
bool valueBool = GetValueBool(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {valueBool}, No Is defaultValue");
return valueBool;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
catch (Exception e)
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
return defaultValue;
}
}
/// <summary>
/// 获取float参数
/// </summary>
/// <param name="key"></param>
/// <param name="defaultValue"></param>
/// <returns></returns>
public float GetRemoteConfigFloat(string key, float defaultValue = 0, bool IsEncrypt = false)
{
try
{
string newKey = GetKey(key, IsEncrypt);
// 获取值
var configValue = FirebaseRemoteConfig.DefaultInstance.GetValue(newKey);
if (configValue.Source == ValueSource.RemoteValue)
{
float valueFloat = (float)GetValueDouble(newKey, configValue);
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {valueFloat}, No Is defaultValue");
return valueFloat;
}
else
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
return defaultValue;
}
}
catch (Exception e)
{
LoggerUtils.Debug($"[RemoteConfig] key is {key}, defaultValue is {defaultValue}, value is {defaultValue}, Is defaultValue");
Debug.LogError($"Failed to get Remote Config value for key '{key}': {e.Message}");
return defaultValue;
}
}
/// <summary>
/// 是否是加密
/// </summary>
/// <returns></returns>
private bool IsEncrypt(string key)
{
return key.StartsWith("CCB", StringComparison.OrdinalIgnoreCase);
}
private string GetKey(string key, bool isEncrypt)
{
//ccb开头 忽略大小写
return isEncrypt ? $"ccb{EncryptionUtils.AesEncrypt(AppSDKManager.PackageName, key)}" : key;
}
private string GetValueStr(string key, ConfigValue configValue)
{
return IsEncrypt(key) ? EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue) : configValue.StringValue;
}
private long GetValueLong(string key, ConfigValue configValue)
{
return IsEncrypt(key) ? long.Parse(EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue)) : configValue.LongValue;
}
private bool GetValueBool(string key, ConfigValue configValue)
{
return IsEncrypt(key) ? bool.Parse(EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue)) : configValue.BooleanValue;
}
private double GetValueDouble(string key, ConfigValue configValue)
{
if (IsEncrypt(key))
{
string valueStr = EncryptionUtils.AesDecrypt(AppSDKManager.PackageName, configValue.StringValue);
if (float.TryParse(valueStr, NumberStyles.Float, CultureInfo.InvariantCulture, out float result))
{
return result;
}
}
return configValue.DoubleValue;
} }
return configValue.DoubleValue;
} }
} }

View File

@ -3,19 +3,21 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Firebase; using Firebase;
using Firebase.RemoteConfig; using Firebase.RemoteConfig;
using Script.Utils;
using UnityEngine; using UnityEngine;
public class FireBaseSDKManager : NormalSingleton<FireBaseSDKManager> namespace WZ
{ {
public void Init() public class FireBaseSDKManager : NormalSingleton<FireBaseSDKManager>
{ {
InitSDK(); public void Init()
} {
InitSDK();
}
private void InitSDK() private void InitSDK()
{ {
FireBaseRemoteConfigManager.Instance.FetchRemoteConfig(); FireBaseRemoteConfigManager.Instance.FetchRemoteConfig();
FireBaseAnalyticsManager.Instance.InitSuperProperties(); FireBaseAnalyticsManager.Instance.InitSuperProperties();
}
} }
} }

View File

@ -1,91 +1,93 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Script.Utils;
using ThinkingData.Analytics; using ThinkingData.Analytics;
public class ShuShuEvent : NormalSingleton<ShuShuEvent> namespace WZ
{ {
/// <summary> public class ShuShuEvent : NormalSingleton<ShuShuEvent>
/// 设置用户属性
/// </summary>
public void UserSet(Dictionary<string, object> dic)
{ {
TDAnalytics.UserSet(dic); /// <summary>
} /// 设置用户属性
/// </summary>
public void UserSet(Dictionary<string, object> dic)
{
TDAnalytics.UserSet(dic);
}
/// <summary> /// <summary>
/// 设置公共事件属性 /// 设置公共事件属性
/// </summary> /// </summary>
/// <param name="superProperties"></param> /// <param name="superProperties"></param>
public void SetSuperProperties(Dictionary<string, object> superProperties) public void SetSuperProperties(Dictionary<string, object> superProperties)
{ {
TDAnalytics.SetSuperProperties(superProperties);//设置公共事件属性 TDAnalytics.SetSuperProperties(superProperties);//设置公共事件属性
} }
/// <summary> /// <summary>
/// 发送事件 /// 发送事件
/// </summary> /// </summary>
public void Track(string eventName) public void Track(string eventName)
{ {
TDAnalytics.Track(eventName); TDAnalytics.Track(eventName);
} }
/// <summary>
/// 发送事件
/// </summary>
public void Track(string eventName, string key1, object value1)
{
var extraInfo = new Dictionary<string, object>();
if (key1 != null && value1 != null)
{
extraInfo[key1] = value1;
}
Track(eventName, extraInfo); /// <summary>
} /// 发送事件
/// </summary>
/// <summary> public void Track(string eventName, string key1, object value1)
/// 发送事件 {
/// </summary> var extraInfo = new Dictionary<string, object>();
public void Track(string eventName, Dictionary<string, object> properties) if (key1 != null && value1 != null)
{ {
TDAnalytics.Track(eventName, properties); extraInfo[key1] = value1;
} }
/// <summary>
/// 发送事件
/// </summary>
public void Track(string eventName, Dictionary<string, string> properties)
{
var newProperties = properties.ToDictionary(
pair => pair.Key,
pair => (object)pair.Value
);
TDAnalytics.Track(eventName, newProperties);
}
/// <summary>
/// 数数收益上报
/// </summary>
/// <param name="ad_platform">聚合平台名称</param>
/// <param name="ad_source">广告平台名称</param>
/// <param name="ad_unit_name">广告位ID</param>
/// <param name="ad_format">广告格式</param>
/// <param name="revenue">单次展示收益</param>
/// <param name="position">广告展示点位</param>
/// <param name="number">第几次展示该格式的广告</param>
public void OnAdRevenueEvent(string ad_platform, string ad_source, string ad_unit_name, string ad_format, double revenue, string position, int number)
{
Dictionary<string, object> properties = new Dictionary<string, object>();
properties.Add("ad_platform", ad_platform);
properties.Add("ad_source", ad_source);
properties.Add("ad_unit_name", ad_unit_name);
properties.Add("ad_format", ad_format);
properties.Add("value", revenue);
properties.Add("currency", "USD");
properties.Add("position", position);
properties.Add("number", number);
TDAnalytics.Track("ad_impression", properties); Track(eventName, extraInfo);
}
/// <summary>
/// 发送事件
/// </summary>
public void Track(string eventName, Dictionary<string, object> properties)
{
TDAnalytics.Track(eventName, properties);
}
/// <summary>
/// 发送事件
/// </summary>
public void Track(string eventName, Dictionary<string, string> properties)
{
var newProperties = properties.ToDictionary(
pair => pair.Key,
pair => (object)pair.Value
);
TDAnalytics.Track(eventName, newProperties);
}
/// <summary>
/// 数数收益上报
/// </summary>
/// <param name="ad_platform">聚合平台名称</param>
/// <param name="ad_source">广告平台名称</param>
/// <param name="ad_unit_name">广告位ID</param>
/// <param name="ad_format">广告格式</param>
/// <param name="revenue">单次展示收益</param>
/// <param name="position">广告展示点位</param>
/// <param name="number">第几次展示该格式的广告</param>
public void OnAdRevenueEvent(string ad_platform, string ad_source, string ad_unit_name, string ad_format, double revenue, string position, int number)
{
Dictionary<string, object> properties = new Dictionary<string, object>();
properties.Add("ad_platform", ad_platform);
properties.Add("ad_source", ad_source);
properties.Add("ad_unit_name", ad_unit_name);
properties.Add("ad_format", ad_format);
properties.Add("value", revenue);
properties.Add("currency", "USD");
properties.Add("position", position);
properties.Add("number", number);
TDAnalytics.Track("ad_impression", properties);
}
} }
} }

View File

@ -1,22 +1,23 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Script.Utils;
using ThinkingData.Analytics; using ThinkingData.Analytics;
using UnityEngine; using UnityEngine;
namespace WZ
public class ShuShuMangage : NormalSingleton<ShuShuMangage>
{ {
private const string appid = "80f6819a81c743cbad667ecf242f3133"; public class ShuShuMangage : NormalSingleton<ShuShuMangage>
private const string server = "https://global-receiver-ta.thinkingdata.cn";
public void Init()
{ {
// 初始化SDK private const string appid = "80f6819a81c743cbad667ecf242f3133";
TDAnalytics.Init(appid, server); private const string server = "https://global-receiver-ta.thinkingdata.cn";
//开启自动采集事件
TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppInstall | TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd);
//如果用户已登录可以设置用户的账号ID作为身份唯一标识
TDAnalytics.Login("TA");
}
} public void Init()
{
// 初始化SDK
TDAnalytics.Init(appid, server);
//开启自动采集事件
TDAnalytics.EnableAutoTrack(TDAutoTrackEventType.AppInstall | TDAutoTrackEventType.AppStart | TDAutoTrackEventType.AppEnd);
//如果用户已登录可以设置用户的账号ID作为身份唯一标识
TDAnalytics.Login("TA");
}
}
}

View File

@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using WZ;
public class Test : MonoBehaviour public class Test : MonoBehaviour
{ {

View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace WZ
{
public static class DataUtils
{
[System.Serializable]
private class Wrapper<T>
{
public T[] items;
}
public static T[] FromJsonArray<T>(string json)
{
string wrappedJson = $"{{\"items\":{json}}}";
Wrapper<T> wrapper = JsonUtility.FromJson<Wrapper<T>>(wrappedJson);
return wrapper.items;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: be1bd83cd48f44fa59b93f7ee10ec4fc

View File

@ -5,7 +5,7 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using UnityEngine; using UnityEngine;
namespace SDK.Utils namespace WZ
{ {
public static class EncryptionUtils public static class EncryptionUtils
{ {

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
namespace Script.Utils namespace WZ
{ {
public static class LoggerUtils public static class LoggerUtils
{ {

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.Utils namespace WZ
{ {
public class PlayerPrefsUtils public class PlayerPrefsUtils
{ {

View File

@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
namespace Script.Utils namespace WZ
{ {
public abstract class NormalSingleton<T> where T : new() public abstract class NormalSingleton<T> where T : new()
{ {

View File

@ -1,6 +1,6 @@
using System; using System;
namespace Script.Utils namespace WZ
{ {
public class TimeUtils public class TimeUtils
{ {

View File

@ -3,7 +3,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace Script.Utils namespace WZ
{ {
public class TimerUtils : MonoBehaviour public class TimerUtils : MonoBehaviour
{ {