udpate: 初始化参数添加 去广告 和 banner 背景色
parent
fec486e8a6
commit
311b53ea5f
|
|
@ -28,6 +28,14 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string CustomServiceKey = "";
|
public string CustomServiceKey = "";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Banner 背景颜色 Hex 值
|
||||||
|
/// </summary>
|
||||||
|
public string BannerBackgroundColor = "#00000000";
|
||||||
|
/// <summary>
|
||||||
|
/// 已购买去广告道具
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBuyNoAds = false;
|
||||||
|
/// <summary>
|
||||||
/// Debug模式(默认关闭)
|
/// Debug模式(默认关闭)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DebugMode = false;
|
public bool DebugMode = false;
|
||||||
|
|
@ -54,6 +62,8 @@ namespace Guru
|
||||||
bool autoLoadAds = true,
|
bool autoLoadAds = true,
|
||||||
bool iapEnabled = true,
|
bool iapEnabled = true,
|
||||||
bool autoRecordFinishedLevels = true,
|
bool autoRecordFinishedLevels = true,
|
||||||
|
bool isBuyNoAds = false,
|
||||||
|
string bannerBackgroundColor = "#00000000",
|
||||||
bool debugMode = false,
|
bool debugMode = false,
|
||||||
Dictionary<string, object> defaultRemoteData = null,
|
Dictionary<string, object> defaultRemoteData = null,
|
||||||
byte[] googleKeys = null,
|
byte[] googleKeys = null,
|
||||||
|
|
@ -66,6 +76,8 @@ namespace Guru
|
||||||
AutoLoadWhenAdsReady = autoLoadAds,
|
AutoLoadWhenAdsReady = autoLoadAds,
|
||||||
IAPEnabled = iapEnabled,
|
IAPEnabled = iapEnabled,
|
||||||
AutoRecordFinishedLevels = autoRecordFinishedLevels,
|
AutoRecordFinishedLevels = autoRecordFinishedLevels,
|
||||||
|
IsBuyNoAds = isBuyNoAds,
|
||||||
|
BannerBackgroundColor = bannerBackgroundColor,
|
||||||
DebugMode = debugMode,
|
DebugMode = debugMode,
|
||||||
GoogleKeys = googleKeys,
|
GoogleKeys = googleKeys,
|
||||||
AppleRootCerts = appleRootCerts,
|
AppleRootCerts = appleRootCerts,
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,10 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static void StartAdService(AdsInitSpec spec = null)
|
internal static void StartAdService(AdsInitSpec spec = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//---------- Using InitConfig ----------
|
||||||
|
if (InitConfig is { IsBuyNoAds: true }) SetBuyNoAds(true);
|
||||||
|
|
||||||
LogI($"StartAdService");
|
LogI($"StartAdService");
|
||||||
if (spec == null)
|
if (spec == null)
|
||||||
{
|
{
|
||||||
|
|
@ -248,14 +252,19 @@ namespace Guru
|
||||||
spec = AdsInitSpec.BuildWithNoAds(InitConfig.AutoLoadWhenAdsReady, IsDebugMode);
|
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.OnBannerLoaded = OnBannerLoaded;
|
||||||
ADService.OnInterstitialLoaded = OnInterstitialLoaded;
|
ADService.OnInterstitialLoaded = OnInterstitialLoaded;
|
||||||
ADService.OnInterstitialFailed = OnInterstitialFailed;
|
ADService.OnInterstitialFailed = OnInterstitialFailed;
|
||||||
ADService.OnRewardLoaded = OnRewardLoaded;
|
ADService.OnRewardLoaded = OnRewardLoaded;
|
||||||
ADService.OnRewardFailed = OnRewardFailed;
|
ADService.OnRewardFailed = OnRewardFailed;
|
||||||
|
|
||||||
|
// ---------- Start Services ----------
|
||||||
|
ADService.Instance.StartService(OnAdsInitComplete, spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnBannerLoaded()
|
private static void OnBannerLoaded()
|
||||||
|
|
|
||||||
|
|
@ -92,12 +92,15 @@ namespace Guru
|
||||||
bool iapEnabled = true,
|
bool iapEnabled = true,
|
||||||
bool autoRecordFinishedLevels = true,
|
bool autoRecordFinishedLevels = true,
|
||||||
bool debugMode = false,
|
bool debugMode = false,
|
||||||
|
bool isBuyNoAds = false,
|
||||||
|
string bannerColor = "#00000000",
|
||||||
Dictionary<string, object> defaultRemoteData = null,
|
Dictionary<string, object> defaultRemoteData = null,
|
||||||
byte[] googleKeys = null,
|
byte[] googleKeys = null,
|
||||||
byte[] appleRootCerts = null)
|
byte[] appleRootCerts = null)
|
||||||
{
|
{
|
||||||
var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled,
|
var config = GuruSDKInitConfig.Build(useCustomConsent, autoLoadAds, iapEnabled,
|
||||||
autoRecordFinishedLevels, debugMode, defaultRemoteData, googleKeys, appleRootCerts);
|
autoRecordFinishedLevels, isBuyNoAds, bannerColor,
|
||||||
|
debugMode, defaultRemoteData, googleKeys, appleRootCerts);
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue