diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs
index daf0043..e9e774a 100644
--- a/Runtime/Code/SDK/GuruSDK.Ads.cs
+++ b/Runtime/Code/SDK/GuruSDK.Ads.cs
@@ -27,15 +27,27 @@ namespace Guru
Instance.StartConsentFlow();
}
+ ///
+ /// 是否已经购买了去广告
+ ///
+ ///
+ public static void StartAds(bool buyNoAds = false)
+ {
+ StartAds(AdsInitSpec.BuildWithNoAds()); // 按照默认的去广告来生成广告启动配置
+ }
+
+
///
/// 使用自定义的Consent, 获取用户授权后, 调用此方法
///
///
- /// Consent 引导的类型, 如果使用了 MAX 的 consent 请填写 max
- public static void StartAdsWithCustomConsent(bool userAllow = true, string guideType = "custom", AdsInitSpec spec = null)
+ /// Consent 引导的类型, 如果使用了 MAX 的 consent 请填写 max
+ /// 广告启动配置
+ public static void StartAdsWithCustomConsent(bool userAllow = true,
+ string consentName = "custom", AdsInitSpec spec = null)
{
#if UNITY_IOS
- _attType = guideType;
+ _attType = consentName;
InitAttStatus();
#endif
if (userAllow)
@@ -52,6 +64,17 @@ namespace Guru
}
}
+ ///
+ /// 使用自定义的Consent, 获取用户授权后, 调用此方法
+ ///
+ /// 自定义 Consent 的用户授权结果
+ /// Consent引导名称
+ /// 是否已经购买了去广告
+ public static void StartAdsWithCustomConsent(bool userAllow = true, string consentName = "custom",
+ bool buyNoAds = false)
+ {
+ StartAdsWithCustomConsent(userAllow, consentName, AdsInitSpec.BuildWithNoAds());
+ }
#region Guru Consent
@@ -88,6 +111,7 @@ namespace Guru
///
private void OnGuruConsentOver(int code)
{
+
// 无论状态如何, 都在回调内启动广告初始化
StartAdService(_adInitSpec);
@@ -192,7 +216,14 @@ namespace Guru
internal static void StartAdService(AdsInitSpec spec = null)
{
LogI($"StartAdService");
- if(spec == null) spec = AdsInitSpec.BuildDefault(InitConfig.AutoLoadWhenAdsReady, IsDebugMode);
+ if (spec == null)
+ {
+ spec = AdsInitSpec.BuildDefault(InitConfig.AutoLoadWhenAdsReady, IsDebugMode);
+ if (ADService.Instance.IsBuyNoAds)
+ {
+ spec = AdsInitSpec.BuildWithNoAds(InitConfig.AutoLoadWhenAdsReady, IsDebugMode);
+ }
+ }
ADService.Instance.StartService(OnAdsInitComplete, spec);
//--------- Callbacks -----------
diff --git a/Runtime/Code/SDK/GuruSDK.IAP.cs b/Runtime/Code/SDK/GuruSDK.IAP.cs
index 6b130aa..305f634 100644
--- a/Runtime/Code/SDK/GuruSDK.IAP.cs
+++ b/Runtime/Code/SDK/GuruSDK.IAP.cs
@@ -228,5 +228,19 @@ namespace Guru
#endregion
+ #region Buy NoAds
+
+
+ ///
+ /// 设置购买去广告道具的标志位
+ ///
+ ///
+ public static void SetBuyNoAds(bool value = true)
+ {
+ ADService.Instance.IsBuyNoAds = value;
+ }
+
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs
index d24d2a3..0554df4 100644
--- a/Runtime/Code/SDK/GuruSDK.cs
+++ b/Runtime/Code/SDK/GuruSDK.cs
@@ -245,9 +245,6 @@ namespace Guru
if (_appServicesConfig.UseUUID())
{
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
-
-
-
}
#if UNITY_IOS