update: 添加启动广告的快捷方式, 并且添加去广告标志位
parent
b7051d3267
commit
d2232e303b
|
|
@ -27,15 +27,27 @@ namespace Guru
|
||||||
Instance.StartConsentFlow();
|
Instance.StartConsentFlow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否已经购买了去广告
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="buyNoAds"></param>
|
||||||
|
public static void StartAds(bool buyNoAds = false)
|
||||||
|
{
|
||||||
|
StartAds(AdsInitSpec.BuildWithNoAds()); // 按照默认的去广告来生成广告启动配置
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用自定义的Consent, 获取用户授权后, 调用此方法
|
/// 使用自定义的Consent, 获取用户授权后, 调用此方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userAllow"></param>
|
/// <param name="userAllow"></param>
|
||||||
/// <param name="guideType">Consent 引导的类型, 如果使用了 MAX 的 consent 请填写 max </param>
|
/// <param name="consentName">Consent 引导的类型, 如果使用了 MAX 的 consent 请填写 max </param>
|
||||||
public static void StartAdsWithCustomConsent(bool userAllow = true, string guideType = "custom", AdsInitSpec spec = null)
|
/// <param name="spec">广告启动配置</param>
|
||||||
|
public static void StartAdsWithCustomConsent(bool userAllow = true,
|
||||||
|
string consentName = "custom", AdsInitSpec spec = null)
|
||||||
{
|
{
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
_attType = guideType;
|
_attType = consentName;
|
||||||
InitAttStatus();
|
InitAttStatus();
|
||||||
#endif
|
#endif
|
||||||
if (userAllow)
|
if (userAllow)
|
||||||
|
|
@ -52,6 +64,17 @@ namespace Guru
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 使用自定义的Consent, 获取用户授权后, 调用此方法
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userAllow">自定义 Consent 的用户授权结果</param>
|
||||||
|
/// <param name="consentName">Consent引导名称</param>
|
||||||
|
/// <param name="buyNoAds">是否已经购买了去广告</param>
|
||||||
|
public static void StartAdsWithCustomConsent(bool userAllow = true, string consentName = "custom",
|
||||||
|
bool buyNoAds = false)
|
||||||
|
{
|
||||||
|
StartAdsWithCustomConsent(userAllow, consentName, AdsInitSpec.BuildWithNoAds());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Guru Consent
|
#region Guru Consent
|
||||||
|
|
@ -88,6 +111,7 @@ namespace Guru
|
||||||
/// <param name="code"></param>
|
/// <param name="code"></param>
|
||||||
private void OnGuruConsentOver(int code)
|
private void OnGuruConsentOver(int code)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 无论状态如何, 都在回调内启动广告初始化
|
// 无论状态如何, 都在回调内启动广告初始化
|
||||||
StartAdService(_adInitSpec);
|
StartAdService(_adInitSpec);
|
||||||
|
|
||||||
|
|
@ -192,7 +216,14 @@ namespace Guru
|
||||||
internal static void StartAdService(AdsInitSpec spec = null)
|
internal static void StartAdService(AdsInitSpec spec = null)
|
||||||
{
|
{
|
||||||
LogI($"StartAdService");
|
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);
|
ADService.Instance.StartService(OnAdsInitComplete, spec);
|
||||||
|
|
||||||
//--------- Callbacks -----------
|
//--------- Callbacks -----------
|
||||||
|
|
|
||||||
|
|
@ -228,5 +228,19 @@ namespace Guru
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Buy NoAds
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置购买去广告道具的标志位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public static void SetBuyNoAds(bool value = true)
|
||||||
|
{
|
||||||
|
ADService.Instance.IsBuyNoAds = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -245,9 +245,6 @@ namespace Guru
|
||||||
if (_appServicesConfig.UseUUID())
|
if (_appServicesConfig.UseUUID())
|
||||||
{
|
{
|
||||||
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
|
IPMConfig.UsingUUID = true; // 开始使用 UUID 作为 DeviceID 标识
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_IOS
|
#if UNITY_IOS
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue