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