diff --git a/Runtime/Code/Config/GuruSDKInitConfig.cs b/Runtime/Code/Config/GuruSDKInitConfig.cs index f23b92e..b708364 100644 --- a/Runtime/Code/Config/GuruSDKInitConfig.cs +++ b/Runtime/Code/Config/GuruSDKInitConfig.cs @@ -28,6 +28,14 @@ namespace Guru /// public string CustomServiceKey = ""; /// + /// Banner 背景颜色 Hex 值 + /// + public string BannerBackgroundColor = "#00000000"; + /// + /// 已购买去广告道具 + /// + public bool IsBuyNoAds = false; + /// /// Debug模式(默认关闭) /// public bool DebugMode = false; @@ -54,6 +62,8 @@ namespace Guru bool autoLoadAds = true, bool iapEnabled = true, bool autoRecordFinishedLevels = true, + bool isBuyNoAds = false, + string bannerBackgroundColor = "#00000000", bool debugMode = false, Dictionary defaultRemoteData = null, byte[] googleKeys = null, @@ -66,6 +76,8 @@ namespace Guru AutoLoadWhenAdsReady = autoLoadAds, IAPEnabled = iapEnabled, AutoRecordFinishedLevels = autoRecordFinishedLevels, + IsBuyNoAds = isBuyNoAds, + BannerBackgroundColor = bannerBackgroundColor, DebugMode = debugMode, GoogleKeys = googleKeys, AppleRootCerts = appleRootCerts, diff --git a/Runtime/Code/SDK/GuruSDK.Ads.cs b/Runtime/Code/SDK/GuruSDK.Ads.cs index 5120540..51bd74c 100644 --- a/Runtime/Code/SDK/GuruSDK.Ads.cs +++ b/Runtime/Code/SDK/GuruSDK.Ads.cs @@ -239,6 +239,10 @@ namespace Guru /// internal static void StartAdService(AdsInitSpec spec = null) { + + //---------- Using InitConfig ---------- + if (InitConfig is { IsBuyNoAds: true }) SetBuyNoAds(true); + LogI($"StartAdService"); if (spec == null) { @@ -248,14 +252,19 @@ namespace Guru spec = AdsInitSpec.BuildWithNoAds(InitConfig.AutoLoadWhenAdsReady, IsDebugMode); } } - ADService.Instance.StartService(OnAdsInitComplete, spec); - //--------- Callbacks ----------- + if(InitConfig != null && !string.IsNullOrEmpty(InitConfig.BannerBackgroundColor)) + spec.bannerColorHex = InitConfig.BannerBackgroundColor; + + //--------- Add Callbacks ----------- ADService.OnBannerLoaded = OnBannerLoaded; ADService.OnInterstitialLoaded = OnInterstitialLoaded; ADService.OnInterstitialFailed = OnInterstitialFailed; ADService.OnRewardLoaded = OnRewardLoaded; ADService.OnRewardFailed = OnRewardFailed; + + // ---------- Start Services ---------- + ADService.Instance.StartService(OnAdsInitComplete, spec); } private static void OnBannerLoaded() diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index 3867baa..3f89e57 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -92,12 +92,15 @@ namespace Guru bool iapEnabled = true, bool autoRecordFinishedLevels = true, bool debugMode = false, + bool isBuyNoAds = false, + string bannerColor = "#00000000", Dictionary defaultRemoteData = null, byte[] googleKeys = null, byte[] appleRootCerts = null) { var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled, - autoRecordFinishedLevels, debugMode, defaultRemoteData, googleKeys, appleRootCerts); + autoRecordFinishedLevels, isBuyNoAds, bannerColor, + debugMode, defaultRemoteData, googleKeys, appleRootCerts); return config; }