com.guru.unity.sdk/Runtime/Code/Config/GuruSDKInitConfig.cs

135 lines
4.8 KiB
C#
Raw Normal View History

2023-12-26 03:40:48 +00:00
namespace Guru
{
using System.Collections.Generic;
using System.Text;
/// <summary>
/// 启动参数配置
/// </summary>
public partial class GuruSDKInitConfig
{
/// <summary>
/// 使用自定义的ConsentFlow启动流程
/// </summary>
public bool UseCustomConsent = false;
/// <summary>
/// SDK初始化完成后自动加载广告
/// </summary>
public bool AutoLoadWhenAdsReady = true;
/// <summary>
/// 使用IAP支付插件功能
/// </summary>
public bool IAPEnabled = true;
/// <summary>
2024-06-20 10:30:22 +00:00
/// 自动申请推送授权信息
/// </summary>
public bool AutoNotificationPermission = true;
/// <summary>
2023-12-26 03:40:48 +00:00
/// 自动记录完成的关卡
/// </summary>
public bool AutoRecordFinishedLevels = true;
/// <summary>
2024-03-11 10:51:49 +00:00
/// 自定义 Service 云控 Key
/// </summary>
public string CustomServiceKey = "";
/// <summary>
/// Banner 背景颜色 Hex 值
/// </summary>
public string BannerBackgroundColor = "#00000000";
/// <summary>
/// 已购买去广告道具
/// </summary>
public bool IsBuyNoAds = false;
/// <summary>
2024-01-17 12:46:23 +00:00
/// Debug模式默认关闭
2023-12-26 03:40:48 +00:00
/// </summary>
2024-01-17 12:46:23 +00:00
public bool DebugMode = false;
2023-12-26 03:40:48 +00:00
/// <summary>
/// Debug模式下开启打点默认关闭
/// </summary>
public bool EnableDebugLogEvent = false;
/// <summary>
2023-12-28 07:54:00 +00:00
/// 云控参数的默认配置
2023-12-26 03:40:48 +00:00
/// </summary>
/// <returns></returns>
public Dictionary<string, object> DefaultRemoteData = new Dictionary<string, object>();
/// <summary>
/// 启用 AdjustDeeplink
/// </summary>
public bool UseAdjustDeeplink = false;
2023-12-26 03:40:48 +00:00
/// <summary>
/// 支付初始化Keys
/// </summary>
2024-05-15 01:58:22 +00:00
public byte[] GoogleKeys; // 数据取自 GooglePlayTangle.Data();
public byte[] AppleRootCerts; // 数据取自 AppleTangle.Data();
2023-12-26 03:40:48 +00:00
#region Initialization
/// <summary>
/// 构建启动配置
/// </summary>
/// <returns></returns>
public static GuruSDKInitConfig Build(
bool useCustomConsent = false,
bool autoLoadAds = true,
bool iapEnabled = true,
bool autoRecordFinishedLevels = true,
bool isBuyNoAds = false,
string bannerBackgroundColor = "#00000000",
2024-01-18 09:03:53 +00:00
bool debugMode = false,
bool useAdjustDeeplink = false,
2023-12-26 03:40:48 +00:00
Dictionary<string, object> defaultRemoteData = null,
byte[] googleKeys = null,
byte[] appleRootCerts = null,
bool debugEnableEventLog = false)
2023-12-26 03:40:48 +00:00
{
// 创建启动用参数
GuruSDKInitConfig config = new GuruSDKInitConfig()
{
UseCustomConsent = useCustomConsent,
AutoLoadWhenAdsReady = autoLoadAds,
IAPEnabled = iapEnabled,
AutoRecordFinishedLevels = autoRecordFinishedLevels,
IsBuyNoAds = isBuyNoAds,
BannerBackgroundColor = bannerBackgroundColor,
2024-01-18 09:03:53 +00:00
DebugMode = debugMode,
UseAdjustDeeplink = useAdjustDeeplink,
2023-12-26 03:40:48 +00:00
GoogleKeys = googleKeys,
AppleRootCerts = appleRootCerts,
DefaultRemoteData = defaultRemoteData ?? new Dictionary<string, object>(),
EnableDebugLogEvent = debugEnableEventLog,
2023-12-26 03:40:48 +00:00
};
#if UNITY_EDITOR
2024-01-17 12:46:23 +00:00
config.DebugMode = true;
2023-12-26 03:40:48 +00:00
#endif
return config;
}
#endregion
#region Print
public override string ToString()
{
StringBuilder sb = new StringBuilder();
2024-06-21 06:39:55 +00:00
sb.AppendLine($"------- Custom InitConfig -------");
sb.AppendLine($"\t UseCustomConsent: {UseCustomConsent}");
sb.AppendLine($"\t AutoLoadWhenAdsReady: {AutoLoadWhenAdsReady}");
sb.AppendLine($"\t IAPEnabled: {IAPEnabled}");
sb.AppendLine($"\t AutoNotificationPermission: {AutoNotificationPermission}");
sb.AppendLine($"\t AutoRecordFinishedLevels: {AutoRecordFinishedLevels}");
sb.AppendLine($"\t CustomServiceKey: {CustomServiceKey}");
sb.AppendLine($"\t BannerBackgroundColor: {BannerBackgroundColor}");
sb.AppendLine($"\t IsBuyNoAds: {IsBuyNoAds}");
sb.AppendLine($"\t DebugMode: {DebugMode}");
sb.AppendLine($"\t DefaultRemote: Count: {DefaultRemoteData.Count}");
sb.AppendLine($"------- Custom InitConfig -------");
2023-12-26 03:40:48 +00:00
return sb.ToString();
}
#endregion
}
}