update: 更新 IAP 初始化值, 回调值, IAP 接口参数公开, 生命周期回调, bPlay, bLevel 接口公开
parent
75745ceb11
commit
04d1c6df21
|
|
@ -127,6 +127,13 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class IAP
|
public static class IAP
|
||||||
{
|
{
|
||||||
|
internal static Action _onIAPInitStart;
|
||||||
|
public static event Action OnIAPInitStart
|
||||||
|
{
|
||||||
|
add => _onIAPInitStart += value;
|
||||||
|
remove => _onIAPInitStart -= value;
|
||||||
|
}
|
||||||
|
|
||||||
internal static Action<bool> _onIAPInitComplete;
|
internal static Action<bool> _onIAPInitComplete;
|
||||||
public static event Action<bool> OnIAPInitComplete
|
public static event Action<bool> OnIAPInitComplete
|
||||||
{
|
{
|
||||||
|
|
@ -141,6 +148,13 @@ namespace Guru
|
||||||
remove => _onPurchaseStart -= value;
|
remove => _onPurchaseStart -= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static Action<string, bool> _onPurchaseEnd;
|
||||||
|
public static event Action<string, bool> OnPurchaseEnd
|
||||||
|
{
|
||||||
|
add => _onPurchaseEnd += value;
|
||||||
|
remove => _onPurchaseEnd -= value;
|
||||||
|
}
|
||||||
|
|
||||||
internal static Action<string, string> _onPurchaseFailed;
|
internal static Action<string, string> _onPurchaseFailed;
|
||||||
public static event Action<string, string> OnPurchaseFailed
|
public static event Action<string, string> OnPurchaseFailed
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ namespace Guru
|
||||||
public const string BuyFail_Unknown = "Unknown";
|
public const string BuyFail_Unknown = "Unknown";
|
||||||
|
|
||||||
|
|
||||||
|
#region Init
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化IAP 功能
|
/// 初始化IAP 功能
|
||||||
|
|
@ -32,10 +33,11 @@ namespace Guru
|
||||||
GuruIAP.Instance.OnBuyFailed += OnBuyFailed;
|
GuruIAP.Instance.OnBuyFailed += OnBuyFailed;
|
||||||
GuruIAP.Instance.OnGetProductReceipt += OnGetReceipt;
|
GuruIAP.Instance.OnGetProductReceipt += OnGetReceipt;
|
||||||
|
|
||||||
|
Callbacks.IAP._onIAPInitStart?.Invoke(); // 初始化之前进行调用
|
||||||
|
|
||||||
GuruIAP.Instance.InitWithKeys(googleKey, appleRootCerts, IsDebugMode);
|
GuruIAP.Instance.InitWithKeys(googleKey, appleRootCerts, IsDebugMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化结果
|
/// 初始化结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -59,6 +61,8 @@ namespace Guru
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Data
|
#region Data
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -180,6 +184,7 @@ namespace Guru
|
||||||
private static void OnBuyEnd(string productName, bool success)
|
private static void OnBuyEnd(string productName, bool success)
|
||||||
{
|
{
|
||||||
_onPurchaseCallback?.Invoke(productName, success);
|
_onPurchaseCallback?.Invoke(productName, success);
|
||||||
|
Callbacks.IAP._onPurchaseEnd?.Invoke(productName, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -241,19 +246,6 @@ 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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,8 +32,6 @@ namespace Guru
|
||||||
|
|
||||||
public static string AppVersionString => GuruAppVersion.ToString();
|
public static string AppVersionString => GuruAppVersion.ToString();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static GuruAppVersion _appVersion;
|
private static GuruAppVersion _appVersion;
|
||||||
private static GuruAppVersion GuruAppVersion
|
private static GuruAppVersion GuruAppVersion
|
||||||
{
|
{
|
||||||
|
|
@ -44,6 +42,35 @@ namespace Guru
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置购买去广告道具的标志位
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
public static void SetBuyNoAds(bool value = true)
|
||||||
|
{
|
||||||
|
ADService.Instance.IsBuyNoAds = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所有成功的主线关卡数量 (b_level)
|
||||||
|
/// </summary>
|
||||||
|
public static int SuccessLevelCount
|
||||||
|
{
|
||||||
|
get => GuruSDKModel.Instance.SuccessLevelCount;
|
||||||
|
set => GuruSDKModel.Instance.SuccessLevelCount = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 成功关卡总计数量 (b_play)
|
||||||
|
/// </summary>
|
||||||
|
public static int TotalPlayedCount
|
||||||
|
{
|
||||||
|
get => GuruSDKModel.Instance.TotalPlayedCount;
|
||||||
|
set => GuruSDKModel.Instance.TotalPlayedCount = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ namespace Guru
|
||||||
private void InitAllServices()
|
private void InitAllServices()
|
||||||
{
|
{
|
||||||
bool useKeywords = false;
|
bool useKeywords = false;
|
||||||
bool useIAP = true;
|
bool useIAP = _initConfig.IAPEnabled;
|
||||||
bool appleReview = false;
|
bool appleReview = false;
|
||||||
|
|
||||||
var services = GetRemoteServicesConfig();
|
var services = GetRemoteServicesConfig();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue